Skip to content
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

[rush] Fix edge cases where Rush does not update the lockfile #4910

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix an issue where moving dependencies from `dependencies` to `devDependencies` in a project's `package.json` did not trigger an lockfile update.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
2 changes: 1 addition & 1 deletion libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1002,9 +1002,9 @@ export class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
}
// If fall through, there is a chance the package declares an inconsistent version, ignore it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be an error case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this an error case would likely mitigate whatever issue the existing code was trying to account for.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this an error case would likely mitigate whatever issue the existing code was trying to account for.

I'm not sure about that. If the inconsistency is in an indirect dependency, and PNPM tolerates it, then Rush probably should as well.

isDevDepFallThrough = true;
break;
}

// eslint-disable-next-line no-fallthrough
case DependencyType.Regular:
specifierFromLockfile = importer.dependencies?.[name];
importerDependencies.delete(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe(PnpmShrinkwrapFile.name, () => {
project,
project.rushConfiguration.defaultSubspace
)
).resolves.toBe(false);
).resolves.toBe(true);
});
});
});
Expand Down
Loading