Sync deps and engines with npm (#2770)

* feat!: update `engines.node` to `^14.17.0 || ^16.13.0 || >=18.0.0`

* deps: nopt@^7.0.0

* feat: replace npmlog with proc-log

* deps: standard@17.0.0 and fix linting errors

* deps: which@3.0.0
- this also promiisifies the build command

* deps: glob@8.0.3

* feat: drop rimraf dependency

* fix: use fs/promises in favor of fs.promises
This commit is contained in:
Luke Karrys 2023-06-20 06:44:18 -07:00 committed by GitHub
parent 33391db3a0
commit 192eec2aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 536 additions and 418 deletions

View file

@ -1,10 +1,9 @@
'use strict'
const log = require('npmlog')
const log = require('./log')
const execFile = require('child_process').execFile
const fs = require('fs')
const path = require('path').win32
const logWithPrefix = require('./util').logWithPrefix
const regSearchKeys = require('./util').regSearchKeys
function findVisualStudio (nodeSemver, configMsvsVersion, callback) {
@ -22,9 +21,9 @@ function VisualStudioFinder (nodeSemver, configMsvsVersion, callback) {
}
VisualStudioFinder.prototype = {
log: logWithPrefix(log, 'find VS'),
log: log.withPrefix('find VS'),
regSearchKeys: regSearchKeys,
regSearchKeys,
// Logs a message at verbose level, but also saves it to be displayed later
// at error level if an error occurs. This should help diagnose the problem.
@ -126,10 +125,10 @@ VisualStudioFinder.prototype = {
// Invoke the PowerShell script to get information about Visual Studio 2017
// or newer installations
findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) {
var ps = path.join(process.env.SystemRoot, 'System32',
const ps = path.join(process.env.SystemRoot, 'System32',
'WindowsPowerShell', 'v1.0', 'powershell.exe')
var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
var psArgs = [
const csFile = path.join(__dirname, 'Find-VisualStudio.cs')
const psArgs = [
'-ExecutionPolicy',
'Unrestricted',
'-NoProfile',
@ -138,7 +137,7 @@ VisualStudioFinder.prototype = {
]
this.log.silly('Running', ps, psArgs)
var child = execFile(ps, psArgs, { encoding: 'utf8' },
const child = execFile(ps, psArgs, { encoding: 'utf8' },
(err, stdout, stderr) => {
this.parseData(err, stdout, stderr, cb)
})
@ -161,7 +160,7 @@ VisualStudioFinder.prototype = {
return failPowershell()
}
var vsInfo
let vsInfo
try {
vsInfo = JSON.parse(stdout)
} catch (e) {
@ -178,7 +177,7 @@ VisualStudioFinder.prototype = {
vsInfo = vsInfo.map((info) => {
this.log.silly(`processing installation: "${info.path}"`)
info.path = path.resolve(info.path)
var ret = this.getVersionInfo(info)
const ret = this.getVersionInfo(info)
ret.path = info.path
ret.msBuild = this.getMSBuild(info, ret.versionYear)
ret.toolset = this.getToolset(info, ret.versionYear)
@ -199,7 +198,7 @@ VisualStudioFinder.prototype = {
// Sort to place newer versions first
vsInfo.sort((a, b) => b.versionYear - a.versionYear)
for (var i = 0; i < vsInfo.length; ++i) {
for (let i = 0; i < vsInfo.length; ++i) {
const info = vsInfo[i]
this.addLog(`checking VS${info.versionYear} (${info.version}) found ` +
`at:\n"${info.path}"`)
@ -245,7 +244,7 @@ VisualStudioFinder.prototype = {
return {}
}
this.log.silly('- version match = %j', match)
var ret = {
const ret = {
version: info.version,
versionMajor: parseInt(match[1], 10),
versionMinor: parseInt(match[2], 10)
@ -327,7 +326,7 @@ VisualStudioFinder.prototype = {
const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.'
const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.'
var Win10or11SDKVer = 0
let Win10or11SDKVer = 0
info.packages.forEach((pkg) => {
if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) {
return
@ -458,6 +457,6 @@ VisualStudioFinder.prototype = {
module.exports = findVisualStudio
module.exports.test = {
VisualStudioFinder: VisualStudioFinder,
findVisualStudio: findVisualStudio
VisualStudioFinder,
findVisualStudio
}