feat: add os-env package for managing path, env, rc files

This commit is contained in:
Amin Yahyaabadi 2024-08-14 18:22:33 -07:00
parent 5962369655
commit 77e643057d
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
42 changed files with 622 additions and 510 deletions

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

@ -74,6 +74,7 @@
"admina": "^1.0.1",
"caxa": "^3.0.1",
"ci-info": "^4.0.0",
"os-env": "workspace:*",
"ci-log": "workspace:*",
"cross-env": "7.0.3",
"cross-spawn": "^7.0.3",
@ -128,6 +129,7 @@
"admina",
"ci-info",
"ci-log",
"os-env",
"escape-path-with-spaces",
"escape-quotes",
"escape-string-regexp",

View File

@ -0,0 +1,42 @@
{
"name": "os-env",
"version": "1.0.0",
"description": "Manage environment variables, PATH, and rc files",
"homepage": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"main": "./dist/index.js",
"source": "./src/index.ts",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@actions/core": "^1.10.1",
"@types/node": "^12",
"admina": "^1.0.1",
"ci-info": "^4.0.0",
"escape-path-with-spaces": "^1.0.2",
"escape-quotes": "^1.0.2",
"micro-memoize": "^4.1.2",
"path-exists": "^5.0.0",
"ci-log": "workspace:*",
"exec-powershell": "workspace:*",
"untildify-user": "workspace:*"
},
"engines": {
"node": ">=12"
},
"keywords": [
"env",
"path",
"dotenv",
"rc",
"addEnv",
"addPath",
"setEnv",
"linux",
"windows",
"unix",
"macos"
]
}

View File

@ -0,0 +1,94 @@
import { promises } from "fs"
import { exportVariable as ghExportVariable } from "@actions/core"
import { GITHUB_ACTIONS } from "ci-info"
import { error, info } from "ci-log"
import { execPowershell } from "exec-powershell"
import { untildifyUser } from "untildify-user"
import { sourceRC } from "./rc-file.js"
import { escapeString } from "./utils.js"
const { appendFile } = promises
export type AddEnvOptions = {
/** If true, the value will be escaped with quotes and spaces will be escaped with backslash */
shouldEscapeSpace: boolean
/** If true, the variable will be only added if it is not defined */
shouldAddOnlyIfNotDefined: boolean
/**
* The path to the RC file that the env variables should be added to.
*/
rcPath: string
}
/**
* Add an environment variable.
*
* This function is cross-platforms and works in all the local or CI systems.
*/
export async function addEnv(
name: string,
valGiven: string | undefined,
givenOptions: Partial<AddEnvOptions> = {},
) {
const options = {
shouldEscapeSpace: false,
shouldAddOnlyIfNotDefined: false,
rcPath: untildifyUser(".bashrc"),
...givenOptions,
}
const val = escapeString(valGiven ?? "", options.shouldEscapeSpace)
try {
if (GITHUB_ACTIONS) {
try {
if (options.shouldAddOnlyIfNotDefined) {
if (process.env[name] !== undefined) {
info(`Environment variable ${name} is already defined. Skipping.`)
return
}
}
ghExportVariable(name, val)
} catch (err) {
error(err as Error)
await addEnvSystem(name, val, options)
}
} else {
await addEnvSystem(name, val, options)
}
} catch (err) {
error(`${err}\nFailed to export environment variable ${name}=${val}. You should add it manually.`)
}
}
async function addEnvSystem(name: string, valGiven: string | undefined, options: AddEnvOptions) {
const val = valGiven ?? ""
switch (process.platform) {
case "win32": {
if (options.shouldAddOnlyIfNotDefined) {
if (process.env[name] !== undefined) {
info(`Environment variable ${name} is already defined. Skipping.`)
return
}
}
// 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
}
case "linux":
case "darwin": {
await sourceRC(options.rcPath)
if (options.shouldAddOnlyIfNotDefined) {
await appendFile(options.rcPath, `\nif [ -z "\${${name}}" ]; then export ${name}="${val}"; fi\n`)
info(`if not defined ${name} then ${name}="${val}" was added to "${options.rcPath}`)
} else {
await appendFile(options.rcPath, `\nexport ${name}="${val}"\n`)
info(`${name}="${val}" was added to "${options.rcPath}`)
}
return
}
default: {
// fall through shell path modification
}
}
process.env[name] = val
}

View File

@ -0,0 +1,79 @@
import { promises } from "fs"
import { delimiter } from "path"
import { addPath as ghAddPath } from "@actions/core"
import { GITHUB_ACTIONS } from "ci-info"
import { error, info } from "ci-log"
import { execPowershell } from "exec-powershell"
import { untildifyUser } from "untildify-user"
import { sourceRC } from "./rc-file.js"
const { appendFile } = promises
type AddPathOptions = {
/**
* The path to the RC file that the PATH variables should be added to.
*/
rcPath: string
}
/**
* Add a path to the PATH environment variable.
*
* This function is cross-platforms and works in all the local or CI systems.
*/
export async function addPath(path: string, givenOptions: Partial<AddPathOptions> = {}) {
const options = { rcPath: untildifyUser(".bashrc"), ...givenOptions }
if (isIgnoredPath(path)) {
return
}
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
try {
if (GITHUB_ACTIONS) {
try {
ghAddPath(path)
} catch (err) {
error(err as Error)
await addPathSystem(path, options.rcPath)
}
} else {
await addPathSystem(path, options.rcPath)
}
} catch (err) {
error(`${err}\nFailed to add ${path} to the percistent PATH. You should add it manually.`)
}
}
async function addPathSystem(path: string, rcPath: string) {
switch (process.platform) {
case "win32": {
// 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")`,
)
info(`"${path}" was added to the PATH.`)
return
}
case "linux":
case "darwin": {
await sourceRC(rcPath)
await appendFile(rcPath, `\nexport PATH="${path}:$PATH"\n`)
info(`"${path}" was added to "${rcPath}"`)
return
}
default: {
return
}
}
}
const ignoredPaths = [/\/usr\/bin\/?/, /\/usr\/local\/bin\/?/]
/** Skip adding /usr/bin to PATH if it is already there */
function isIgnoredPath(path: string) {
if (ignoredPaths.some((checkedPath) => checkedPath.test(path))) {
const paths = process.env.PATH?.split(delimiter) ?? []
return paths.includes(path)
}
return false
}

