-
-
Notifications
You must be signed in to change notification settings - Fork 14
Check for workspace:^ before replacing the version in package.json
#108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…version This change modifies getUpdatedDependencyField function to check the dependencyObject values for `workspace:^` as a condition before replacing the version with newVersionRange. The 'workspace:^' should not be overridden with newVersionRange.
Without specifying a version in the workflow, the job could fail or use the wrong version of Node.js. This change ensures that the job uses the Node.js version specified in .nvmrc.
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version-file: '.nvmrc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package never had a proper Node.js setup step. The default Node.js version now seems to be 18, causing installation of dependencies to fail.
Gudahtt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/package-operations.ts
Outdated
| : dependencyObject[packageName]; | ||
| newDeps[packageName] = | ||
| packagesToUpdate.has(packageName) && | ||
| dependencyObject[packageName] !== 'workspace:^' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Perhaps we could see if it starts with workspace: instead? We usually use the ^ range but the problem should apply for any type of range used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, updated!
This change checks whether a dependency field starts with 'workspace:', instead of being equal to 'workspace:^'.
Description
This pull request modifies the
getUpdatedDependencyFieldfunction to avoid overriding the dependencies that should notbe updated. The update process should ignore certain dependencies that are used across multiple packages in a workspace.
The change involves introducing a check for the presence of
workspace:^in thepackage.jsonfile before updatingthe version. This is an important step because
workspace:^should not be overridden with new version ranges. The restof the dependency versions can be updated, however.
Changes
workspace:^ingetUpdatedDependencyFieldthat prevents updating the version range for this dependency.