From e92d4b94a192ee1b26c7a16987de3f2ed3e62b92 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 22 Jun 2022 03:12:36 -0700 Subject: [PATCH 1/2] fix: support visual studio 2022 --- src/apm.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apm.ts b/src/apm.ts index e6c2e52..ecc1ab4 100644 --- a/src/apm.ts +++ b/src/apm.ts @@ -139,7 +139,7 @@ export function x86ProgramFilesDirectory() { return process.env["ProgramFiles(x86)"] || process.env.ProgramFiles } -export function getInstalledVisualStudioFlag() { +export function getInstalledVisualStudioFlag(): string { if (!isWin32()) { return null } @@ -149,18 +149,18 @@ export function getInstalledVisualStudioFlag() { return process.env.GYP_MSVS_VERSION } - if (visualStudioIsInstalled("2019")) { - return "2019" - } - if (visualStudioIsInstalled("2017")) { - return "2017" + for (const vsVersion of [2022, 2019, 2017]) { + if (visualStudioIsInstalled(vsVersion)) { + return String(vsVersion) + } } - if (visualStudioIsInstalled("14.0")) { + + if (visualStudioIsInstalled(14.0)) { return "2015" } } -export function visualStudioIsInstalled(version) { +export function visualStudioIsInstalled(version: number): boolean { if (version < 2017) { return fs.existsSync(path.join(x86ProgramFilesDirectory(), `Microsoft Visual Studio ${version}`, "Common7", "IDE")) } else { From dd207881374613bfc9d0bec9f83e8414d3d374ad Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 22 Jun 2022 03:14:09 -0700 Subject: [PATCH 2/2] ci: test on windows 2022 --- .github/workflows/CI.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 23f06ac..0ef19fe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,6 +24,10 @@ jobs: pnpm: - 6 include: + - os: windows-2022 + node_version: 12.18.3 + arch: x64 + pnpm: 6 - os: windows-2019 node_version: 12.18.3 arch: x86