rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] deferredInstallationScripts & --ignore-scripts

Open chengcyber opened this issue 3 years ago • 3 comments

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:

  1. Dividing "rush install/update" into two stage install when using pnpm & "useWorkspaces" on implicitly.
  2. During two stage install, '--ignore-scripts' is pushed as a cli parameter to "pnpm install".
  3. 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

  1. rush --debug install -t rush

2022-07-14 at 3 29 PM

two stage install works :)

  1. 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.

2022-07-14 at 3 32 PM

chengcyber avatar Jul 14 '22 07:07 chengcyber

Updates 2022/8/7:

  1. rebase latest main branch
  2. rename pushRebuildArgs to pushPnpmRebuildCommandArgs
  3. add a comment on Stage 1
  4. throw error when specifying --ignore-scripts in non-pnpm repos
  5. refactor last-install flag and add a individual isSelectedProjectInstalled method

chengcyber avatar Aug 07 '22 16:08 chengcyber

Update: Sync this branch with the latest main branch

chengcyber avatar Dec 02 '22 08:12 chengcyber

Update:

  1. merge the latest main branch
  2. update change log comment

chengcyber avatar Dec 16 '22 03:12 chengcyber