Difference between npm configuration commands

168 Views Asked by At

Are

npm config set <key> <value>

and

npm set <key> <value>

synonymous?

Configuration of npm init with both of this commands, add init configuration to /home/.npmrc

npm config set init.author.name 'Some One'
npm set init.author.email '[email protected]
1

There are 1 best solutions below

0
On BEST ANSWER

They are synonymous.

Check NPM's source code on GitHub: The code of the set command is short and calls config's set.

https://github.com/npm/npm/blob/master/lib/set.js

module.exports = set

set.usage = 'npm set <key> <value> (See `npm config`)'

var npm = require('./npm.js')

set.completion = npm.commands.config.completion

function set (args, cb) {
  if (!args.length) return cb(set.usage)
  npm.commands.config(['set'].concat(args), cb)
}

config command: https://github.com/npm/npm/blob/master/lib/config.js