Skip to content

Commit

Permalink
feat: allow to start verdaccio with custom node.js version
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Jul 25, 2024
1 parent 937a285 commit 6d34d84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pnpm/registry-mock",
"version": "3.37.0",
"version": "3.38.0",
"description": "Mock the npm registry",
"main": "dist/index.js",
"bin": "dist/bin/pnpm-registry-mock.js",
Expand Down
28 changes: 17 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,24 @@ export default function () {
)
}

export function start (opts: execa.Options) {
export function start (opts: execa.Options & { useNodeVersion?: string }) {
const verdaccioBin = require.resolve('verdaccio/bin/verdaccio')
return execa('node',
[
verdaccioBin,
'--config',
locations.configPath(),
'--listen',
REGISTRY_MOCK_PORT
],
opts
)
const args = [
verdaccioBin,
'--config',
locations.configPath(),
'--listen',
REGISTRY_MOCK_PORT
]
if (opts.useNodeVersion) {
return execa('pnpm', [
`--use-node-version=${opts.useNodeVersion}`,
'exec',
'node',
...args,
], opts)
}
return execa('node', args, opts)
}

export const addDistTag = _addDistTag(REGISTRY_MOCK_PORT)
Expand Down

0 comments on commit 6d34d84

Please sign in to comment.