MCPcopy Index your code
hub / github.com/nodejs/node / setWorkspaces

Method setWorkspaces

deps/npm/lib/base-cmd.js:258–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256 }
257
258 async setWorkspaces () {
259 const { relative } = require('node:path')
260
261 const includeWorkspaceRoot = this.isArboristCmd
262 ? false
263 : this.npm.config.get('include-workspace-root')
264
265 const prefixInsideCwd = relative(this.npm.localPrefix, process.cwd()).startsWith('..')
266 const relativeFrom = prefixInsideCwd ? this.npm.localPrefix : process.cwd()
267
268 const filters = this.npm.config.get('workspace')
269 const getWorkspaces = require('./utils/get-workspaces.js')
270 const ws = await getWorkspaces(filters, {
271 path: this.npm.localPrefix,
272 includeWorkspaceRoot,
273 relativeFrom,
274 })
275
276 this.workspaces = ws
277 this.workspaceNames = [...ws.keys()]
278 this.workspacePaths = [...ws.values()]
279 }
280
281 flags (depth = 1) {
282 const commandDefinitions = this.constructor.definitions || []

Callers 15

execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
changeWorkspacesMethod · 0.80
listWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80
execWorkspacesMethod · 0.80

Calls 6

relativeFunction · 0.85
getWorkspacesFunction · 0.85
getMethod · 0.65
keysMethod · 0.65
requireFunction · 0.50
valuesMethod · 0.45

Tested by

no test coverage detected