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

Method execWorkspaces

deps/npm/lib/commands/owner.js:87–109  ·  view source on GitHub ↗
([action, ...args])

Source from the content-addressed store, hash-verified

85 }
86
87 async execWorkspaces ([action, ...args]) {
88 await this.setWorkspaces()
89 // ls pkg or owner add/rm package
90 if ((action === 'ls' && args.length > 0) || args.length > 1) {
91 const implicitWorkspaces = this.npm.config.get('workspace', 'default')
92 if (implicitWorkspaces.length === 0) {
93 log.warn(`Ignoring specified workspace(s)`)
94 }
95 return this.exec([action, ...args])
96 }
97
98 for (const [name] of this.workspaces) {
99 if (action === 'ls' || action === 'list') {
100 await this.ls(name)
101 } else if (action === 'add') {
102 await this.changeOwners(args[0], name, 'add')
103 } else if (action === 'rm' || action === 'remove') {
104 await this.changeOwners(args[0], name, 'rm')
105 } else {
106 throw this.usageError()
107 }
108 }
109 }
110
111 async ls (pkg) {
112 pkg = await this.getPkg(this.npm.prefix, pkg)

Callers

nothing calls this directly

Calls 7

execMethod · 0.95
lsMethod · 0.95
changeOwnersMethod · 0.95
setWorkspacesMethod · 0.80
warnMethod · 0.80
usageErrorMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected