Merge pull request #99 from aminya/esm

This commit is contained in:
Amin Yahyaabadi 2023-04-23 01:13:15 -07:00 committed by GitHub
commit 8c72d55c11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 555 additions and 241 deletions

View File

@ -75,6 +75,7 @@ words:
- tsbuildinfo - tsbuildinfo
- ucrt - ucrt
- untildify - untildify
- upleveled
- vbatts - vbatts
- vcpkg - vcpkg
- vcvarsall - vcvarsall

@ -1 +1 @@
Subproject commit 467e5baf5e5caff2a6462581f7c2b0ca62d9af8c Subproject commit c30589196b2c59a3055dfc7c24244b4a1f48b081

View File

@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable import/no-extraneous-dependencies */
import { node } from "execa" import { execaNode } from "execa"
function getPlatformName() { function getPlatformName() {
switch (process.platform) { switch (process.platform) {
@ -27,7 +27,7 @@ function main() {
return Promise.all( return Promise.all(
exes.map((exe) => exes.map((exe) =>
node("./node_modules/caxa/build/index.mjs", [ execaNode("./node_modules/caxa/build/index.mjs", [
"--input", "--input",
"./dist/node16", "./dist/node16",
"--output", "--output",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -31,8 +31,8 @@
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .", "build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .", "build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .", "build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
"build.parcel": "cross-env NODE_ENV=production parcel build", "build.parcel": "cross-env NODE_ENV=production parcel build && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true",
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update", "bump": "ncu -u -x numerous && pnpm update",
"clean": "shx rm -rf .parcel-cache dist exe", "clean": "shx rm -rf .parcel-cache dist exe",
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/", "copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/",
"dev": "cross-env NODE_ENV=development parcel watch", "dev": "cross-env NODE_ENV=development parcel watch",
@ -64,15 +64,17 @@
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3", "@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"@babel/cli": "^7.21.0",
"@types/cross-spawn": "^6.0.2", "@types/cross-spawn": "^6.0.2",
"@types/eslint": "^8.37.0", "@types/eslint": "^8.37.0",
"@types/jest": "^29.5.1", "@types/jest": "^29.5.1",
"@types/mri": "^1.1.1", "@types/mri": "^1.1.1",
"@types/node": "^18.15.13", "@types/node": "^18.16.0",
"@types/npmcli__ci-detect": "^2.0.0", "@types/npmcli__ci-detect": "^2.0.0",
"@types/prettier": "2.7.2", "@types/prettier": "2.7.2",
"@types/semver": "^7.3.13", "@types/semver": "^7.3.13",
"@types/which": "^3.0.0", "@types/which": "^3.0.0",
"@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix#95fcbd92405b99a6eece48c493548996f12e6519",
"admina": "^0.1.3", "admina": "^0.1.3",
"caxa": "^3.0.1", "caxa": "^3.0.1",
"ci-info": "^3.8.0", "ci-info": "^3.8.0",
@ -86,7 +88,8 @@
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-config-atomic": "^1.18.3", "eslint-config-atomic": "^1.18.3",
"exec-powershell": "workspace:*", "exec-powershell": "workspace:*",
"execa": "^5.1.1", "execa": "^7.1.1",
"fast-glob": "^3.2.12",
"gen-readme": "^1.6.0", "gen-readme": "^1.6.0",
"is-url-online": "^1.5.0", "is-url-online": "^1.5.0",
"jest": "^29.5.0", "jest": "^29.5.0",
@ -96,14 +99,14 @@
"npm-run-all2": "^6.0.5", "npm-run-all2": "^6.0.5",
"numerous": "1.0.3", "numerous": "1.0.3",
"parcel": "2.8.3", "parcel": "2.8.3",
"path-exists": "^4.0.0", "path-exists": "^5.0.0",
"patha": "^0.4.1", "patha": "^0.4.1",
"prettier": "2.7.1", "prettier": "2.8.8",
"prettier-config-atomic": "^3.1.0", "prettier-config-atomic": "^3.1.0",
"quote-unquote": "^1.0.0", "quote-unquote": "^1.0.0",
"readme-md-generator": "^1.0.0", "readme-md-generator": "^1.0.0",
"retry-as-promised": "^7.0.4", "retry-as-promised": "^7.0.4",
"semver": "7.3.8", "semver": "7.5.0",
"setup-python": "github:actions/setup-python#v4.6.0", "setup-python": "github:actions/setup-python#v4.6.0",
"shx": "0.3.4", "shx": "0.3.4",
"terser-config-atomic": "^0.1.1", "terser-config-atomic": "^0.1.1",
@ -144,20 +147,6 @@
"patha": "patha/dist/index.node.mjs" "patha": "patha/dist/index.node.mjs"
}, },
"main.actions": "./dist/node16/setup-cpp.js", "main.actions": "./dist/node16/setup-cpp.js",
"pnpm": {
"overrides": {
"semver": "7.3.8",
"eslint": "^8.28.0",
"prettier": "2.7.1",
"core-js": "*",
"babel-eslint": "npm:@babel/eslint-parser"
},
"peerDependencyRules": {
"allowedVersions": {
"eslint": "*"
}
}
},
"targets": { "targets": {
"main": { "main": {
"context": "node", "context": "node",

View File

@ -38,7 +38,7 @@ Execute a powershell command.
- command (`string`) - The powershell command to execute - command (`string`) - The powershell command to execute
- startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first. - startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first.
- execOptions (`execa.SyncOptions`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }` - execOptions (`execaSyncOptions`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }`
**returns:** execa.ExecaSyncReturnValue<string> **returns:** execa.ExecaSyncReturnValue<string>

View File

@ -11,7 +11,7 @@
"build": "tsc" "build": "tsc"
}, },
"dependencies": { "dependencies": {
"execa": "^5.1.1", "execa": "^7.1.1",
"which": "^2.0.2" "which": "^2.0.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,4 +1,4 @@
import execa from "execa" import * as execa from "execa"
import which from "which" import which from "which"
/** The cached powershell path */ /** The cached powershell path */
@ -19,7 +19,7 @@ export function execPowershell(
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"], startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
execOptions: execa.Options = { stdio: "inherit" } execOptions: execa.Options = { stdio: "inherit" }
): execa.ExecaChildProcess<string> { ): execa.ExecaChildProcess<string> {
return execa(getPowerShell(), [...startupFlags, "-c", command], execOptions) return execa.execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
} }
/** /**
@ -37,7 +37,7 @@ export function execPowershellSync(
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"], startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
execOptions: execa.SyncOptions = { stdio: "inherit" } execOptions: execa.SyncOptions = { stdio: "inherit" }
): execa.ExecaSyncReturnValue<string> { ): execa.ExecaSyncReturnValue<string> {
return execa.sync(getPowerShell(), [...startupFlags, "-c", command], execOptions) return execa.execaSync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
} }
/** /**

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import execa from "execa" import { execaSync } from "execa"
import { dirname } from "patha" import { dirname } from "patha"
import which from "which" import which from "which"
import { tmpdir } from "os" import { tmpdir } from "os"
@ -28,7 +28,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
const brewTempDirectory = path.join(tmpdir(), "setup-cpp", "brew") const brewTempDirectory = path.join(tmpdir(), "setup-cpp", "brew")
await mkdirP(brewTempDirectory) await mkdirP(brewTempDirectory)
execa.sync("curl", ["-LJO", "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"], { execaSync("curl", ["-LJO", "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"], {
cwd: brewTempDirectory, cwd: brewTempDirectory,
}) })
const installSh = join(brewTempDirectory, "install.sh") const installSh = join(brewTempDirectory, "install.sh")
@ -39,7 +39,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
installShContent.replace("#!/bin/bash", "") installShContent.replace("#!/bin/bash", "")
} }
execa.sync("/bin/bash", [installSh], { execaSync("/bin/bash", [installSh], {
stdio: "inherit", stdio: "inherit",
env: { env: {
NONINTERACTIVE: "1", NONINTERACTIVE: "1",

View File

@ -1,7 +1,6 @@
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
import execa from "execa" import { execaSync } from "execa"
import { pathExists } from "path-exists"
import pathExists from "path-exists"
import { dirname } from "patha" import { dirname } from "patha"
import which from "which" import which from "which"
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
@ -40,7 +39,7 @@ export async function setupChocolatey(
} }
// https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe // https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe
execa.sync( execaSync(
powershell, powershell,
[ [
"-NoProfile", "-NoProfile",

View File

@ -14,7 +14,7 @@ import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import pathExists from "path-exists" import { pathExists } from "path-exists"
import retry from "retry-as-promised" import retry from "retry-as-promised"
/** Get the platform data for cmake */ /** Get the platform data for cmake */

View File

@ -2,7 +2,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
import { setupGcc } from "../gcc" import { setupGcc } from "../gcc"
import { getVersion } from "../../versions/versions" import { getVersion } from "../../versions/versions"
import { join, addExeExt } from "patha" import { join, addExeExt } from "patha"
import execa from "execa" import { execaSync } from "execa"
import { chmodSync } from "fs" import { chmodSync } from "fs"
import { ubuntuVersion } from "../../utils/env/ubuntu_version" import { ubuntuVersion } from "../../utils/env/ubuntu_version"
@ -29,11 +29,11 @@ describe("setup-gcc", () => {
// test compilation // test compilation
const file = join(__dirname, "main.cpp") const file = join(__dirname, "main.cpp")
const main_exe = join(__dirname, addExeExt("main")) const main_exe = join(__dirname, addExeExt("main"))
execa.sync("g++", [file, "-o", main_exe], { cwd: __dirname }) execaSync("g++", [file, "-o", main_exe], { cwd: __dirname })
if (process.platform !== "win32") { if (process.platform !== "win32") {
chmodSync(main_exe, "755") chmodSync(main_exe, "755")
} }
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" }) execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
}) })
afterAll(async () => { afterAll(async () => {

View File

@ -16,7 +16,7 @@ import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import pathExists from "path-exists" import { pathExists } from "path-exists"
interface MingwInfo { interface MingwInfo {
releaseName: string releaseName: string

View File

@ -1,4 +1,4 @@
import execa from "execa" import { execa } from "execa"
import { join, addExeExt } from "patha" import { join, addExeExt } from "patha"
import which from "which" import which from "which"
import { setupCmake } from "../cmake/cmake" import { setupCmake } from "../cmake/cmake"

View File

@ -3,7 +3,7 @@ import { getSpecificVersionAndUrl } from "../../utils/setup/version"
import { isUrlOnline } from "is-url-online" import { isUrlOnline } from "is-url-online"
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers" import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import execa from "execa" import { execaSync } from "execa"
import path, { addExeExt } from "patha" import path, { addExeExt } from "patha"
import { chmodSync } from "fs" import { chmodSync } from "fs"
import { getVersion } from "../../versions/versions" import { getVersion } from "../../versions/versions"
@ -92,11 +92,11 @@ describe("setup-llvm", () => {
// test compilation // test compilation
const file = path.join(__dirname, "main.cpp") const file = path.join(__dirname, "main.cpp")
const main_exe = path.join(__dirname, addExeExt("main")) const main_exe = path.join(__dirname, addExeExt("main"))
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname }) execaSync("clang++", [file, "-o", main_exe], { cwd: __dirname })
if (process.platform !== "win32") { if (process.platform !== "win32") {
chmodSync(main_exe, "755") chmodSync(main_exe, "755")
} }
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" }) execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
}) })
it("should find llvm in the cache", async () => { it("should find llvm in the cache", async () => {

View File

@ -14,7 +14,7 @@ import { getVersion } from "../versions/versions"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import { getLLVMPackageInfo } from "./llvm_url" import { getLLVMPackageInfo } from "./llvm_url"
import { ubuntuVersion } from "../utils/env/ubuntu_version" import { ubuntuVersion } from "../utils/env/ubuntu_version"
import pathExists from "path-exists" import { pathExists } from "path-exists"
import { ExecaReturnValue } from "execa" import { ExecaReturnValue } from "execa"
export async function setupLLVM(version: string, setupDir: string, arch: string): Promise<InstallationInfo> { export async function setupLLVM(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {

View File

@ -7,7 +7,7 @@ import { GITHUB_ACTIONS } from "ci-info"
import { join } from "patha" import { join } from "patha"
import { error, info, warning } from "ci-log" import { error, info, warning } from "ci-log"
import pathExists from "path-exists" import { pathExists } from "path-exists"
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string

View File

@ -7,7 +7,7 @@ import { join } from "patha"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils" import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils"
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory" import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
import pathExists from "path-exists" import { pathExists } from "path-exists"
function isPyPyVersion(versionSpec: string) { function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith("pypy") return versionSpec.startsWith("pypy")

View File

@ -16,7 +16,7 @@ import { getExecOutput } from "@actions/exec"
import { isBinUptoDate } from "../utils/setup/version" import { isBinUptoDate } from "../utils/setup/version"
import { getVersion } from "../versions/versions" import { getVersion } from "../versions/versions"
import assert from "assert" import assert from "assert"
import execa from "execa" import { execaSync } from "execa"
import { unique } from "../utils/std" import { unique } from "../utils/std"
export async function setupPython(version: string, setupDir: string, arch: string) { export async function setupPython(version: string, setupDir: string, arch: string) {
@ -71,12 +71,12 @@ export async function setupPythonViaSystem(
} else if (isUbuntu()) { } else if (isUbuntu()) {
installInfo = await setupAptPack([{ name: "python3", version }, { name: "python3-pip" }]) installInfo = await setupAptPack([{ name: "python3", version }, { name: "python3-pip" }])
} else { } else {
throw new Error(`Unsupported linux distributions`) throw new Error("Unsupported linux distributions")
} }
return installInfo return installInfo
} }
default: { default: {
throw new Error(`Unsupported platform`) throw new Error("Unsupported platform")
} }
} }
} }
@ -109,7 +109,7 @@ export async function setupPythonAndPip(): Promise<string> {
if (process.platform === "win32") { if (process.platform === "win32") {
// downgrade pip on Windows // downgrade pip on Windows
// https://github.com/pypa/pip/issues/10875#issuecomment-1030293005 // https://github.com/pypa/pip/issues/10875#issuecomment-1030293005
execa.sync(foundPython, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" }) execaSync(foundPython, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" })
} else if (process.platform === "linux") { } else if (process.platform === "linux") {
// ensure that pip is installed on Linux (happens when python is found but pip not installed) // ensure that pip is installed on Linux (happens when python is found but pip not installed)
if (isArch()) { if (isArch()) {
@ -122,7 +122,7 @@ export async function setupPythonAndPip(): Promise<string> {
} }
// install wheel (required for Conan, Meson, etc.) // install wheel (required for Conan, Meson, etc.)
execa.sync(foundPython, ["-m", "pip", "install", "-U", "wheel"], { stdio: "inherit" }) execaSync(foundPython, ["-m", "pip", "install", "-U", "wheel"], { stdio: "inherit" })
return foundPython return foundPython
} }

View File

@ -8,7 +8,7 @@ import { delimiter } from "path"
import escapeSpace from "escape-path-with-spaces" import escapeSpace from "escape-path-with-spaces"
import { giveUserAccess } from "user-access" import { giveUserAccess } from "user-access"
import escapeQuote from "escape-quotes" import escapeQuote from "escape-quotes"
import pathExists from "path-exists" import { pathExists } from "path-exists"
/** /**
* Add an environment variable. * Add an environment variable.
@ -69,7 +69,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
const val = valGiven ?? "" const val = valGiven ?? ""
switch (process.platform) { switch (process.platform) {
case "win32": { case "win32": {
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit // We do not use `execaSync(`setx PATH "${path};%PATH%"`)` because of its character limit
await execPowershell(`[Environment]::SetEnvironmentVariable('${name}', '${val}', "User")`) await execPowershell(`[Environment]::SetEnvironmentVariable('${name}', '${val}', "User")`)
info(`${name}='${val}' was set in the environment.`) info(`${name}='${val}' was set in the environment.`)
return return
@ -91,7 +91,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
async function addPathSystem(path: string) { async function addPathSystem(path: string) {
switch (process.platform) { switch (process.platform) {
case "win32": { case "win32": {
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system // We do not use `execaSync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
await execPowershell( await execPowershell(
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")` `$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
) )

View File

@ -1,4 +1,4 @@
import execa from "execa" import { execa } from "execa"
import { mkdirP } from "@actions/io" import { mkdirP } from "@actions/io"
import which from "which" import which from "which"
import { setupSevenZip } from "../../sevenzip/sevenzip" import { setupSevenZip } from "../../sevenzip/sevenzip"

View File

@ -5,10 +5,10 @@ import { info } from "@actions/core"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv" import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
import which from "which" import which from "which"
import pathExists from "path-exists" import { pathExists } from "path-exists"
import { promises as fsPromises } from "fs" import { promises as fsPromises } from "fs"
const { appendFile } = fsPromises const { appendFile } = fsPromises
import execa from "execa" import { execa } from "execa"
import escapeRegex from "escape-string-regexp" import escapeRegex from "escape-string-regexp"
let didUpdate: boolean = false let didUpdate: boolean = false

View File

@ -11,7 +11,7 @@ import { isArch } from "../env/isArch"
import { hasDnf } from "../env/hasDnf" import { hasDnf } from "../env/hasDnf"
import { setupDnfPack } from "./setupDnfPack" import { setupDnfPack } from "./setupDnfPack"
import { isUbuntu } from "../env/isUbuntu" import { isUbuntu } from "../env/isUbuntu"
import pathExists from "path-exists" import { pathExists } from "path-exists"
import retry from "retry-as-promised" import retry from "retry-as-promised"
/** A type that describes a package */ /** A type that describes a package */

View File

@ -1,6 +1,6 @@
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
import { info } from "@actions/core" import { info } from "@actions/core"
import execa from "execa" import { execaSync } from "execa"
import { join } from "patha" import { join } from "patha"
import which from "which" import which from "which"
import { getBrewPath, setupBrew } from "../../brew/brew" import { getBrewPath, setupBrew } from "../../brew/brew"
@ -24,7 +24,7 @@ export async function setupBrewPack(
const binDir = getBrewPath() const binDir = getBrewPath()
// brew is not thread-safe // brew is not thread-safe
execa.sync( execaSync(
join(binDir, "brew"), join(binDir, "brew"),
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs], ["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
{ {

View File

@ -3,7 +3,7 @@ import { addPath } from "../env/addEnv"
import which from "which" import which from "which"
import { setupChocolatey } from "../../chocolatey/chocolatey" import { setupChocolatey } from "../../chocolatey/chocolatey"
import { InstallationInfo } from "./setupBin" import { InstallationInfo } from "./setupBin"
import execa from "execa" import { execaSync } from "execa"
import { info } from "@actions/core" import { info } from "@actions/core"
import { notice } from "ci-log" import { notice } from "ci-log"
@ -27,14 +27,14 @@ export async function setupChocoPack(name: string, version?: string, args: strin
env.PATH = PATH env.PATH = PATH
if (version !== undefined && version !== "") { if (version !== undefined && version !== "") {
execa.sync("choco", ["install", "-y", name, `--version=${version}`, ...args], { execaSync("choco", ["install", "-y", name, `--version=${version}`, ...args], {
env, env,
extendEnv: false, extendEnv: false,
stdio: "inherit", stdio: "inherit",
}) })
} else { } else {
try { try {
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" }) execaSync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
} catch (err) { } catch (err) {
// if the package requires a reboot, downgrade the error to a notice // if the package requires a reboot, downgrade the error to a notice
if ((err as Error).message.includes("exit code 3010")) { if ((err as Error).message.includes("exit code 3010")) {

View File

@ -1,13 +1,12 @@
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
import execa from "execa"
import { info } from "@actions/core" import { info } from "@actions/core"
import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python" import { execaSync } from "execa"
import { InstallationInfo } from "./setupBin" import { pathExists } from "path-exists"
import { addExeExt, dirname, join } from "patha" import { addExeExt, dirname, join } from "patha"
import { addPath } from "../env/addEnv"
import which from "which" import which from "which"
import pathExists from "path-exists" import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
import { addPath } from "../env/addEnv"
import { InstallationInfo } from "./setupBin"
let python: string | undefined let python: string | undefined
let binDirs: string[] | undefined let binDirs: string[] | undefined
@ -20,7 +19,7 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
python = await setupPythonAndPip() python = await setupPythonAndPip()
} }
execa.sync(python, ["-m", "pip", "install", version !== undefined && version !== "" ? `${name}==${version}` : name], { execaSync(python, ["-m", "pip", "install", version !== undefined && version !== "" ? `${name}==${version}` : name], {
stdio: "inherit", stdio: "inherit",
}) })

View File

@ -4,7 +4,7 @@ import * as path from "patha"
import { addExeExt, join } from "patha" import { addExeExt, join } from "patha"
import spawn from "cross-spawn" import spawn from "cross-spawn"
import pathExists from "path-exists" import { pathExists } from "path-exists"
export async function setupTmpDir(testName: string) { export async function setupTmpDir(testName: string) {
const tempDirectory = path.join(tmpdir(), "setup cpp temp", testName) const tempDirectory = path.join(tmpdir(), "setup cpp temp", testName)

View File

@ -1,18 +1,17 @@
import execa from "execa" import { execaSync } from "execa"
import { notice } from "ci-log"
import { dirname, join, addShExt, addShRelativePrefix } from "patha" import { pathExists } from "path-exists"
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
import { giveUserAccess } from "user-access"
import which from "which" import which from "which"
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { notice } from "ci-log"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import { giveUserAccess } from "user-access" import { setupAptPack } from "../utils/setup/setupAptPack"
import pathExists from "path-exists" import { InstallationInfo } from "../utils/setup/setupBin"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
let hasVCPKG = false let hasVCPKG = false
@ -48,12 +47,12 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
} }
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) { if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" }) execaSync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
} else { } else {
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`) notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
} }
execa.sync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), { execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
cwd: setupDir, cwd: setupDir,
shell: true, shell: true,
stdio: "inherit", stdio: "inherit",

View File

@ -3,7 +3,7 @@
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js" import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
import { addEnv } from "../utils/env/addEnv" import { addEnv } from "../utils/env/addEnv"
import { info } from "ci-log" import { info } from "ci-log"
import pathExists from "path-exists" import { pathExists } from "path-exists"
function getArch(arch: string): string { function getArch(arch: string): string {
switch (arch) { switch (arch) {