Check for workspace:^ before replacing the version in package.json#108
Merged
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.
Mrtenz
commented
Apr 3, 2023
Comment on lines
+13
to
+15
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version-file: '.nvmrc' |
Member
Author
There was a problem hiding this comment.
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
previously approved these changes
Apr 3, 2023
| : dependencyObject[packageName]; | ||
| newDeps[packageName] = | ||
| packagesToUpdate.has(packageName) && | ||
| dependencyObject[packageName] !== 'workspace:^' |
Member
There was a problem hiding this comment.
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.
This change checks whether a dependency field starts with 'workspace:', instead of being equal to 'workspace:^'.
Gudahtt
approved these changes
Apr 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.