2023-06-08 05:24:49 -07:00
|
|
|
const Npm = require('../npm.js')
|
2024-04-30 23:53:22 -07:00
|
|
|
const BaseCommand = require('../base-cmd.js')
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-03-11 17:54:23 -05:00
|
|
|
class Set extends BaseCommand {
|
2021-11-18 20:58:02 +00:00
|
|
|
static description = 'Set a value in the npm configuration'
|
|
|
|
static name = 'set'
|
|
|
|
static usage = ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
|
2023-06-08 05:24:49 -07:00
|
|
|
static params = ['global', 'location']
|
2022-03-03 21:38:08 +00:00
|
|
|
static ignoreImplicitWorkspace = false
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-11-18 20:58:02 +00:00
|
|
|
// TODO
|
|
|
|
/* istanbul ignore next */
|
2023-06-08 05:24:49 -07:00
|
|
|
static async completion (opts) {
|
|
|
|
const Config = Npm.cmd('config')
|
|
|
|
return Config.completion(opts)
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
2021-03-01 11:38:43 -05:00
|
|
|
|
2021-11-04 20:42:47 +00:00
|
|
|
async exec (args) {
|
2021-11-18 20:58:02 +00:00
|
|
|
if (!args.length) {
|
2021-11-04 20:42:47 +00:00
|
|
|
throw this.usageError()
|
2021-11-18 20:58:02 +00:00
|
|
|
}
|
2021-11-04 20:42:47 +00:00
|
|
|
return this.npm.exec('config', ['set'].concat(args))
|
2021-03-04 17:40:28 -05:00
|
|
|
}
|
|
|
|
}
|
2024-04-30 23:53:22 -07:00
|
|
|
|
2021-03-04 17:40:28 -05:00
|
|
|
module.exports = Set
|