Skip to content

Instantly share code, notes, and snippets.

@xpepermint
Last active November 14, 2022 19:48
Show Gist options
  • Save xpepermint/eecfc6ad6cd7c9f5dcda381aa255738d to your computer and use it in GitHub Desktop.
Save xpepermint/eecfc6ad6cd7c9f5dcda381aa255738d to your computer and use it in GitHub Desktop.
RushJS cheatsheet

Commands

Install dependencies:

npm install -g @microsoft/rush

Initialize the project:

$ rush init

Update packages and rebuild.

$ rush update --full
$ rush rebuild

Publish to NPM:

$ rush version --bump --override-bump minor
$ rush publish --publish --include-all

Check dependencies of each package.

$ rush check

Custom commands

Open common/config/command-line.json and add a custom command.

{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
  "commands": [
    {
      "commandKind": "bulk",
      "name": "test",
      "summary": "Test packages.",
      "description": "Executes automated tests.",
      "enableParallelism": true
    }
  ],
  "parameters": []
}

You can now run rush test to run it.

Publish policy

Open common/config/version-policies.json and add a policy.

[
  {
    "policyName": "framework",
    "definitionName": "lockStepVersion",
    "version": "1.3.2",
    "nextBump": "patch"
  }
]

Open rush.json and attach this policy to each package.

{
   "projects": [
    {
      "packageName": "@xtest/sandbox",
      "projectFolder": "packages/xtest-sandbox",
      "versionPolicyName": "framework"
    }
    ...
   ],
}

Bump packages and publish all to NPM.

$ rush version --bump
$ rush publish --publish --include-all

Override the policy versioning.

$ rush version --bump --override-bump minor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment