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

Method exec

deps/npm/lib/commands/trust/revoke.js:28–49  ·  view source on GitHub ↗
(positionalArgs, flags)

Source from the content-addressed store, hash-verified

26 ]
27
28 async exec (positionalArgs, flags) {
29 const dryRun = this.config.get('dry-run')
30 const pkgName = positionalArgs[0] || (await this.optionalPkgJson()).name
31 if (!pkgName) {
32 throw new Error('Package name must be specified either as an argument or in the package.json file')
33 }
34 const { id } = flags
35 if (!id) {
36 throw new Error('ID of the trusted relationship to revoke must be specified with the --id option')
37 }
38 this.dialogue`Attempting to revoke trusted configuration for package ${pkgName} with id ${id}`
39 if (dryRun) {
40 return
41 }
42 const spec = npa(pkgName)
43 const uri = `/-/package/${spec.escapedName}/trust/${encodeURIComponent(id)}`
44 await otplease(this.npm, this.npm.flatOptions, opts => npmFetch(uri, {
45 ...opts,
46 method: 'DELETE',
47 }))
48 this.dialogue`Revoked trusted configuration for package ${pkgName} with id ${id}`
49 }
50}
51
52module.exports = TrustRevoke

Callers

nothing calls this directly

Calls 5

otpleaseFunction · 0.85
npmFetchFunction · 0.85
optionalPkgJsonMethod · 0.80
dialogueMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected