MCPcopy Create free account
hub / github.com/nodejs/node / list

Method list

deps/npm/lib/commands/version.js:113–134  ·  view source on GitHub ↗
(results = {})

Source from the content-addressed store, hash-verified

111 }
112
113 async list (results = {}) {
114 const pj = resolve(this.npm.prefix, 'package.json')
115
116 const pkg = await readFile(pj, 'utf8')
117 .then(data => JSON.parse(data))
118 .catch(() => ({}))
119
120 if (pkg.name && pkg.version) {
121 results[pkg.name] = pkg.version
122 }
123
124 results.npm = this.npm.version
125 for (const [key, version] of Object.entries(process.versions)) {
126 results[key] = version
127 }
128
129 if (this.npm.config.get('json')) {
130 output.buffer(results)
131 } else {
132 output.standard(results)
133 }
134 }
135
136 async listWorkspaces () {
137 const results = {}

Callers 2

execMethod · 0.95
listWorkspacesMethod · 0.95

Calls 7

parseMethod · 0.65
getMethod · 0.65
resolveFunction · 0.50
readFileFunction · 0.50
thenMethod · 0.45
entriesMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected