Skip to content

Commit

Permalink
Use nve
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 13, 2019
1 parent 08496ab commit 1f25658
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 8 deletions.
83 changes: 83 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"figures": "^3.0.0",
"filter-obj": "^2.0.1",
"find-up": "^4.1.0",
"get-node": "^5.0.0",
"get-stream": "^5.1.0",
"got": "^10.0.0-alpha.1",
"indent-string": "^4.0.0",
Expand All @@ -54,6 +53,7 @@
"js-yaml": "^3.13.1",
"make-dir": "^3.0.0",
"moize": "^5.4.4",
"nve": "^3.1.1",
"omit.js": "^1.0.2",
"os-name": "^3.1.0",
"p-finally": "^2.0.1",
Expand Down
10 changes: 8 additions & 2 deletions src/run/runners/node/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ export const commands = async function(runOpts) {
return versions.map(getNodeCommand)
}

const getNodeCommand = function({ nodePath, version, fullVersion }) {
const getNodeCommand = function({
command,
spawnOptions,
version,
fullVersion,
}) {
const versions = version === fullVersion ? [] : [{ value: fullVersion }]
return {
id: version,
title: version,
spawn: [nodePath, START_PATH],
spawn: [command, START_PATH],
spawnOptions,
versions,
}
}
12 changes: 7 additions & 5 deletions src/run/runners/node/versions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getNode from 'get-node'
import { runVersion } from 'nve'
import { satisfies } from 'semver'
import readPkgUp from 'read-pkg-up'

Expand Down Expand Up @@ -31,10 +31,12 @@ const getFullVersions = function(versions) {
// This both downloads Node.js binary and normalize its `version`
const getFullVersion = async function(version) {
try {
const { path: nodePath, version: fullVersion } = await getNode(version, {
progress: false,
})
return { nodePath, version, fullVersion }
const { version: fullVersion, command, spawnOptions } = await runVersion(
version,
'node',
['--version'],
)
return { version, fullVersion, command, spawnOptions }
} catch (error) {
// eslint-disable-next-line fp/no-mutation
error.message = `In option 'run.node.versions': ${error.message}`
Expand Down

0 comments on commit 1f25658

Please sign in to comment.