17
packages/os-env/src/escape-quotes.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
declare module "escape-quotes" {
/**
* Escape `'` with `\\`
* @param input the input string
*/
declare function escapeQuote(input: string): string
/**
* Escape the given character with the given escape character
* @param input the input string
* @param character the character to escape (e.g. `'`)
* @param escape_character the character to escape with (e.g. `\\`)
*/
declare function escapeQuote(input: string, character: string, escape_character: string): string
export = escapeQuote
}

View File

@ -0,0 +1,3 @@
export { addEnv } from "./add-env.js"
export { addPath } from "./add-path.js"
export { finalizeRC, sourceRC } from "./rc-file.js"

View File

@ -0,0 +1,75 @@
import { promises } from "fs"
import { grantUserWriteAccess } from "admina"
import { info, warning } from "ci-log"
import memoize from "micro-memoize"
import { pathExists } from "path-exists"
import { untildifyUser } from "untildify-user"
const { appendFile, readFile, writeFile } = promises
async function sourceRC_raw(rcPath: string) {
const sourceRcString =
`\n# source .cpprc if SOURCE_CPPRC is not set to 0\nif [[ "$SOURCE_CPPRC" != 0 && -f "${rcPath}" ]]; then source "${rcPath}"; fi\n`
try {
await Promise.all([
addRCHeader(rcPath),
sourceRcInProfile(sourceRcString),
sourceRCInBashrc(sourceRcString),
])
} catch (err) {
warning(`Failed to add ${sourceRcString} to .profile or .bashrc. You should add it manually: ${err}`)
}
}
/**
* handles adding conditions to source rc file from .bashrc and .profile
*/
export const sourceRC = memoize(sourceRC_raw, { isPromise: true })
async function addRCHeader(rcPath: string) {
// a variable that prevents source_cpprc from being called from .bashrc and .profile
const rcHeader = "# Automatically Generated by os-env\nexport SOURCE_CPPRC=0"
if (await pathExists(rcPath)) {
const rcContent = await readFile(rcPath, "utf8")
if (!rcContent.includes(rcHeader)) {
// already executed setupCppInProfile
await appendFile(rcPath, `\n${rcHeader}\n`)
info(`Added ${rcHeader} to ${rcPath}`)
}
}
}
async function sourceRCInBashrc(sourceRcString: string) {
const bashrcPath = untildifyUser("~/.bashrc")
if (await pathExists(bashrcPath)) {
const bashrcContent = await readFile(bashrcPath, "utf-8")
if (!bashrcContent.includes(sourceRcString)) {
await appendFile(bashrcPath, sourceRcString)
info(`${sourceRcString} was added to ${bashrcPath}`)
}
}
}
async function sourceRcInProfile(sourceRcString: string) {
const profilePath = untildifyUser("~/.profile")
if (await pathExists(profilePath)) {
const profileContent = await readFile(profilePath, "utf-8")
if (!profileContent.includes(sourceRcString)) {
await appendFile(profilePath, sourceRcString)
info(`${sourceRcString} was added to ${profilePath}`)
}
}
}
export async function finalizeRC(rcPath: string) {
if (await pathExists(rcPath)) {
const entries = (await readFile(rcPath, "utf-8")).split("\n")
const uniqueEntries = [...new Set(entries.reverse())].reverse() // remove duplicates, keeping the latest entry
await writeFile(rcPath, uniqueEntries.join("\n"))
await grantUserWriteAccess(rcPath)
}
}

View File

@ -0,0 +1,7 @@
import escapeSpace from "escape-path-with-spaces"
import escapeQuote from "escape-quotes"
export function escapeString(valGiven: string, shouldEscapeSpace: boolean = false) {
const spaceEscaped = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
return escapeQuote(spaceEscaped, "\"", "\\")
}

View File

@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./src"]
}

View File

