(args)
| 35 | static ignoreImplicitWorkspace = false |
| 36 | |
| 37 | async exec (args) { |
| 38 | const specs = this.npm.config.get('diff').filter(d => d) |
| 39 | if (specs.length > 2) { |
| 40 | throw this.usageError(`Can't use more than two --diff arguments.`) |
| 41 | } |
| 42 | |
| 43 | // execWorkspaces may have set this already |
| 44 | if (!this.prefix) { |
| 45 | this.prefix = this.npm.prefix |
| 46 | } |
| 47 | |
| 48 | // this is the "top" directory, one up from node_modules in global mode we have to walk one up from globalDir because our node_modules is sometimes under ./lib, and in global mode we're only ever walking through node_modules (because we will have been given a package name already) |
| 49 | if (this.npm.global) { |
| 50 | this.top = resolve(this.npm.globalDir, '..') |
| 51 | } else { |
| 52 | this.top = this.prefix |
| 53 | } |
| 54 | |
| 55 | const [a, b] = await this.retrieveSpecs(specs) |
| 56 | log.info('diff', { src: a, dst: b }) |
| 57 | |
| 58 | const res = await libnpmdiff([a, b], { |
| 59 | ...this.npm.flatOptions, |
| 60 | diffFiles: args, |
| 61 | where: this.top, |
| 62 | }) |
| 63 | return output.standard(res) |
| 64 | } |
| 65 | |
| 66 | async execWorkspaces (args) { |
| 67 | await this.setWorkspaces() |
no test coverage detected