(args, { path = this.npm.localPrefix, workspace } = {})
| 26 | static ignoreImplicitWorkspace = false |
| 27 | |
| 28 | async exec (args, { path = this.npm.localPrefix, workspace } = {}) { |
| 29 | if (this.npm.global) { |
| 30 | throw Object.assign( |
| 31 | new Error(`There's no package.json file to manage on global mode`), |
| 32 | { code: 'EPKGGLOBAL' } |
| 33 | ) |
| 34 | } |
| 35 | |
| 36 | const [cmd, ..._args] = args |
| 37 | switch (cmd) { |
| 38 | case 'get': |
| 39 | return this.get(_args, { path, workspace }) |
| 40 | case 'set': |
| 41 | return this.set(_args, { path, workspace }).then(p => p.save()) |
| 42 | case 'delete': |
| 43 | return this.delete(_args, { path, workspace }).then(p => p.save()) |
| 44 | case 'fix': |
| 45 | return PackageJson.fix(path).then(p => p.save()) |
| 46 | default: |
| 47 | throw this.usageError() |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | async execWorkspaces (args) { |
| 52 | await this.setWorkspaces() |
no test coverage detected