@ -134,6 +134,9 @@ importers:
numerous:
specifier: 1.0.3
version: 1.0.3
os-env:
specifier: workspace:*
version: link:packages/os-env
p-timeout:
specifier: ^6.1.2
version: 6.1.2
@ -223,6 +226,42 @@ importers:
specifier: ^3.0.0
version: 3.0.3
packages/os-env:
dependencies:
'@actions/core':
specifier: ^1.10.1
version: 1.10.1
'@types/node':
specifier: ^12
version: 12.20.55
admina:
specifier: ^1.0.1
version: 1.0.1
ci-info:
specifier: ^4.0.0
version: 4.0.0
ci-log:
specifier: workspace:*
version: link:../ci-log
escape-path-with-spaces:
specifier: ^1.0.2
version: 1.0.2
escape-quotes:
specifier: ^1.0.2
version: 1.0.2
exec-powershell:
specifier: workspace:*
version: link:../exec-powershell
micro-memoize:
specifier: ^4.1.2
version: 4.1.2
path-exists:
specifier: ^5.0.0
version: 5.0.0
untildify-user:
specifier: workspace:*
version: link:../untildify-user
packages/untildify-user:
dependencies:
admina:
@ -6179,73 +6218,69 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.1
'@parcel/bundler-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/bundler-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/graph': 3.2.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
'@parcel/utils': 2.12.0
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/cache@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/cache@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/core': 2.12.0(@swc/helpers@0.5.12)
'@parcel/fs': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/logger': 2.12.0
'@parcel/utils': 2.12.0
lmdb: 2.8.5
transitivePeerDependencies:
- '@swc/helpers'
'@parcel/codeframe@2.12.0':
dependencies:
chalk: 4.1.2
'@parcel/compressor-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/compressor-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/config-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)(postcss@8.4.41)(typescript@5.5.4)':
dependencies:
'@parcel/bundler-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/compressor-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/bundler-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/compressor-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/core': 2.12.0(@swc/helpers@0.5.12)
'@parcel/namer-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/optimizer-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/optimizer-htmlnano': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)(postcss@8.4.41)(typescript@5.5.4)
'@parcel/optimizer-image': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/optimizer-svgo': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/namer-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/optimizer-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/optimizer-htmlnano': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(postcss@8.4.41)(typescript@5.5.4)
'@parcel/optimizer-image': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/optimizer-svgo': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/optimizer-swc': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-html': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-js': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-svg': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-wasm': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/reporter-dev-server': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/resolver-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/runtime-browser-hmr': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/runtime-js': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/runtime-react-refresh': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/runtime-service-worker': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-babel': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-html': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-image': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/packager-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/packager-html': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/packager-js': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/packager-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/packager-svg': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/packager-wasm': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/reporter-dev-server': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/resolver-default': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/runtime-browser-hmr': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/runtime-js': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/runtime-react-refresh': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/runtime-service-worker': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-babel': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-css': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-html': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-image': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-js': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-json': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-postcss': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-posthtml': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-react-refresh-wrap': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-svg': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/transformer-json': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-postcss': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-posthtml': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-raw': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-react-refresh-wrap': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/transformer-svg': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@swc/helpers'
- cssnano
@ -6260,14 +6295,14 @@ snapshots:
'@parcel/core@2.12.0(@swc/helpers@0.5.12)':
dependencies:
'@mischnic/json-sourcemap': 0.1.1
'@parcel/cache': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/cache': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/diagnostic': 2.12.0
'@parcel/events': 2.12.0
'@parcel/fs': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/graph': 3.2.0
'@parcel/logger': 2.12.0
'@parcel/package-manager': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/profiler': 2.12.0
'@parcel/rust': 2.12.0
'@parcel/source-map': 2.1.1
@ -6318,14 +6353,13 @@ snapshots:
dependencies:
chalk: 4.1.2
'@parcel/namer-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/namer-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/node-resolver-core@3.3.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
@ -6339,10 +6373,10 @@ snapshots:
transitivePeerDependencies:
- '@parcel/core'
'@parcel/optimizer-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/optimizer-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
browserslist: 4.23.3
@ -6350,18 +6384,16 @@ snapshots:
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/optimizer-htmlnano@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)(postcss@8.4.41)(typescript@5.5.4)':
'@parcel/optimizer-htmlnano@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(postcss@8.4.41)(typescript@5.5.4)':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
htmlnano: 2.1.1(postcss@8.4.41)(svgo@2.8.0)(typescript@5.5.4)
nullthrows: 1.1.1
posthtml: 0.16.6
svgo: 2.8.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
- cssnano
- postcss
- purgecss
@ -6371,31 +6403,28 @@ snapshots:
- typescript
- uncss
'@parcel/optimizer-image@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/optimizer-image@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/core': 2.12.0(@swc/helpers@0.5.12)
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
'@parcel/utils': 2.12.0
'@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
transitivePeerDependencies:
- '@swc/helpers'
'@parcel/optimizer-svgo@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/optimizer-svgo@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
svgo: 2.8.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/optimizer-swc@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
'@swc/core': 1.7.6(@swc/helpers@0.5.12)
@ -6419,33 +6448,31 @@ snapshots:
transitivePeerDependencies:
- '@swc/helpers'
'@parcel/packager-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
lightningcss: 1.26.0
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/packager-html@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-html@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/utils': 2.12.0
nullthrows: 1.1.1
posthtml: 0.16.6
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/packager-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
'@parcel/source-map': 2.1.1
'@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
@ -6454,38 +6481,33 @@ snapshots:
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/packager-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/packager-svg@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-svg@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/utils': 2.12.0
posthtml: 0.16.6
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/packager-wasm@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/packager-wasm@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/plugin@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/plugin@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/profiler@2.12.0':
dependencies:
@ -6493,79 +6515,71 @@ snapshots:
'@parcel/events': 2.12.0
chrome-trace-event: 1.0.4
'@parcel/reporter-cli@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/reporter-cli@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/utils': 2.12.0
chalk: 4.1.2
term-size: 2.2.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/reporter-dev-server@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/reporter-dev-server@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/reporter-tracer@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/reporter-tracer@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
chrome-trace-event: 1.0.4
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/resolver-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/resolver-default@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/node-resolver-core': 3.3.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/runtime-browser-hmr@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/runtime-browser-hmr@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/runtime-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/runtime-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/runtime-react-refresh@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/runtime-react-refresh@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
react-error-overlay: 6.0.9
react-refresh: 0.9.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/runtime-service-worker@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/runtime-service-worker@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/rust@2.12.0': {}
@ -6573,10 +6587,10 @@ snapshots:
dependencies:
detect-libc: 1.0.3
'@parcel/transformer-babel@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-babel@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
browserslist: 4.23.3
@ -6585,12 +6599,11 @@ snapshots:
semver: 7.6.3
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-css@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
browserslist: 4.23.3
@ -6598,12 +6611,11 @@ snapshots:
nullthrows: 1.1.1
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-html@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-html@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
nullthrows: 1.1.1
posthtml: 0.16.6
@ -6613,23 +6625,20 @@ snapshots:
srcset: 4.0.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-image@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-image@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/core': 2.12.0(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
'@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
nullthrows: 1.1.1
transitivePeerDependencies:
- '@swc/helpers'
'@parcel/transformer-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/core': 2.12.0(@swc/helpers@0.5.12)
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
'@parcel/source-map': 2.1.1
'@parcel/utils': 2.12.0
@ -6640,18 +6649,17 @@ snapshots:
regenerator-runtime: 0.13.11
semver: 7.6.3
'@parcel/transformer-json@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-json@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
json5: 2.2.3
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-postcss@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-postcss@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
'@parcel/utils': 2.12.0
clone: 2.1.2
@ -6660,11 +6668,10 @@ snapshots:
semver: 7.6.3
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-posthtml@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-posthtml@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
nullthrows: 1.1.1
posthtml: 0.16.6
@ -6673,28 +6680,25 @@ snapshots:
semver: 7.6.3
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-raw@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-react-refresh-wrap@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-react-refresh-wrap@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
react-refresh: 0.9.0
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/transformer-svg@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
'@parcel/transformer-svg@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))':
dependencies:
'@parcel/diagnostic': 2.12.0
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/rust': 2.12.0
nullthrows: 1.1.1
posthtml: 0.16.6
@ -6703,11 +6707,10 @@ snapshots:
semver: 7.6.3
transitivePeerDependencies:
- '@parcel/core'
- '@swc/helpers'
'@parcel/types@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)':
dependencies:
'@parcel/cache': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/cache': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/diagnostic': 2.12.0
'@parcel/fs': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/package-manager': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
@ -10321,9 +10324,9 @@ snapshots:
'@parcel/fs': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/logger': 2.12.0
'@parcel/package-manager': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/reporter-cli': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/reporter-dev-server': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/reporter-tracer': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))(@swc/helpers@0.5.12)
'@parcel/reporter-cli': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/reporter-dev-server': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/reporter-tracer': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.12))
'@parcel/utils': 2.12.0
chalk: 4.1.2
commander: 7.2.0

