MCPcopy Create free account
hub / github.com/npm/cli / exec

Method exec

lib/commands/link.js:47–66  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

45 }
46
47 async exec (args) {
48 if (this.npm.global) {
49 throw Object.assign(
50 new Error(
51 'link should never be --global.\n' +
52 'Please re-run this command with --local'
53 ),
54 { code: 'ELINKGLOBAL' }
55 )
56 }
57 // install-links is implicitly false when running `npm link`
58 this.npm.config.set('install-links', false)
59
60 // link with no args: symlink the folder to the global location
61 // link with package arg: symlink the global to the local
62 args = args.filter(a => resolve(a) !== this.npm.prefix)
63 return args.length
64 ? this.linkInstall(args)
65 : this.linkPkg()
66 }
67
68 async linkInstall (args) {
69 // load current packages from the global space, and then add symlinks installs locally

Callers

nothing calls this directly

Calls 5

linkInstallMethod · 0.95
linkPkgMethod · 0.95
resolveFunction · 0.85
filterMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected