Skip to content

Commit 53805e6

Browse files
committed
Avoid modifying dependencies during build if already correct
1 parent ff355b2 commit 53805e6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

eng/Npm.Workspace.nodeproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
EnvironmentVariables="$(_NpmAdditionalEnvironmentVariables)" />
4646
</Target>
4747

48-
<Target Name="Build">
48+
<Target Name="Build" DependsOnTargets="Restore">
4949
<PropertyGroup>
5050
<PackageVersion>$(VersionPrefix)</PackageVersion>
5151
<PackageVersion Condition="'$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>

eng/scripts/npm/update-dependency-versions.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ function applyPackageVersion(packagesToPack, defaultPackageVersion) {
4545
const packageName = packageJson.name;
4646
const packageVersion = defaultPackageVersion;
4747
const packageDir = path.dirname(packagePath);
48+
49+
// Check if the version is already correct
50+
if (packageJson.version === packageVersion) {
51+
console.log(`Skipping ${packageName} - version ${packageVersion} already applied.`);
52+
continue;
53+
}
54+
4855
// Run npm version packageVersion --no-git-tag-version
4956
// This will update the package.json version to the specified version without creating a git tag
5057
// Make a backup of the package.json

0 commit comments

Comments
 (0)