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-lib] Fix shrinkwrap-deps.json missing file #5021

Merged
Merged
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 Rush sometimes incorrectly reported \"fatal: could not open 'packages/xxx/.rush/temp/shrinkwrap-deps.json' for reading: No such file or directory\" when using subspaces",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
24 changes: 11 additions & 13 deletions libraries/rush-lib/src/logic/ProjectChangeAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,25 +257,23 @@ export class ProjectChangeAnalyzer {
const additionalRelativePathsToHash: string[] = [];
const globalAdditionalFiles: string[] = [];
if (rushConfiguration.packageManager === 'pnpm') {
const absoluteFilePathsToCheck: string[] = [];

for (const project of rushConfiguration.projects) {
await Async.forEachAsync(rushConfiguration.projects, async (project: RushConfigurationProject) => {
const projectShrinkwrapFilePath: string = BaseProjectShrinkwrapFile.getFilePathForProject(project);
absoluteFilePathsToCheck.push(projectShrinkwrapFilePath);
const relativeProjectShrinkwrapFilePath: string = Path.convertToSlashes(
path.relative(rootDirectory, projectShrinkwrapFilePath)
);

additionalRelativePathsToHash.push(relativeProjectShrinkwrapFilePath);
}
if (!(await FileSystem.existsAsync(projectShrinkwrapFilePath))) {
if (rushConfiguration.subspacesFeatureEnabled) {
return;
}

await Async.forEachAsync(absoluteFilePathsToCheck, async (filePath: string) => {
if (!rushConfiguration.subspacesFeatureEnabled && !(await FileSystem.existsAsync(filePath))) {
throw new Error(
`A project dependency file (${filePath}) is missing. You may need to run ` +
`A project dependency file (${projectShrinkwrapFilePath}) is missing. You may need to run ` +
'"rush install" or "rush update".'
);
}

const relativeProjectShrinkwrapFilePath: string = Path.convertToSlashes(
path.relative(rootDirectory, projectShrinkwrapFilePath)
);
additionalRelativePathsToHash.push(relativeProjectShrinkwrapFilePath);
});
} else {
// Add the shrinkwrap file to every project's dependencies
Expand Down
Loading