tldr/pages/common/pnpm.md

38 lines
888 B
Markdown
Raw Normal View History

2021-05-03 16:56:31 +01:00
# pnpm
> Fast, disk space efficient package manager for Node.js.
> Manage Node.js projects and their module dependencies.
> More information: <https://pnpm.io>.
2022-08-20 13:33:47 +01:00
- Create a `package.json` file:
2021-05-03 16:56:31 +01:00
`pnpm init`
- Download all the packages listed as dependencies in `package.json`:
`pnpm install`
- Download a specific version of a package and add it to the list of dependencies in `package.json`:
2022-08-20 13:33:47 +01:00
`pnpm add {{module_name}}@{{version}}`
2021-05-03 16:56:31 +01:00
2022-08-20 13:33:47 +01:00
- Download a package and add it to the list of [D]ev dependencies in `package.json`:
2021-05-03 16:56:31 +01:00
2022-08-20 13:33:47 +01:00
`pnpm add -D {{module_name}}`
2021-05-03 16:56:31 +01:00
2022-08-20 13:33:47 +01:00
- Download a package and install it [g]lobally:
2021-05-03 16:56:31 +01:00
2022-08-20 13:33:47 +01:00
`pnpm add -g {{module_name}}`
2021-05-03 16:56:31 +01:00
- Uninstall a package and remove it from the list of dependencies in `package.json`:
2022-08-20 13:33:47 +01:00
`pnpm remove {{module_name}}`
2021-05-03 16:56:31 +01:00
- Print a tree of locally installed modules:
`pnpm list`
- List top-level [g]lobally installed modules:
`pnpm list -g --depth={{0}}`