Skip to content

Commit

Permalink
use npm on both win and mac platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinxh committed Apr 15, 2024
1 parent 7076478 commit 63b402f
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions scripts/check-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,8 @@ const childProc = require('child_process')
const fs = require('fs')
const pkg = require('../package.json')

const isWin = process.platform === 'win32'
const extension = isWin ? '.cmd' : ''

const npm = `npm${extension}`

const spawnSync = (...args) => {
const proc = childProc.spawnSync(...args)
if (proc.status !== 0) {
throw proc.stderr.toString()
}
return proc
}

if (!fs.existsSync(path.join('node_modules', 'semver'))) {
spawnSync(npm, [
childProc.spawnSync('npm', [
'install',
`semver@${pkg.devDependencies['semver']}`,
'--loglevel=silent',
Expand All @@ -41,7 +28,7 @@ const semver = require('semver')
const requiredNode = pkg.engines.node
const foundNode = process.version
const requiredNpm = pkg.engines.npm
const foundNpm = spawnSync(npm, ['-v']).stdout.toString().trim()
const foundNpm = childProc.spawnSync('npm', ['-v']).stdout.toString().trim()

const warnings = []

Expand Down

0 comments on commit 63b402f

Please sign in to comment.