(args)
| 48 | } |
| 49 | |
| 50 | async execWorkspaces (args) { |
| 51 | await this.setWorkspaces() |
| 52 | |
| 53 | const ws = [...this.workspaces.entries()] |
| 54 | for (const [workspace, path] of ws) { |
| 55 | const last = path === ws.at(-1)[1] |
| 56 | |
| 57 | if (!args.length) { |
| 58 | const newline = await this.#list(path, { workspace }) |
| 59 | if (newline && !last) { |
| 60 | output.standard() |
| 61 | } |
| 62 | continue |
| 63 | } |
| 64 | |
| 65 | const pkg = await pkgJson.normalize(path).then(p => p.content) |
| 66 | try { |
| 67 | await this.#run(args, { path, pkg, workspace }) |
| 68 | } catch (e) { |
| 69 | const err = getError(e, { npm: this.npm, command: null }) |
| 70 | outputError({ |
| 71 | ...err, |
| 72 | error: [ |
| 73 | ['', `Lifecycle script \`${args[0]}\` failed with error:`], |
| 74 | ...err.error, |
| 75 | ['workspace', pkg._id || pkg.name], |
| 76 | ['location', path], |
| 77 | ], |
| 78 | }) |
| 79 | process.exitCode = err.exitCode |
| 80 | if (!last) { |
| 81 | output.error('') |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | async #run ([event, ...args], { path, pkg, workspace }) { |
| 88 | const runScript = require('@npmcli/run-script') |
nothing calls this directly
no test coverage detected