Skip to content

Instantly share code, notes, and snippets.

@shakogegia
Forked from xpepermint/README.md
Created March 3, 2022 10:41
Show Gist options
  • Save shakogegia/14788f8ea2bbf5e90162f2a31add8d84 to your computer and use it in GitHub Desktop.
Save shakogegia/14788f8ea2bbf5e90162f2a31add8d84 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