fix: update execa

This commit is contained in:
Amin Yahyaabadi 2023-04-22 02:19:33 -07:00
parent 6a6a1ba062
commit d713a6703d
28 changed files with 86 additions and 77 deletions

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

View File

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

View File

@ -86,7 +86,7 @@
"eslint": "^8.38.0",
"eslint-config-atomic": "^1.18.3",
"exec-powershell": "workspace:*",
"execa": "^5.1.1",
"execa": "^7.1.1",
"gen-readme": "^1.6.0",
"is-url-online": "^1.5.0",
"jest": "^29.5.0",

View File

@ -38,7 +38,7 @@ Execute a powershell command.
- 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.
- 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>

View File

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

View File

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

View File

@ -91,8 +91,8 @@ importers:
specifier: workspace:*
version: link:packages/exec-powershell
execa:
specifier: ^5.1.1
version: 5.1.1
specifier: ^7.1.1
version: 7.1.1
gen-readme:
specifier: ^1.6.0
version: 1.6.0
@ -193,8 +193,8 @@ importers:
packages/exec-powershell:
dependencies:
execa:
specifier: ^5.1.1
version: 5.1.1
specifier: ^7.1.1
version: 7.1.1
which:
specifier: ^2.0.2
version: 2.0.2
@ -5028,6 +5028,20 @@ packages:
strip-final-newline: 3.0.0
dev: true
/execa@7.1.1:
resolution: {integrity: sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==}
engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0}
dependencies:
cross-spawn: 7.0.3
get-stream: 6.0.1
human-signals: 4.3.1
is-stream: 3.0.0
merge-stream: 2.0.0
npm-run-path: 5.1.0
onetime: 6.0.0
signal-exit: 3.0.7
strip-final-newline: 3.0.0
/exit@0.1.2:
resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==}
engines: {node: '>= 0.8.0'}
@ -5797,6 +5811,10 @@ packages:
engines: {node: '>=12.20.0'}
dev: true
/human-signals@4.3.1:
resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==}
engines: {node: '>=14.18.0'}
/humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
dependencies:
@ -6183,7 +6201,6 @@ packages:
/is-stream@3.0.0:
resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dev: true
/is-string@1.0.7:
resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==}
@ -7491,7 +7508,6 @@ packages:
/mimic-fn@4.0.0:
resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==}
engines: {node: '>=12'}
dev: true
/mimic-response@1.0.1:
resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==}
@ -7940,7 +7956,6 @@ packages:
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dependencies:
path-key: 4.0.0
dev: true
/npmlog@6.0.2:
resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==}
@ -8050,7 +8065,6 @@ packages:
engines: {node: '>=12'}
dependencies:
mimic-fn: 4.0.0
dev: true
/open@8.4.2:
resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==}
@ -8297,7 +8311,6 @@ packages:
/path-key@4.0.0:
resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==}
engines: {node: '>=12'}
dev: true
/path-parse@1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
@ -9336,7 +9349,6 @@ packages:
/strip-final-newline@3.0.0:
resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==}
engines: {node: '>=12'}
dev: true
/strip-indent@3.0.0:
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}

View File

@ -1,4 +1,4 @@
import execa from "execa"
import { execaSync } from "execa"
import { dirname } from "patha"
import which from "which"
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")
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,
})
const installSh = join(brewTempDirectory, "install.sh")
@ -39,7 +39,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
installShContent.replace("#!/bin/bash", "")
}
execa.sync("/bin/bash", [installSh], {
execaSync("/bin/bash", [installSh], {
stdio: "inherit",
env: {
NONINTERACTIVE: "1",

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ import { getSpecificVersionAndUrl } from "../../utils/setup/version"
import { isUrlOnline } from "is-url-online"
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import ciDetect from "@npmcli/ci-detect"
import execa from "execa"
import { execaSync } from "execa"
import path, { addExeExt } from "patha"
import { chmodSync } from "fs"
import { getVersion } from "../../versions/versions"
@ -92,11 +92,11 @@ describe("setup-llvm", () => {
// test compilation
const file = path.join(__dirname, "main.cpp")
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") {
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 () => {

View File

@ -16,7 +16,7 @@ import { getExecOutput } from "@actions/exec"
import { isBinUptoDate } from "../utils/setup/version"
import { getVersion } from "../versions/versions"
import assert from "assert"
import execa from "execa"
import { execaSync } from "execa"
import { unique } from "../utils/std"
export async function setupPython(version: string, setupDir: string, arch: string) {
@ -71,12 +71,12 @@ export async function setupPythonViaSystem(
} else if (isUbuntu()) {
installInfo = await setupAptPack([{ name: "python3", version }, { name: "python3-pip" }])
} else {
throw new Error(`Unsupported linux distributions`)
throw new Error("Unsupported linux distributions")
}
return installInfo
}
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") {
// downgrade pip on Windows
// 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") {
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
if (isArch()) {
@ -122,7 +122,7 @@ export async function setupPythonAndPip(): Promise<string> {
}
// 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
}

View File

@ -69,7 +69,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
const val = valGiven ?? ""
switch (process.platform) {
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")`)
info(`${name}='${val}' was set in the environment.`)
return
@ -91,7 +91,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
async function addPathSystem(path: string) {
switch (process.platform) {
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(
`$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 which from "which"
import { setupSevenZip } from "../../sevenzip/sevenzip"

View File

@ -8,7 +8,7 @@ import which from "which"
import pathExists from "path-exists"
import { promises as fsPromises } from "fs"
const { appendFile } = fsPromises
import execa from "execa"
import { execa } from "execa"
import escapeRegex from "escape-string-regexp"
let didUpdate: boolean = false

View File

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

View File

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

View File

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

View File

@ -1,18 +1,17 @@
import execa from "execa"
import { dirname, join, addShExt, addShRelativePrefix } from "patha"
import { execaSync } from "execa"
import { notice } from "ci-log"
import pathExists from "path-exists"
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
import { giveUserAccess } from "user-access"
import which from "which"
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 { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
import { giveUserAccess } from "user-access"
import pathExists from "path-exists"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { InstallationInfo } from "../utils/setup/setupBin"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
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"))))) {
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 {
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,
shell: true,
stdio: "inherit",