9
9
// this _can_ be done from bash or shell,
10
10
// but now the portability problems loom large.
11
11
12
- const { spawn, execSync } = require ( 'child_process' )
12
+ const { spawn } = require ( 'child_process' )
13
13
const pipeStdIo = { stdio : [ process . stdin , process . stdout , process . stderr ] }
14
14
15
- // Always clear storage so the latest versions are published
16
- // I am not worried about _what_ version number is published
17
- // Only that it is the latest code
18
- execSync ( 'rm -rf verdaccio/.npx' )
19
-
20
15
// I am assuming that you used `local_verdaccio_publish`
21
16
// But either way,
22
17
// this is to facilitate running `npx`
@@ -29,13 +24,17 @@ const verdaccio = spawn('npx', ['verdaccio', '-c', 'verdaccio/config.yaml'], pip
29
24
30
25
const args = [
31
26
'--userconfig' , 'verdaccio/npmrc' ,
32
- '--ignore-existing' ,
33
- '--cache' , 'verdaccio/.npx' ,
34
- // This is **very** important,
27
+ // In npx v6 ignore-existing let you install the latest version
28
+ // regardless of what was installed locally.
29
+ // In npx v7 this is disable and if you need to install anything
30
+ // then --yes is *required*
31
+ '--ignore-existing' , '--yes' ,
32
+ // This is **very** important, (npx ~v6)
35
33
// without this, npx may mask error codes.
36
34
// In testing it was possible to have errors in the npx command
37
35
// but the spawned process here did not exit with a non-zero exit code.
38
36
// See `execCommand` in `libnpx` for specifics
37
+ // In npx v7 this option is deprecated
39
38
'--always-spawn' ,
40
39
// Yes, this is dangerous.
41
40
// But I'm trying to replicate _just running npx_
@@ -44,6 +43,8 @@ const args = [
44
43
]
45
44
46
45
spawn ( 'npx' , args , {
46
+ // npx v7 will *not* install from any repository if any version exists locally.
47
+ cwd : 'verdaccio/integration' ,
47
48
// This instance of npx needs to target the verdaccio server
48
49
// so the env var that governs this needs to be updated.
49
50
// it is _possible_ for this value to already be set.
0 commit comments