mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-18 05:00:58 +00:00
Update cheatsheets
This commit is contained in:
41
tldr/npm-pkg
Normal file
41
tldr/npm-pkg
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# npm pkg
|
||||
|
||||
> Show or modify `package.json` properties.
|
||||
> More information: <https://docs.npmjs.com/cli/npm-pkg>.
|
||||
|
||||
- Get the value of a specific property:
|
||||
|
||||
`npm pkg get {{name}}`
|
||||
|
||||
- Get multiple properties at once:
|
||||
|
||||
`npm pkg get {{name version ...}}`
|
||||
|
||||
- Get multiple values across all workspaces:
|
||||
|
||||
`npm pkg get {{name}} {{version}} {{[--ws|--workspaces]}}`
|
||||
|
||||
- Get a nested or array property value:
|
||||
|
||||
`npm pkg get {{contributors[0].email}}`
|
||||
|
||||
- Set a property to a specific value:
|
||||
|
||||
`npm pkg set {{property}}={{value}}`
|
||||
|
||||
- Set multiple properties at once:
|
||||
|
||||
`npm pkg set {{property1}}={{value1}} {{property2}}={{value2}}`
|
||||
|
||||
- Delete a property from `package.json`:
|
||||
|
||||
`npm pkg delete {{scripts.build}}`
|
||||
|
||||
- Auto-fix common errors in `package.json`:
|
||||
|
||||
`npm pkg fix`
|
||||
Reference in New Issue
Block a user