Skip to content

[rush-lib] prevent workspace dependencies in decoupledLocalDependencies #4853

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

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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,11 @@
{
"changes": [
{
"comment": "prevent workspace deps in decoupledLocalDependencies",
"type": "none",
"packageName": "@microsoft/rush"
}
],
"packageName": "@microsoft/rush",
"email": "jamesmaher-dd@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,25 @@ export class WorkspaceInstallManager extends BaseInstallManager {
shrinkwrapIsUpToDate = false;
continue;
}
} else if (dependencySpecifier.specifierType === DependencySpecifierType.Workspace) {
} else if (
dependencySpecifier.specifierType === DependencySpecifierType.Workspace &&
rushProject.decoupledLocalDependencies.has(name)
) {
// If the dependency is a local project that is decoupled, then we need to ensure that it is not specified
// as a workspace project. If it is, then we need to update the package.json to remove the workspace notation.
// eslint-disable-next-line no-console
console.log();
// eslint-disable-next-line no-console
console.log(
Colorize.red(
`"${rushProject.packageName}" depends on package ${name}@${version}, but also lists it in` +
`its "decoupledLocalDependencies" array. Either update the host project's package.json to use ` +
`a version from an external feed instead of "workspace:" notation, or remove the dependency from the ` +
`host project's "decoupledLocalDependencies" array in rush.json.`
)
);
throw new AlreadyReportedError();
} else if (!rushProject.decoupledLocalDependencies.has(name)) {
// Already specified as a local project. Allow the package manager to validate this
continue;
}
Expand Down
Loading