View File

@ -3,9 +3,10 @@ import path, { join } from "path"
import { mkdirP } from "@actions/io"
import { execaSync } from "execa"
import { readFile } from "fs/promises"
import { addPath } from "os-env"
import { dirname } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { rcPath } from "../cli-options"
/* eslint-disable require-atomic-updates */
let binDir: string | undefined
@ -47,7 +48,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
})
binDir = getBrewPath()
await addPath(binDir)
await addPath(binDir, { rcPath })
return { binDir }
}

View File

@ -1,11 +1,12 @@
/* eslint-disable require-atomic-updates */
import { execaSync } from "execa"
import { addPath } from "os-env"
import { pathExists } from "path-exists"
import { dirname } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { rcPath } from "../cli-options"
import type { InstallationInfo } from "../utils/setup/setupBin"
/* eslint-disable require-atomic-updates */
let binDir: string | undefined
export async function setupChocolatey(
@ -54,7 +55,7 @@ export async function setupChocolatey(
)
const chocoPath = `${process.env.ALLUSERSPROFILE}\\chocolatey\\bin`
await addPath(chocoPath)
await addPath(chocoPath, { rcPath })
const maybeChoco = which.sync("choco", { nothrow: true })
if (maybeChoco !== null) {

View File

@ -1,6 +1,7 @@
import { getInput } from "@actions/core"
import { info } from "ci-log"
import mri from "mri"
import { untildifyUser } from "untildify-user"
import { type Inputs, inputs } from "./tool"
import type { InstallationInfo } from "./utils/setup/setupBin"
@ -71,3 +72,5 @@ export function getSuccessMessage(tool: string, installationInfo: InstallationIn
}
return msg
}
export const rcPath = untildifyUser("~/.cpprc")

View File

@ -1,13 +1,13 @@
import { join } from "path"
import { endGroup, notice, startGroup } from "@actions/core"
import { error, info } from "ci-log"
import { addEnv } from "os-env"
import semverValid from "semver/functions/valid"
import { getSuccessMessage } from "./cli-options"
import { setupGcc, setupMingw } from "./gcc/gcc"
import { activateGcovGCC, activateGcovLLVM } from "./gcovr/gcovr"
import { setupLLVM } from "./llvm/llvm"
import { setupMSVC } from "./msvc/msvc"
import { addEnv } from "./utils/env/addEnv"
import { getVersion } from "./versions/versions"
/** Detecting the compiler version. Divide the given string by `-` and use the second element as the version */

View File

@ -1,4 +1,5 @@
import { addPath } from "../utils/env/addEnv"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -37,6 +38,6 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
async function activateWinCppcheck() {
const binDir = "C:/Program Files/Cppcheck"
await addPath(binDir)
await addPath(binDir, { rcPath })
return binDir
}

View File

@ -1,7 +1,7 @@
import { info, notice } from "ci-log"
import { addPath } from "os-env"
import { addExeExt, join } from "patha"
import { setupGraphviz } from "../graphviz/graphviz"
import { addPath } from "../utils/env/addEnv"
import { extractTar, extractZip } from "../utils/setup/extract"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
@ -12,6 +12,7 @@ import { getVersion } from "../versions/versions"
import { pathExists } from "path-exists"
import retry from "retry-as-promised"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -138,7 +139,7 @@ async function activateWinDoxygen() {
// eslint-disable-next-line no-await-in-loop
if (await pathExists(join(binDir, "doxygen.exe"))) {
// eslint-disable-next-line no-await-in-loop
await addPath(binDir)
await addPath(binDir, { rcPath })
return binDir
}
}

View File

@ -1,4 +1,4 @@
import { addEnv, addPath } from "../utils/env/addEnv"
import { addEnv, addPath } from "os-env"
import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log"
@ -7,6 +7,7 @@ import { pathExists } from "path-exists"
import { addExeExt, join } from "patha"
import semverCoerce from "semver/functions/coerce"
import semverMajor from "semver/functions/major"
import { rcPath } from "../cli-options"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
@ -187,10 +188,10 @@ async function setupChocoMingw(version: string, arch: string): Promise<Installat
let binDir: string | undefined
if (arch === "x64" && (await pathExists("C:/tools/mingw64/bin"))) {
binDir = "C:/tools/mingw64/bin"
await addPath(binDir)
await addPath(binDir, { rcPath })
} else if (arch === "ia32" && (await pathExists("C:/tools/mingw32/bin"))) {
binDir = "C:/tools/mingw32/bin"
await addPath(binDir)
await addPath(binDir, { rcPath })
} else if (await pathExists(`${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin/g++.exe`)) {
binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
}
@ -224,10 +225,10 @@ async function activateGcc(version: string, binDir: string, priority: number = 4
if (isUbuntu()) {
promises.push(
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`, priority),
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`, priority),
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`, priority),
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`, priority),
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`, rcPath, priority),
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`, rcPath, priority),
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`, rcPath, priority),
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`, rcPath, priority),
)
}
} else {
@ -235,10 +236,10 @@ async function activateGcc(version: string, binDir: string, priority: number = 4
if (isUbuntu()) {
promises.push(
updateAptAlternatives("cc", `${binDir}/gcc-${version}`, priority),
updateAptAlternatives("cxx", `${binDir}/g++-${version}`, priority),
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`, priority),
updateAptAlternatives("g++", `${binDir}/g++-${version}`, priority),
updateAptAlternatives("cc", `${binDir}/gcc-${version}`, rcPath, priority),
updateAptAlternatives("cxx", `${binDir}/g++-${version}`, rcPath, priority),
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`, rcPath, priority),
updateAptAlternatives("g++", `${binDir}/g++-${version}`, rcPath, priority),
)
}
}

