* docs: lint prose with Vale Add Vale with an in-repo style, .vale/styles/pnpm, that turns the writing rules in AGENTS.md and the Google developer documentation style guide into lint rules. The stock Vale packages (Google, Microsoft, RedHat, write-good) were too noisy to block on, for example 1,300 passive-voice hits in the v12 docs alone, so the rules are written for this repo, following the GitLab model. Each one links the guideline it enforces. Levels: - error, fails CI: dashes, plain-word substitutions, condescending words, "please", "note that", hedges, puffery, optional plurals, exclamation marks, ellipses, curly quotes, generic link text, product spellings, sentence-case headings, repeated words, double spaces, implementation history in comments; in changesets, bold or italic emphasis, internal names and release-line names. - warning: future tense, sentences over 30 words, "instead of" and "so that" tails in changesets. - suggestion: passive voice. .vale.ini scopes the rules. Docs get every rule. Contributor Markdown and code comments keep dashes and headings as warnings until their roughly 8,100 em dashes are rewritten. Released changesets stay in .changeset/ and are not rewritten, so lint-prose.mjs lints only the changesets added since PROSE_BASE (the PR base in CI). The prose workflow installs a pinned, checksum-verified Vale release and runs `pnpm lint:prose`. The rest of this change rewrites the existing docs, READMEs, contributor Markdown, and code comments to pass the error-level rules. Only prose and comment text changed. Renamed headings keep their anchors. Spelling stays with cspell, which checks identifiers that Vale does not see. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: keep prose lint from flattening meaning --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.6 KiB
Markdown
80 lines
2.6 KiB
Markdown
---
|
|
id: pnpm-cli
|
|
title: pnpm CLI
|
|
---
|
|
|
|
## Short aliases
|
|
|
|
Added in: v11.0.0
|
|
|
|
`pn` is available as a short alias for `pnpm`, and [`pnx`](./cli/pnx.md) as a short alias for `pnpm dlx`. You can use them anywhere you'd use `pnpm` or `pnpx`:
|
|
|
|
```sh
|
|
pn install
|
|
pn add express
|
|
pn build
|
|
pn test
|
|
pnx create-vue my-app
|
|
```
|
|
|
|
## Differences vs npm
|
|
|
|
Unlike npm, pnpm validates all options. For example, `pnpm install --target_arch x64` will
|
|
fail as `--target_arch` is not a valid option for `pnpm install`.
|
|
|
|
However, some dependencies may use the `npm_config_` environment variable, which
|
|
is populated from the CLI options. In this case, you have the following options:
|
|
|
|
1. explicitly set the env variable: `npm_config_target_arch=x64 pnpm install`
|
|
1. force the unknown option with `--config.`: `pnpm install --config.target_arch=x64`
|
|
|
|
## Options
|
|
|
|
### -C <path\>, --dir <path\>
|
|
|
|
Run as if pnpm was started in `<path>` instead of the current working directory.
|
|
|
|
### -w, --workspace-root
|
|
|
|
Run as if pnpm was started in the root of the [workspace](./workspaces.md)
|
|
instead of the current working directory.
|
|
|
|
## Commands
|
|
|
|
For more information, see the documentation for individual CLI commands. Here is
|
|
a list of handy npm equivalents to get you started:
|
|
|
|
| npm command | pnpm equivalent |
|
|
|-----------------|--------------------|
|
|
| `npm install` | [`pnpm install`] |
|
|
| `npm i <pkg>` | [`pnpm add <pkg>`] |
|
|
| `npm run <cmd>` | [`pnpm <cmd>`] |
|
|
| `npx <pkg>` | [`pnx <pkg>`] |
|
|
|
|
When an unknown command is used, pnpm will search for a script with the given name,
|
|
so `pnpm run lint` is the same as `pnpm lint`. If there is no script with the specified name,
|
|
then pnpm will execute the command as a shell script, so you can do things like `pnpm eslint` (see [`pnpm exec`]).
|
|
|
|
Since v11.28.0, this also works with `--filter` and `--recursive`: `pnpm -r eslint` runs the `eslint` script in the selected projects that have one, and when none of them has a script by that name, it runs the `eslint` command installed in their dependencies. `pnpm run` with `--filter` or `-r` still reports the missing script.
|
|
|
|
[`pnpm install`]: ./cli/install.md
|
|
[`pnpm add <pkg>`]: ./cli/add.md
|
|
[`pnpm <cmd>`]: ./cli/run.md
|
|
[`pnpm exec`]: ./cli/exec.md
|
|
[`pnx <pkg>`]: ./cli/pnx.md
|
|
|
|
## Environment variables
|
|
|
|
Some environment variables that are not pnpm related might change the behaviour of pnpm:
|
|
|
|
* [`CI`](./cli/install.md#--frozen-lockfile)
|
|
|
|
These environment variables may influence what directories pnpm will use for storing global information:
|
|
|
|
* `XDG_CACHE_HOME`
|
|
* `XDG_CONFIG_HOME`
|
|
* `XDG_DATA_HOME`
|
|
* `XDG_STATE_HOME`
|
|
|
|
You can search the docs to find the settings that use these environment variables.
|