libnpmexec 4.0.10 → 4.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -63,6 +63,9 @@ const missingFromTree = async ({ spec, tree, flatOptions }) => {
63
63
  // non-registry spec, or a specific tag. Look up manifest and check
64
64
  // resolved to see if it's in the tree.
65
65
  const manifest = await getManifest(spec, flatOptions)
66
+ if (spec.type === 'directory') {
67
+ return { manifest }
68
+ }
66
69
  const nodesByManifest = tree.inventory.query('packageName', manifest.name)
67
70
  for (const node of nodesByManifest) {
68
71
  if (node.package.resolved === manifest._resolved) {
@@ -89,10 +92,10 @@ const exec = async (opts) => {
89
92
  path = '.',
90
93
  runPath = '.',
91
94
  scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh',
92
- yes = undefined,
93
95
  ...flatOptions
94
96
  } = opts
95
97
 
98
+ let yes = opts.yes
96
99
  const run = () => runScript({
97
100
  args,
98
101
  call,
@@ -129,6 +132,16 @@ const exec = async (opts) => {
129
132
  packages.push(args[0])
130
133
  }
131
134
 
135
+ // Resolve any directory specs so that the npx directory is unique to the
136
+ // resolved directory, not the potentially relative one (i.e. "npx .")
137
+ for (const i in packages) {
138
+ const pkg = packages[i]
139
+ const spec = npa(pkg)
140
+ if (spec.type === 'directory') {
141
+ packages[i] = spec.fetchSpec
142
+ }
143
+ }
144
+
132
145
  const localArb = new Arborist({ ...flatOptions, path })
133
146
  const localTree = await localArb.loadActual()
134
147
 
@@ -153,6 +166,10 @@ const exec = async (opts) => {
153
166
  if (needPackageCommandSwap) {
154
167
  const spec = npa(args[0])
155
168
 
169
+ if (spec.type === 'directory') {
170
+ yes = true
171
+ }
172
+
156
173
  args[0] = getBinFromManifest(commandManifest)
157
174
 
158
175
  if (needInstall.length > 0 && globalPath) {
@@ -176,7 +193,15 @@ const exec = async (opts) => {
176
193
  throw new Error('Must provide a valid npxCache path')
177
194
  }
178
195
  const hash = crypto.createHash('sha512')
179
- .update(packages.sort((a, b) => a.localeCompare(b, 'en')).join('\n'))
196
+ .update(packages.map(p => {
197
+ // Keeps the npx directory unique to the resolved directory, not the
198
+ // potentially relative one (i.e. "npx .")
199
+ const spec = npa(p)
200
+ if (spec.type === 'directory') {
201
+ return spec.fetchSpec
202
+ }
203
+ return p
204
+ }).sort((a, b) => a.localeCompare(b, 'en')).join('\n'))
180
205
  .digest('hex')
181
206
  .slice(0, 16)
182
207
  const installDir = resolve(npxCache, hash)
package/lib/run-script.js CHANGED
@@ -73,6 +73,7 @@ const run = async ({
73
73
  event: 'npx',
74
74
  args,
75
75
  stdio: 'inherit',
76
+ scriptShell,
76
77
  })
77
78
  } finally {
78
79
  npmlog.enableProgress()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libnpmexec",
3
- "version": "4.0.10",
3
+ "version": "4.0.11",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"