I know I can do:
npm config set init.author.email me@mycompany.com
npm config set init.license UNLICENSED
To set the defaults used to create a new package.json
with npm init
. But how can I set the default value for the test command
? I've tried
npm config set init.scripts.test "mocha"
But it doesn't work. The npm docs don't seem to help.
Is there a list of all the init defaults?
There is a list of all config defaults npm config list -l
.
As you can see there isn't anything like init.scripts. But there is another way to do it. If you first npm install mocha
and then npm init
you will get a package.json like:
{
"name": "asd",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"mocha": "^2.4.5"
},
"scripts": {
"test": "mocha"
},
"author": "",
"license": "UNLICENSED"
}