View File

@ -1,6 +1,6 @@
import { addEnv } from "os-env"
import semverMajor from "semver/functions/major"
import semverValid from "semver/functions/valid"
import { addEnv } from "../utils/env/addEnv"
import { setupPipPack } from "../utils/setup/setupPipPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View File

@ -1,4 +1,5 @@
import { addPath } from "../utils/env/addEnv"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -39,7 +40,7 @@ async function activateGraphviz(): Promise<InstallationInfo> {
switch (process.platform) {
case "win32": {
const binDir = "C:/Program Files/Graphviz/bin"
await addPath(binDir)
await addPath(binDir, { rcPath })
return { binDir }
}
default: {

View File

@ -2,11 +2,12 @@ import { delimiter } from "path"
import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log"
import memoize from "micro-memoize"
import { addEnv } from "os-env"
import { pathExists } from "path-exists"
import { addExeExt, join } from "patha"
import { rcPath } from "../cli-options"
import { setupGcc } from "../gcc/gcc"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addEnv } from "../utils/env/addEnv"
import { isUbuntu } from "../utils/env/isUbuntu"
import { ubuntuVersion } from "../utils/env/ubuntu_version"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
@ -130,13 +131,13 @@ export async function activateLLVM(directory: string) {
if (isUbuntu()) {
const priority = 60
actPromises.push(
updateAptAlternatives("cc", `${directory}/bin/clang`, priority),
updateAptAlternatives("cxx", `${directory}/bin/clang++`, priority),
updateAptAlternatives("clang", `${directory}/bin/clang`),
updateAptAlternatives("clang++", `${directory}/bin/clang++`),
updateAptAlternatives("lld", `${directory}/bin/lld`),
updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`),
updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`),
updateAptAlternatives("cc", `${directory}/bin/clang`, rcPath, priority),
updateAptAlternatives("cxx", `${directory}/bin/clang++`, rcPath, priority),
updateAptAlternatives("clang", `${directory}/bin/clang`, rcPath),
updateAptAlternatives("clang++", `${directory}/bin/clang++`, rcPath),
updateAptAlternatives("lld", `${directory}/bin/lld`, rcPath),
updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`, rcPath),
updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`, rcPath),
)
}

View File

@ -2,8 +2,9 @@ import { info } from "console"
import { execRoot } from "admina"
import { execa } from "execa"
import { chmod, readFile, writeFile } from "fs/promises"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { DEFAULT_TIMEOUT } from "../installTool"
import { addPath } from "../utils/env/addEnv"
import { aptTimeout, hasNala, isPackageRegexInstalled, setupAptPack } from "../utils/setup/setupAptPack"
import type { InstallationInfo } from "../utils/setup/setupBin"
@ -35,7 +36,7 @@ export async function setupLLVMApt(
},
)
await addPath(`${installationFolder}/bin`)
await addPath(`${installationFolder}/bin`, { rcPath })
return {
installDir: `${installationFolder}`,

View File

@ -1,6 +1,6 @@
import { getExecOutput } from "@actions/exec"
import { error } from "ci-log"
import { addEnv } from "../utils/env/addEnv"
import { addEnv } from "os-env"
export async function setupMacOSSDK() {
if (process.platform === "darwin") {

View File

@ -5,15 +5,15 @@ import { GITHUB_ACTIONS, isCI } from "ci-info"
import { error, info, success, warning } from "ci-log"
import * as numerous from "numerous"
import numerousLocale from "numerous/locales/en.js"
import { finalizeRC } from "os-env"
import * as timeDelta from "time-delta"
import timeDeltaLocale from "time-delta/locales/en.js"
import { untildifyUser } from "untildify-user"
import { checkUpdates } from "./check-updates"
import { parseArgs, printHelp } from "./cli-options"
import { parseArgs, printHelp, rcPath } from "./cli-options"
import { installCompiler } from "./compilers"
import { installTool } from "./installTool"
import { tools } from "./tool"
import { finalizeCpprc } from "./utils/env/addEnv"
import { isArch } from "./utils/env/isArch"
import { ubuntuVersion } from "./utils/env/ubuntu_version"
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
@ -115,7 +115,7 @@ async function main(args: string[]): Promise<number> {
}
}
await finalizeCpprc()
await finalizeRC(rcPath)
if (successMessages.length === 0 && errorMessages.length === 0) {
warning("setup-cpp was called without any arguments. Nothing to do.")

View File

@ -1,4 +1,5 @@
import { addPath } from "../utils/env/addEnv"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -16,7 +17,7 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
}
case "darwin": {
await setupBrewPack("make", version)
await addPath("/usr/local/opt/make/libexec/gnubin")
await addPath("/usr/local/opt/make/libexec/gnubin", { rcPath })
return { binDir: "/usr/local/opt/make/libexec/gnubin" }
}
case "linux": {

View File

@ -1,4 +1,5 @@
import { addPath } from "../utils/env/addEnv"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -13,6 +14,6 @@ export async function setupOpencppcoverage(version: string | undefined, _setupDi
async function activateOpencppcoverage() {
const binDir = "C:/Program Files/OpenCppCoverage"
await addPath(binDir)
await addPath(binDir, { rcPath })
return binDir
}

View File

@ -1,5 +1,6 @@
import { execRootSync } from "admina"
import { addPath } from "../utils/env/addEnv"
import { addPath } from "os-env"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -16,7 +17,7 @@ export async function setupPowershell(version: string | undefined, _setupDir: st
case "win32": {
await setupChocoPack("powershell-core", version)
const binDir = "C:/Program Files/PowerShell/7"
await addPath(binDir)
await addPath(binDir, { rcPath })
return { binDir }
}
case "darwin": {

View File

@ -7,10 +7,11 @@ import { info, warning } from "ci-log"
import { execa } from "execa"
import { readdir } from "fs/promises"
import memoize from "micro-memoize"
import { addPath } from "os-env"
import { pathExists } from "path-exists"
import { addExeExt, dirname, join } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -134,7 +135,7 @@ async function setupPythonSystem(setupDir: string, version: string) {
}
const binDir = dirname(bin)
/** The directory which the tool is installed to */
await addPath(binDir)
await addPath(binDir, { rcPath })
installInfo = { installDir: binDir, binDir, bin }
break
}
@ -146,7 +147,7 @@ async function setupPythonSystem(setupDir: string, version: string) {
stderr: string
} = await execa("brew", ["--prefix", "python"], { stdio: "pipe" })
const brewPythonBin = join(brewPythonPrefix.stdout, "libexec", "bin")
await addPath(brewPythonBin)
await addPath(brewPythonBin, { rcPath })
break
}

View File

@ -1,235 +0,0 @@
import { delimiter } from "path"
import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/core"
import { grantUserWriteAccess } from "admina"
import { GITHUB_ACTIONS } from "ci-info"
import { error, warning } from "ci-log"
import escapeSpace from "escape-path-with-spaces"
import escapeQuote from "escape-quotes"
import { execPowershell } from "exec-powershell"
import { appendFile, readFile, writeFile } from "fs/promises"
import { pathExists } from "path-exists"
import { untildifyUser } from "untildify-user"
type AddEnvOptions = {
/** If true, the value will be escaped with quotes and spaces will be escaped with backslash */
shouldEscapeSpace: boolean
/** If true, the variable will be only added if it is not defined */
shouldAddOnlyIfNotDefined: boolean
}
const defaultAddEnvOptions: AddEnvOptions = {
shouldEscapeSpace: false,
shouldAddOnlyIfNotDefined: false,
}
/**
* Add an environment variable.
*
* This function is cross-platforms and works in all the local or CI systems.
*/
export async function addEnv(
name: string,
valGiven: string | undefined,
givenOptions: Partial<AddEnvOptions> = defaultAddEnvOptions,
) {
const options = { ...defaultAddEnvOptions, ...givenOptions }
const val = escapeString(valGiven ?? "", options.shouldEscapeSpace)
try {
if (GITHUB_ACTIONS) {
try {
if (options.shouldAddOnlyIfNotDefined) {
if (process.env[name] !== undefined) {
info(`Environment variable ${name} is already defined. Skipping.`)
return
}
}
exportVariable(name, val)
} catch (err) {
error(err as Error)
await addEnvSystem(name, val, options)
}
} else {
await addEnvSystem(name, val, options)
}
} catch (err) {
error(err as Error)
setFailed(`Failed to export environment variable ${name}=${val}. You should add it manually.`)
}
}
function escapeString(valGiven: string, shouldEscapeSpace: boolean = false) {
const spaceEscaped = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
return escapeQuote(spaceEscaped, "\"", "\\")
}
const ignoredPaths = [/\/usr\/bin\/?/, /\/usr\/local\/bin\/?/]
/** Skip adding /usr/bin to PATH if it is already there */
function isIgnoredPath(path: string) {
if (ignoredPaths.some((checkedPath) => checkedPath.test(path))) {
const paths = process.env.PATH?.split(delimiter) ?? []
return paths.includes(path)
}
return false
}
/**
* Add a path to the PATH environment variable.
*
* This function is cross-platforms and works in all the local or CI systems.
*/
export async function addPath(path: string) {
if (isIgnoredPath(path)) {
return
}
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
try {
if (GITHUB_ACTIONS) {
try {
ghAddPath(path)
} catch (err) {
error(err as Error)
await addPathSystem(path)
}
} else {
await addPathSystem(path)
}
} catch (err) {
error(err as Error)
setFailed(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
}
}
export const cpprc_path = untildifyUser("~/.cpprc")
async function addEnvSystem(name: string, valGiven: string | undefined, options: AddEnvOptions) {
const val = valGiven ?? ""
switch (process.platform) {
case "win32": {
if (options.shouldAddOnlyIfNotDefined) {
if (process.env[name] !== undefined) {
info(`Environment variable ${name} is already defined. Skipping.`)
return
}
}
// 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
}
case "linux":
case "darwin": {
await sourceCpprc()
if (options.shouldAddOnlyIfNotDefined) {
await appendFile(cpprc_path, `\nif [ -z "\${${name}}" ]; then export ${name}="${val}"; fi\n`)
info(`if not defined ${name} then ${name}="${val}" was added to "${cpprc_path}`)
} else {
await appendFile(cpprc_path, `\nexport ${name}="${val}"\n`)
info(`${name}="${val}" was added to "${cpprc_path}`)
}
return
}
default: {
// fall through shell path modification
}
}
process.env[name] = val
}
async function addPathSystem(path: string) {
switch (process.platform) {
case "win32": {
// 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")`,
)
info(`"${path}" was added to the PATH.`)
return
}
case "linux":
case "darwin": {
await sourceCpprc()
await appendFile(cpprc_path, `\nexport PATH="${path}:$PATH"\n`)
info(`"${path}" was added to "${cpprc_path}"`)
return
}
default: {
return
}
}
}
/* eslint-disable require-atomic-updates */
let setupCppInProfile_called = false
/// handles adding conditions to source .cpprc file from .bashrc and .profile
export async function sourceCpprc() {
if (setupCppInProfile_called) {
return
}
const source_cpprc_string =
`\n# source .cpprc if SOURCE_CPPRC is not set to 0\nif [[ "$SOURCE_CPPRC" != 0 && -f "${cpprc_path}" ]]; then source "${cpprc_path}"; fi\n`
try {
await Promise.all([
addCpprcHeader(),
sourceCpprcInProfile(source_cpprc_string),
sourceCpprcInBashrc(source_cpprc_string),
])
} catch (err) {
warning(`Failed to add ${source_cpprc_string} to .profile or .bashrc. You should add it manually: ${err}`)
}
setupCppInProfile_called = true
}
async function addCpprcHeader() {
// a variable that prevents source_cpprc from being called from .bashrc and .profile
const cpprc_header = "# Automatically Generated by setup-cpp\nexport SOURCE_CPPRC=0"
if (await pathExists(cpprc_path)) {
const cpprc_content = await readFile(cpprc_path, "utf8")
if (!cpprc_content.includes(cpprc_header)) {
// already executed setupCppInProfile
await appendFile(cpprc_path, `\n${cpprc_header}\n`)
info(`Added ${cpprc_header} to ${cpprc_path}`)
}
}
}
async function sourceCpprcInBashrc(source_cpprc_string: string) {
const bashrc_path = untildifyUser("~/.bashrc")
if (await pathExists(bashrc_path)) {
const bashrcContent = await readFile(bashrc_path, "utf-8")
if (!bashrcContent.includes(source_cpprc_string)) {
await appendFile(bashrc_path, source_cpprc_string)
info(`${source_cpprc_string} was added to ${bashrc_path}`)
}
}
}
async function sourceCpprcInProfile(source_cpprc_string: string) {
const profile_path = untildifyUser("~/.profile")
if (await pathExists(profile_path)) {
const profileContent = await readFile(profile_path, "utf-8")
if (!profileContent.includes(source_cpprc_string)) {
await appendFile(profile_path, source_cpprc_string)
info(`${source_cpprc_string} was added to ${profile_path}`)
}
}
}
export async function finalizeCpprc() {
if (await pathExists(cpprc_path)) {
const entries = (await readFile(cpprc_path, "utf-8")).split("\n")
const unique_entries = [...new Set(entries.reverse())].reverse() // remove duplicates, keeping the latest entry
await writeFile(cpprc_path, unique_entries.join("\n"))
await grantUserWriteAccess(cpprc_path)
}
}

View File

@ -1,8 +0,0 @@
/** Escape `'` with `\\` */
declare function escapeQuote(input: string): string
/** Escape the given character with the given escape character */
declare function escapeQuote(input: string, character: string, escape_character: string): string
declare module "escape-quotes" {
export = escapeQuote
}

View File

@ -4,9 +4,9 @@ import { info, warning } from "ci-log"
import escapeRegex from "escape-string-regexp"
import { type ExecaError, execa } from "execa"
import { appendFile } from "fs/promises"
import { addEnv, sourceRC } from "os-env"
import { pathExists } from "path-exists"
import which from "which"
import { addEnv, cpprc_path, sourceCpprc } from "../env/addEnv"
import type { InstallationInfo } from "./setupBin"
/* eslint-disable require-atomic-updates */
@ -274,13 +274,13 @@ export async function addAptKeyViaDownload(name: string, url: string) {
return fileName
}
export async function updateAptAlternatives(name: string, path: string, priority: number = 40) {
export async function updateAptAlternatives(name: string, path: string, rcPath: string, priority: number = 40) {
if (GITHUB_ACTIONS) {
await execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, priority.toString()])
} else {
await sourceCpprc()
await sourceRC(rcPath)
await appendFile(
cpprc_path,
rcPath,
`\nif [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${name} ${name} ${path} ${priority}; fi\n`,
)
}

View File

@ -1,13 +1,13 @@
import { cacheDir, downloadTool, find } from "@actions/tool-cache"
import { info } from "ci-log"
import { addPath } from "os-env"
import { join } from "patha"
import { addPath } from "../env/addEnv"
import { tmpdir } from "os"
import { GITHUB_ACTIONS } from "ci-info"
import { pathExists } from "path-exists"
import retry from "retry-as-promised"
import { maybeGetInput } from "../../cli-options"
import { maybeGetInput, rcPath } from "../../cli-options"
import { hasDnf } from "../env/hasDnf"
import { isArch } from "../env/isArch"
import { isUbuntu } from "../env/isUbuntu"
@ -74,7 +74,7 @@ export async function setupBin(
const binDir = join(installDir, binRelativeDir)
if (await pathExists(join(binDir, binFileName))) {
info(`${name} ${version} was found in the cache at ${binDir}.`)
await addPath(binDir)
await addPath(binDir, { rcPath })
return { installDir, binDir }
}
@ -129,7 +129,7 @@ export async function setupBin(
// Adding the bin dir to the path
/** The directory which the tool is installed to */
info(`Add ${binDir} to PATH`)
await addPath(binDir)
await addPath(binDir, { rcPath })
// check if inside Github Actions. If so, cache the installation
if (GITHUB_ACTIONS && typeof process.env.RUNNER_TOOL_CACHE === "string") {

View File

@ -1,9 +1,10 @@
/* eslint-disable require-atomic-updates */
import { info } from "ci-log"
import { execaSync } from "execa"
import { addPath } from "os-env"
import which from "which"
import { setupChocolatey } from "../../chocolatey/chocolatey"
import { addPath } from "../env/addEnv"
import { rcPath } from "../../cli-options"
import type { InstallationInfo } from "./setupBin"
let hasChoco = false
@ -45,7 +46,7 @@ export async function setupChocoPack(name: string, version?: string, args: strin
}
const binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
await addPath(binDir)
await addPath(binDir, { rcPath })
return { binDir }
}

View File

@ -2,13 +2,14 @@ import { info } from "@actions/core"
import { execa, execaSync } from "execa"
import memoize from "micro-memoize"
import { mkdirp } from "mkdirp"
import { addPath } from "os-env"
import { pathExists } from "path-exists"
import { addExeExt, dirname, join } from "patha"
import { untildifyUser } from "untildify-user"
import which from "which"
import { rcPath } from "../../cli-options"
import { addPythonBaseExecPrefix, setupPython } from "../../python/python"
import { getVersion } from "../../versions/versions"
import { addPath } from "../env/addEnv"
import { hasDnf } from "../env/hasDnf"
import { isArch } from "../env/isArch"
import { isUbuntu } from "../env/isUbuntu"
@ -85,7 +86,7 @@ export async function setupPipPackWithPython(
const execPaths = await addPythonBaseExecPrefix(givenPython)
const binDir = await findBinDir(execPaths, name)
await addPath(binDir)
await addPath(binDir, { rcPath })
return { binDir }
}
@ -135,7 +136,7 @@ async function getPipxBinDir_raw() {
}
const pipxBinDir = untildifyUser("~/.local/bin")
await addPath(pipxBinDir)
await addPath(pipxBinDir, { rcPath })
await mkdirp(pipxBinDir)
return pipxBinDir
}

View File

@ -1,10 +1,11 @@
import { grantUserWriteAccess } from "admina"
import { info, notice } from "ci-log"
import { execaSync } from "execa"
import { addPath } from "os-env"
import { pathExists } from "path-exists"
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { rcPath } from "../cli-options"
import { hasDnf } from "../utils/env/hasDnf"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
@ -75,7 +76,7 @@ export async function setupVcpkg(version: string, setupDir: string, _arch: strin
await grantUserWriteAccess(setupDir)
await addPath(setupDir)
await addPath(setupDir, { rcPath })
// eslint-disable-next-line require-atomic-updates
hasVCPKG = true
return { binDir: setupDir }

View File

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

View File

@ -8,6 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
@ -34,6 +35,7 @@
"dev/scripts",
"packages/untildify-user/untildify.ts",
"dev/docker/ci/docker-ci.mjs",
"./jest.config.ts"
"./jest.config.ts",
"packages/os-env/src/escape-quotes.d.ts"
]
}