-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Rush to pnpm Migration Guide
The Azure SDK for JavaScript is migrating from Rush to pnpm as part of the Azure SDK for JavaScript modernization efforts. This is a guide to show how to migrate from Rush commands to pnpm commands for common scenarios.
These are the following scenarios covered:
- Installation
- Common Commands
- Using Commands
Commonly Rush was installed using npm
and installing globally such as the following:
npm install -g @microsoft/rush
Once installed, we then initialize Rush with:
rush update
pnpm can be installed as noted in the installation guide either through a shell script, package manager such as WinGet or Homebrew, or npm with or without Corepack.
Once installed, you should run install
inside the SDK project.
pnpm install
All common commands from Rush are directly translated to pnpm directly for the following, by simply replacing rush
with pnpm
-
build
: Builds the project -
build:test
: Builds the project for testing -
build:samples
: Builds the samples -
clean
: Cleans the workspace and project -
check-format
: Checks the formatting using Prettier -
format
: Formats the project using Prettier -
integration-test
: Executes the integration tests for both browser and Node.js -
integration-test:browser
: Executes the integration tests for the browser -
integration-test:node
: Excutes the integration tests for Node.js -
lint
: Checks the linting using ESLint -
lint:fix
: Checks the linting using ESLint and fixes the issues if they are fixable -
test
: Executes all tests for both unit and integration tests -
unit-test
: Executes the unit tests for both the browser and Node.js -
unit-test:browser
: Executes the unit tests for the browser -
unit-test:node
: Excutes the unit tests for Node.js -
update-snippets
: Updates the snippets for documentation and code
With Rush, we could run against the entire repository such as building everything in the workspace using:
rush build
For building a single project, uses the -t
option.
rush build -t <project-name>
Accepts multiple projects to build at once with usage of multiple -t
rush build -t <project-name-1> -t <project-name-2>
When inside a service SDK folder, we can run the local commands using rushx
such as:
rushx build
To target everything we can do the same with pnpm, for example to build the entire workspace.
pnpm build
To build a single project, we can use the --filter=<package-name>...
option. Note in order to build the project and its dependencies, the ...
is required after the project name, however, if you just want to build the project without its depdendencies, you can leave off the ...
.
pnpm build --filter=<project-name>...
Multiple filters can be used to build multiple projects such as the following:
pnpm build --filter=<project-name-1>... --filter<project-name-2>...
When inside a project, we can build the project by itself with depdendencies such as the following using the -r
for recursive:
pnpm -r build
If we just want to build the project by itself and not its dependencies, we can omit the -r
option:
pnpm build