Skip to content

[rush] Provide override for package.json script executed by bulk commands#2298

Closed
ifeanyiecheruo wants to merge 1 commit intomicrosoft:masterfrom
ifeanyiecheruo:build
Closed

[rush] Provide override for package.json script executed by bulk commands#2298
ifeanyiecheruo wants to merge 1 commit intomicrosoft:masterfrom
ifeanyiecheruo:build

Conversation

@ifeanyiecheruo
Copy link

Proof of concept solution for #2283 (Support customizing CI builds from Dev builds)

Adds a script configuration option for bulk commands that specifies
the package.json script to execute (falls-back to the bulk action name)

If an array of names is specified the first name that matches a scripts
entry in package.json will be executed (falls-back to the bulk action name).

This change also

  • updates the default configuration for the builtin build command to have
    a script entry of "rush-build"
  • updates the default configuration of the built in rebuild command to have
    a script entry of ["rush-build", "build"]

This enables a scenario where...

  • a package can specify what happens for rush build
  • a package can specify what happens rushx build (clean, build)
    Without the two behaviors conflicting
"script": {
  "build": "heft build --clean",
  "rush-build": "heft test --clean",
}

Adds a script configuration option for bulk commands that specifies
the package.json script to execute (falls-back to the bulk action name)

If an array of names is specified the first name that matches a scripts
entry in package.json will be executed (falls-back to the bulk action name).

This change also
- updates the default configuration for the builtin build command to have
  a script entry of "rush-build"
- updates the default configuration of the built in rebuild command to have
  a script entry of ["rush-build", "build"]

This enables a scenario where...
- a package can specify what happens for rush build
- a package can specify what happens rushx build (clean, build)
Without the two behaviors conflicting

"script": {
  "build": "heft build --clean",
  "rush-build": "heft test --clean",
}
@octogonz octogonz changed the title Provide override for package.json script executed by bulk commands [rush] Provide override for package.json script executed by bulk commands Oct 19, 2020
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this in general, just a minor note about the package deps file name for cacheability.

ignoreMissingScript: this._ignoreMissingScript,
ignoreDependencyOrder: this._ignoreDependencyOrder,
packageDepsFilename: Utilities.getPackageDepsFilenameForCommand(this._commandToRun)
packageDepsFilename: Utilities.getPackageDepsFilenameForCommand(this._commandToRun[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should use the name of the command that actually executed, in case there is a collision between multiple Rush commands.

@iclanton iclanton deleted the branch microsoft:master April 9, 2022 01:38
@iclanton iclanton closed this Apr 9, 2022
@halimb
Copy link

halimb commented Apr 12, 2022

@iclanton this PR is referenced in the official documentation: https://rushjs.io/pages/advanced/watch_mode/#the-watchforchanges-setting-experimental

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants