rushstack
rushstack copied to clipboard
[rush] deferredInstallationScripts & --ignore-scripts
Summary
This PR implements "two stage install" proposal. close https://github.com/microsoft/rushstack/issues/3530
Details
This feature is now behind a flag in experiments.json: "deferredInstallationScripts": true
Workflow now:
- Dividing "rush install/update" into two stage install when using pnpm & "useWorkspaces" on implicitly.
- During two stage install, '--ignore-scripts' is pushed as a cli parameter to "pnpm install".
- After "pnpm install" successfully, if "--ignore-scripts" is not specified explicitly by user, run "pnpm rebuild --pending"
Goal: faster retries for install lifecycle scripts: If step3 fails, such as encountering an error in a "postinstall" scripts, rerun "rush install" will skip step2, which gets a faster retry on failed scripts.
How it was tested
Use rushstack repo for example
rush --debug install -t rush

two stage install works :)
rush --debug install -t rush-lib
Because -t rush-lib is a subset of -t rush, stage1(pnpm install w/ --ignore-scripts) was skipped, and stage2(pnpm rebuild --pending) was run. At the same time, there is no pending rebuild scripts to run. rebuild finished in seconds.

Updates 2022/8/7:
- rebase latest main branch
- rename pushRebuildArgs to pushPnpmRebuildCommandArgs
- add a comment on Stage 1
- throw error when specifying --ignore-scripts in non-pnpm repos
- refactor last-install flag and add a individual
isSelectedProjectInstalledmethod
Update: Sync this branch with the latest main branch
Update:
- merge the latest main branch
- update change log comment