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

Method exec

deps/npm/lib/commands/view.js:53–70  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

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)

Callers 1

execWorkspacesMethod · 0.95

Calls 5

#viewPackageMethod · 0.95
parseArgsFunction · 0.70
readJsonFunction · 0.70
sliceMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected