Skip to content

[rush-lib] Don't interrupt the installation process if the user hasn't enabled the inject dependencies feature. #4830

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 3 commits into from
Jul 12, 2024
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": "Don't interrupt the installation process if the user hasn't enabled the inject dependencies feature.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
6 changes: 6 additions & 0 deletions libraries/rush-lib/src/logic/RepoStateFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ export class RepoStateFile {
) {
this._packageJsonInjectedDependenciesHash = packageJsonInjectedDependenciesHash;
this._modified = true;
} else if (!packageJsonInjectedDependenciesHash && this._packageJsonInjectedDependenciesHash) {
// if packageJsonInjectedDependenciesHash is undefined, but this._packageJsonInjectedDependenciesHash is not
// means users may turn off the injected installation
// so we will need to remove unused fields in repo-state.json as well
this._packageJsonInjectedDependenciesHash = undefined;
this._modified = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ export class WorkspaceInstallManager extends BaseInstallManager {
// there is a situation that the subspace previously has injected dependencies but removed
// so we can check if the repoState up to date
if (repoState.packageJsonInjectedDependenciesHash !== undefined) {
shrinkwrapWarnings.push(`Some injected dependencies' package.json might have been modified.`);
shrinkwrapIsUpToDate = false;
shrinkwrapWarnings.push(
`It was detected that ${repoState.filePath} contains packageJsonInjectedDependenciesHash` +
' but the injected dependencies feature is not enabled. You can manually remove this field in repo-state.json.' +
' Or run rush update command to update the repo-state.json file.'
);
}
}
}
Expand Down
Loading