File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 73
73
</Target>
74
74
75
75
<Target Name="RestorePackageJsonFiles" AfterTargets="Build;Pack">
76
- <Message Text="Restoring package.json files and package-lock.json from backups ..." Importance="high" />
76
+ <Message Text="Restoring modified files using git checkout ..." Importance="high" />
77
77
<ItemGroup>
78
78
<PackageJsonBackupFiles Include="$(RepoRoot)**/*.json.bak" />
79
+ <ModifiedPackageJsonFiles Include="@(PackageJsonBackupFiles -> Replace('.bak', ''))" />
79
80
</ItemGroup>
80
- <Move SourceFiles="@(PackageJsonBackupFiles)"
81
- DestinationFiles="@(PackageJsonBackupFiles -> Replace('.bak', ''))"
82
- Condition="@(PackageJsonBackupFiles) != ''" />
81
+ <!-- Restore package.json files from git -->
82
+ <Exec Command="git checkout -- "%(ModifiedPackageJsonFiles.Identity)""
83
+ WorkingDirectory="$(RepoRoot)"
84
+ ContinueOnError="true"
85
+ Condition="@(ModifiedPackageJsonFiles) != ''" />
83
86
<!-- Restore package-lock.json from git if it was modified -->
84
87
<Exec Command="git checkout -- package-lock.json"
85
88
WorkingDirectory="$(RepoRoot)"
86
89
ContinueOnError="true" />
90
+ <!-- Clean up backup files -->
91
+ <Delete Files="@(PackageJsonBackupFiles)" Condition="@(PackageJsonBackupFiles) != ''" />
87
92
</Target>
88
93
89
94
<!-- Import Directory.Build.targets -->
You can’t perform that action at this time.
0 commit comments