Skip to content

Commit a299c5b

Browse files
SreyasivsebastiaanspeckManagor
authored
npm-pkg: add page (#19052)
Co-authored-by: Sreyaiv <113996310+Sreyaiv@users.noreply.github.com> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
1 parent 6c09651 commit a299c5b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pages/common/npm-pkg.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# npm pkg
2+
3+
> Show or modify `package.json` properties.
4+
> More information: <https://docs.npmjs.com/cli/npm-pkg>.
5+
6+
- Get the value of a specific property:
7+
8+
`npm pkg get {{name}}`
9+
10+
- Get multiple properties at once:
11+
12+
`npm pkg get {{name version ...}}`
13+
14+
- Get multiple values across all workspaces:
15+
16+
`npm pkg get {{name}} {{version}} {{[--ws|--workspaces]}}`
17+
18+
- Get a nested or array property value:
19+
20+
`npm pkg get {{contributors[0].email}}`
21+
22+
- Set a property to a specific value:
23+
24+
`npm pkg set {{property}}={{value}}`
25+
26+
- Set multiple properties at once:
27+
28+
`npm pkg set {{property1}}={{value1}} {{property2}}={{value2}}`
29+
30+
- Delete a property from `package.json`:
31+
32+
`npm pkg delete {{scripts.build}}`
33+
34+
- Auto-fix common errors in `package.json`:
35+
36+
`npm pkg fix`

0 commit comments

Comments
 (0)