DEV Community

Kinga
Kinga

Posted on • Edited on

1

rush dist:package

Rush global commands are invoked once for the entire repo.

See Custom commands for information on writing and using custom commands.

Publishing prerelease

Package all as prerelease

rush dist:package --include-all --prerelease `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand'
# if your bulk command accepts parameters:
rush dist:package --include-all --prerelease `
  --package-command 'my-bulk-command --param1 --param2' `
  --copy-command 'my-bulk-copyCommand --param1 --param2'
# package only projects with version policy:
rush dist:package --include-all --prerelease --version-policy 'MyLibraries' `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand --param1 --param2'
Enter fullscreen mode Exit fullscreen mode
  • retrieves a list of all projects managed by rush; if --version-policy is specified, selects all projects using the version policy
  • invokes bulk --package-command command
  • invokes bulk --copy-command (this command is optional)

This approach simplifies testing process, when a solution should be deployed to a testing environment before being released.

Package changed as prerelease

rush dist:package --prerelease `
  --package-command 'my-bulk-command'`
  --copy-command 'my-bulk-copyCommand'
# or, if your bulk command accepts parameters:
rush dist:package --prerelease `
  --package-command 'my-bulk-command --param1 --param2'`
   --copy-command 'my-bulk-copyCommand --param1 --param2'
Enter fullscreen mode Exit fullscreen mode
  • gets changed projects only
  • invokes bulk --package-command command
  • invokes bulk --copy-command (this command is optional)

How are changed projects detected in --prerelease?

Changed projects are detected using ProjectChangeAnalyzer.getChangedProjectsAsync which returns projects that have changed in the current state of the repo when compared to the specified branch.
If --target-branch is specified, it compares the checked out branch with the specified branch to determine which projects were changed. Otherwise, the checked out branch is compared against the main branch.

Publishing stable

Publish all as stable

Execute this command after rush version, to package and deploy release versions of the project.

# package all projects and copy the resulting files to specified location
rush dist:package --include-all `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand'
# or, if your bulk commands accept parameters:
rush dist:package --include-all `
  --package-command 'my-bulk-command --param1 --param2' `
  --copy-command 'my-bulk-copyCommand --param1 --param2'
# package only projects with version policy:
rush dist:package --include-all --version-policy 'MyLibraries' `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand'
Enter fullscreen mode Exit fullscreen mode
  • retrieves a list of all projects managed by rush; if --version-policy is specified, selects all projects using the version policy
  • regenerates CHANGELOG.md files in case CHANGELOG.json files have been manually updated afer rush version,
  • invokes bulk --package-command command
  • invokes bulk --copy-command (this command is optional)
  • tags the projects
  • saves new tag values in rush.json
  • commits CHANGELOG.md, CHANGELOG.json and rush.json files

Publish changed as stable

# package changed projects and copy the resulting files to specified location
rush dist:package `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand'
# or, if your bulk command accepts parameters:
rush dist:package `
  --package-command 'my-bulk-command --param1 --param2' `
  --copy-command 'my-bulk-copyCommand --param1 --param2'
# package only projects with version policy:
rush dist:package --version-policy 'MyLibraries' `
  --package-command 'my-bulk-command' `
  --copy-command 'my-bulk-copyCommand'
Enter fullscreen mode Exit fullscreen mode
  • retrieves a list of changed projects comparing project's version with a published_v{versionNumber} tag,
  • regenerates CHANGELOG.md files in case CHANGELOG.json files have been manually updated afer rush version,
  • invokes bulk --package-command command
  • invokes bulk --copy-command (this command is optional)
  • tags changed projects
  • saves new tag value for changed projects to rush.json
  • commits CHANGELOG.md, CHANGELOG.json and rush.json files

How are changed projects detected?

Since the change files are deleted during rush version, rush dist:package detects changed projects by comparing versions in each project's package.json file with a project's tags in the rush.json file. If no appropriate tags are found in rush.json, the project will be published.

This command should be executed after rush version, to package and deploy release versions of the projects.

See the dist:package documentation on GitHub

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay