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 7373 </Target>
7474
7575 <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" />
7777 <ItemGroup>
7878 <PackageJsonBackupFiles Include="$(RepoRoot)**/*.json.bak" />
79+ <ModifiedPackageJsonFiles Include="@(PackageJsonBackupFiles -> Replace('.bak', ''))" />
7980 </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) != ''" />
8386 <!-- Restore package-lock.json from git if it was modified -->
8487 <Exec Command="git checkout -- package-lock.json"
8588 WorkingDirectory="$(RepoRoot)"
8689 ContinueOnError="true" />
90+ <!-- Clean up backup files -->
91+ <Delete Files="@(PackageJsonBackupFiles)" Condition="@(PackageJsonBackupFiles) != ''" />
8792 </Target>
8893
8994 <!-- Import Directory.Build.targets -->
You can’t perform that action at this time.
0 commit comments