Skip to content

Commit 53a7d8e

Browse files
committed
chore: Verdaccio 5 updates
This is also related to nom 7. Which changes the way `npx` works.
1 parent bc1c5cc commit 53a7d8e

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ package.json.decrypt
3737

3838
# verdaccio
3939
/verdaccio/storage
40+
/storage
4041

4142
# local npx cache
4243
/verdaccio/.npx

util/npx_verdaccio

+10-9
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@
99
// this _can_ be done from bash or shell,
1010
// but now the portability problems loom large.
1111

12-
const { spawn, execSync } = require('child_process')
12+
const { spawn } = require('child_process')
1313
const pipeStdIo = { stdio: [process.stdin, process.stdout, process.stderr] }
1414

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-
2015
// I am assuming that you used `local_verdaccio_publish`
2116
// But either way,
2217
// this is to facilitate running `npx`
@@ -29,13 +24,17 @@ const verdaccio = spawn('npx', ['verdaccio', '-c', 'verdaccio/config.yaml'], pip
2924

3025
const args = [
3126
'--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)
3533
// without this, npx may mask error codes.
3634
// In testing it was possible to have errors in the npx command
3735
// but the spawned process here did not exit with a non-zero exit code.
3836
// See `execCommand` in `libnpx` for specifics
37+
// In npx v7 this option is deprecated
3938
'--always-spawn',
4039
// Yes, this is dangerous.
4140
// But I'm trying to replicate _just running npx_
@@ -44,6 +43,8 @@ const args = [
4443
]
4544

4645
spawn('npx', args, {
46+
// npx v7 will *not* install from any repository if any version exists locally.
47+
cwd: 'verdaccio/integration',
4748
// This instance of npx needs to target the verdaccio server
4849
// so the env var that governs this needs to be updated.
4950
// it is _possible_ for this value to already be set.

verdaccio/config.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,4 @@ middlewares:
8282
enabled: true
8383

8484
# log settings
85-
logs:
86-
- { type: stdout, format: pretty, level: http }
87-
#- {type: file, path: verdaccio.log, level: info}
88-
85+
logs: { type: stdout, format: pretty, level: http }

verdaccio/integration/Readme.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npx v7 will not install a newer version when any version is installed.
2+
This module is a place to run npx on our integration modules.
3+
4+
see `util/npx-verdaccio` for more details

verdaccio/integration/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "integration",
3+
"version": "1.0.0",
4+
"license": "Apache-2.0"
5+
}

0 commit comments

Comments
 (0)