npm-pkg

manipulates package

TLDR

Get package.json field
$ npm pkg get [name]
Set package.json field
$ npm pkg set [name]="[value]"
Delete field
$ npm pkg delete [field]
Get multiple fields
$ npm pkg get [name] [version]
Set nested field
$ npm pkg set [scripts.test]="[jest]"

SYNOPSIS

npm pkg [command] [options]

DESCRIPTION

npm pkg manipulates package.json fields. Read and write properties programmatically.The command modifies package.json. Useful for scripts and automation.

PARAMETERS

COMMAND

Pkg subcommand.
get FIELD
Read field value.
set FIELD=VALUE
Write field value.
delete FIELD
Remove field.
--help
Display help information.

INSTALL

sudo pacman -S npm
sudo apk add npm
brew install npm

CAVEATS

Modifies package.json. Supports JSON paths. Use quotes for values.

HISTORY

npm pkg provides package.json manipulation from the command line.

SEE ALSO

npm(1), npm-init(1), npm-version(1)