From 63b402f62421c8d1fd2ef710622cec4a90af494d Mon Sep 17 00:00:00 2001 From: Kevin He Date: Mon, 15 Apr 2024 16:15:48 -0700 Subject: [PATCH] use npm on both win and mac platforms --- scripts/check-version.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/scripts/check-version.js b/scripts/check-version.js index 5b2e15f2f2..533a70a13f 100755 --- a/scripts/check-version.js +++ b/scripts/check-version.js @@ -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', @@ -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 = []