Skip to content

Commit

Permalink
Use get-node instead of nve
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 25, 2019
1 parent c68d4fd commit 77c3441
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
19 changes: 5 additions & 14 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"fast-glob": "^3.0.4",
"figures": "^3.0.0",
"find-up": "^4.1.0",
"get-node": "^3.0.0",
"get-stream": "^5.1.0",
"got": "^9.6.0",
"indent-string": "^4.0.0",
Expand All @@ -51,8 +52,6 @@
"js-yaml": "^3.13.1",
"make-dir": "^3.0.0",
"moize": "^5.4.4",
"normalize-node-version": "^2.0.0",
"nve": "^1.3.0",
"os-name": "^3.1.0",
"p-event": "^4.1.0",
"p-finally": "^2.0.1",
Expand Down
7 changes: 2 additions & 5 deletions src/run/runners/node/commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { getPath } from 'nve'

import { getOpts } from './options.js'
import { getNodeVersions } from './versions.js'

Expand All @@ -21,11 +19,10 @@ export const commands = async function(runOpts) {
]
}

return Promise.all(versions.map(getNodeCommand))
return versions.map(getNodeCommand)
}

const getNodeCommand = async function({ version, fullVersion }) {
const nodePath = await getPath(fullVersion, false)
const getNodeCommand = function({ nodePath, version, fullVersion }) {
const versions = version === fullVersion ? [] : [{ value: fullVersion }]
return {
id: version,
Expand Down
9 changes: 6 additions & 3 deletions src/run/runners/node/versions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import normalizeNodeVersion from 'normalize-node-version'
import getNode from 'get-node'
import { satisfies } from 'semver'
import readPkgUp from 'read-pkg-up'

Expand Down Expand Up @@ -28,10 +28,13 @@ const getFullVersions = function(versions) {
return Promise.all(versions.map(getFullVersion))
}

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

0 comments on commit 77c3441

Please sign in to comment.