(args)
| 98 | } |
| 99 | |
| 100 | async execWorkspaces (args) { |
| 101 | await this.setWorkspaces() |
| 102 | const packageLockOnly = this.npm.config.get('package-lock-only') |
| 103 | const Arborist = require('@npmcli/arborist') |
| 104 | const arb = new Arborist({ |
| 105 | ...this.npm.flatOptions, |
| 106 | path: this.npm.prefix, |
| 107 | forceActual: !packageLockOnly, |
| 108 | }) |
| 109 | let tree |
| 110 | if (packageLockOnly) { |
| 111 | try { |
| 112 | tree = await arb.loadVirtual() |
| 113 | } catch (err) { |
| 114 | log.verbose('loadVirtual', err.stack) |
| 115 | throw this.usageError( |
| 116 | 'A package lock or shrinkwrap file is required in package-lock-only mode' |
| 117 | ) |
| 118 | } |
| 119 | } else { |
| 120 | tree = await arb.loadActual() |
| 121 | } |
| 122 | for (const path of this.workspacePaths) { |
| 123 | const wsTree = path === tree.root.path |
| 124 | ? tree // --includes-workspace-root |
| 125 | : await tree.querySelectorAll(`.workspace:path(${path})`).then(r => r[0]?.target) |
| 126 | if (wsTree) { |
| 127 | await this.#queryTree(wsTree, args[0]) |
| 128 | } |
| 129 | } |
| 130 | this.#output() |
| 131 | } |
| 132 | |
| 133 | #output () { |
| 134 | this.checkExpected(this.#response.length) |
nothing calls this directly
no test coverage detected