Motivation ("The Why")
Some users prefer managing their package.json using npm cli comands rather than manually editing a JSON file.
As of today, some of the npm cli commands already handle the automated management of the package.json file, such as npm install adding / updating dependency declarations, npm version bumping the version value, or in the case of npm set-script a top-level command that serves specifically the purpose of managing "scripts" data in the package.json file.
Example
$ cat package.json
{
"name": "a",
"version": "1.0.0"
}
$ npm install abbrev
added 1 package, and audited 2 packages in 493ms
found 0 vulnerabilities
$ cat package.json
{
"name": "a",
"version": "1.0.0",
"dependencies": {
"abbrev": "^1.1.1"
}
}
$ npm set-script test echo
{
"name": "a",
"version": "1.0.0",
"dependencies": {
"abbrev": "^1.1.1"
},
"scripts": {
"test": "echo"
}
}
How
Introduce a new top-level command npm pkg that would help managing the remaining package.json fields and centralize this management under a single command.
Current Behaviour
Taking the current npm set-script type of behavior:
$ npm set-script lint eslint
Desired Behaviour
Migrate set-script under a single pkg top-level command and expand it to make it possible to manage the reminder of package.json fields.
$ npm pkg set script --key=lint --value=eslint
References
Motivation ("The Why")
Some users prefer managing their
package.jsonusing npm cli comands rather than manually editing a JSON file.As of today, some of the npm cli commands already handle the automated management of the
package.jsonfile, such asnpm installadding / updating dependency declarations,npm versionbumping the version value, or in the case ofnpm set-scripta top-level command that serves specifically the purpose of managing"scripts"data in thepackage.jsonfile.Example
How
Introduce a new top-level command
npm pkgthat would help managing the remainingpackage.jsonfields and centralize this management under a single command.Current Behaviour
Taking the current
npm set-scripttype of behavior:$ npm set-script lint eslintDesired Behaviour
Migrate set-script under a single pkg top-level command and expand it to make it possible to manage the reminder of
package.jsonfields.$ npm pkg set script --key=lint --value=eslintReferences