(args)
| 51 | } |
| 52 | |
| 53 | async exec (args) { |
| 54 | let { pkg, local, rest } = parseArgs(args) |
| 55 | |
| 56 | if (local) { |
| 57 | if (this.npm.global) { |
| 58 | throw new Error('Cannot use view command in global mode.') |
| 59 | } |
| 60 | const dir = this.npm.prefix |
| 61 | const manifest = await readJson(resolve(dir, 'package.json')) |
| 62 | if (!manifest.name) { |
| 63 | throw new Error('Invalid package.json, no "name" field') |
| 64 | } |
| 65 | // put the version back if it existed |
| 66 | pkg = `${manifest.name}${pkg.slice(1)}` |
| 67 | } |
| 68 | |
| 69 | await this.#viewPackage(pkg, rest) |
| 70 | } |
| 71 | |
| 72 | async execWorkspaces (args) { |
| 73 | const { pkg, local, rest } = parseArgs(args) |
no test coverage detected