rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] postinstall config is not getting executed by default on "rush install/rush update"

Open Sukesh-Gundoji opened this issue 6 years ago • 5 comments

Please prefix the issue title with the project name i.e. [rush], [api-extractor] etc.

Is this a feature or a bug?

  • [ ] Feature
  • [ ] Bug

Please describe the actual behavior. Need help: we are having a monorepo which contains multiple angular projects(libraries). Recently, we upgraded to angular V9. During this phase we explored that our library node_modules needs to be Angular Ivy compatible for which we have to make sure running "ngcc" after any change in node_module installation in each individual project/library.

In npm/yarn scenario we can use "postinstall" option which is available in package.json.

Is there a way we can achieve the same in Rush ? and also, will "postRushInstall" option can be of any help ? if so, can you please provide an example for the same ?

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate.

What is the expected behavior?

If this is a bug, please provide the tool version, Node.js version, and OS.

  • Tool:
  • Tool Version:
  • Node Version:
    • Is this a LTS version?
    • Have you tested on a LTS version?
  • OS:

Sukesh-Gundoji avatar Mar 21 '20 18:03 Sukesh-Gundoji

I'm not very familiar with Angular. Can you share a repro?

iclanton avatar Mar 23 '20 17:03 iclanton

Sorry for delay in response. I am trying to get a simple repro scenario out of my current application(which is a bit difficult...trying). meanwhile I just want to check a simple thing. as part of "rush update/rush install" command will it run package.json's "postinstall" config(which happens default in yarn/npm ?

Sukesh-Gundoji avatar Mar 25 '20 19:03 Sukesh-Gundoji

meanwhile I just want to check a simple thing. as part of "rush update/rush install" command will it run package.json's "postinstall" config(which happens default in yarn/npm ?

rush install will run the postinstall scripts for external dependencies. It will NOT run postinstall scripts found in the package.json for a local project, because those projects are locally linked rather than being "installed."

The postRushInstall script runs once for the entire monorepo, after rush install is finished.

octogonz avatar Mar 27 '20 00:03 octogonz

Related to #862

yume-chan avatar Oct 14 '21 03:10 yume-chan

Didn't realize that when "useWorkspaces": true is used, postinstall scripts run automatically after each rush install/update.

With "useWorkspaces": false, rush collects dependencies from all projects, to generate a new package.json to be used pnpm install. Now with "useWorkspaces": true, rush calls pnpm install --recursive, which uses each package.json directly, thus also runs postinstall scripts.

yume-chan avatar Jan 05 '23 10:01 yume-chan