fix: add types for escape-path-with-spaces

Use the types from https://github.com/jy95/escape-path-with-spaces/pull/14
This commit is contained in:
Amin Yahyaabadi 2022-08-07 19:23:55 -07:00
parent 3d08c16e03
commit 6dd9d766bb
8 changed files with 15 additions and 24 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.mjs vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -56,7 +56,7 @@
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1",
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d",
"escape-path-with-spaces": "^1.0.0",
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
"exec-powershell": "workspace:*",
"execa": "^5.1.1",
"extension-tools": "workspace:*",

View File

@ -27,7 +27,7 @@ importers:
cross-env: 7.0.3
cross-spawn: ^7.0.3
cspell: ^6.5.0
escape-path-with-spaces: ^1.0.0
escape-path-with-spaces: github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3
eslint: ^8.21.0
eslint-config-atomic: ^1.18.1
exec-powershell: workspace:*
@ -63,7 +63,7 @@ importers:
'@actions/io': 1.1.2
'@actions/tool-cache': 2.0.1
'@npmcli/ci-detect': github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d
escape-path-with-spaces: 1.0.0
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
exec-powershell: link:packages/exec-powershell
execa: 5.1.1
extension-tools: link:packages/extension-tools
@ -4138,10 +4138,6 @@ packages:
engines: {node: '>=12'}
dev: true
/escape-path-with-spaces/1.0.0:
resolution: {integrity: sha512-+98Hh0yzVa0hldJXlzr0M/8B8LVXW9vNT5boC9k6o896Z52DGRplm3NwMGX0590ryGSegzTf/uaUiusFj2SQbQ==}
dev: false
/escape-string-regexp/1.0.5:
resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==}
engines: {node: '>=0.8.0'}
@ -9411,6 +9407,12 @@ packages:
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
dev: false
github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3:
resolution: {tarball: https://codeload.github.com/aminya/escape-path-with-spaces/tar.gz/d9f81ee649203ddc55783a2f96ada59df06118e3}
name: escape-path-with-spaces
version: 1.0.0
dev: false
github.com/aminya/msvc-dev-cmd/9f672c1:
resolution: {tarball: https://codeload.github.com/aminya/msvc-dev-cmd/tar.gz/9f672c1}
name: msvc-dev-cmd

View File

@ -5,7 +5,7 @@ import { appendFileSync, existsSync, readFileSync } from "fs"
import { error, warning } from "../io/io"
import { execPowershell } from "exec-powershell"
import { delimiter } from "path"
import { escapeSpace } from "../path/escape_space"
import escapeSpace from "escape-path-with-spaces"
/**
* Add an environment variable.
@ -13,7 +13,7 @@ import { escapeSpace } from "../path/escape_space"
* This function is cross-platforms and works in all the local or CI systems.
*/
export async function addEnv(name: string, valGiven: string | undefined, shouldEscapeSpace: boolean = false) {
const val = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
const val = shouldEscapeSpace ? escapeSpace(valGiven ?? "") : valGiven
try {
if (ciDetect() === "github-actions") {
try {

View File

@ -1,11 +0,0 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import escape from "escape-path-with-spaces"
/// Escape the spaces in the given path
export function escapeSpace(path: string | undefined): string {
if (path === undefined) {
return ""
}
return escape(path)
}