Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e88f1375d | |||
| 992d977c74 | |||
| 035a7bbf6e | |||
| 9437454416 | |||
| 6fae5a046b | |||
| 6bb14c42ee | |||
| 9f3f840120 | |||
| 7cbe5b9470 | |||
| 59ec9d07a4 | |||
| 8e804e9f8d | |||
| 63de74f29d | |||
| 665b756702 | |||
| 91f0c9b7d0 | |||
| 58890d888d | |||
| b0377621eb | |||
| 9ff7fcb0e5 | |||
| eed631025c | |||
| d589c08bf4 | |||
| 683cee159e | |||
| 1e057c1e35 | |||
| 5261f00994 | |||
| 1f17f8bd0b | |||
| 19e20568d3 | |||
| e1ed8690d9 | |||
| 6de6f42334 | |||
| 4d807985ec | |||
| 5a97107fca | |||
| c07cd3b44d | |||
| fe0fbdccde | |||
| 4272cd6ca1 | |||
| 9529f35ffd | |||
| 5dde1c4cf6 | |||
| 7a5a1c3d42 | |||
| bcf8127e13 | |||
| a9ce8db226 | |||
| ed5722cdf7 | |||
| f1e183e98c | |||
| d155e954a1 | |||
| 3406ce58d6 | |||
| b0ce9247be | |||
| 5ff5e4f9f0 | |||
| f6011790d6 | |||
| 4f66571667 | |||
| b0f4d114f3 | |||
| a25a620745 | |||
| 6a3c62d3a8 | |||
| 6a357de342 | |||
| 8d2f32e652 | |||
| 35cba88c68 | |||
| 6a330f08c2 | |||
| 068db23ad8 | |||
| 143b802c0a | |||
| f13d18d494 | |||
| 41350470e5 | |||
| a730b5ca5f |
Generated
+24
-18
@@ -5,6 +5,9 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "root",
|
||||
"dependencies": {
|
||||
"package-lock-only": "^0.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^16.18.1",
|
||||
@@ -5450,7 +5453,6 @@
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
@@ -6152,7 +6154,6 @@
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
@@ -6354,7 +6355,6 @@
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
@@ -6362,8 +6362,7 @@
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"node_modules/color-support": {
|
||||
"version": "1.1.3",
|
||||
@@ -7406,7 +7405,6 @@
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
@@ -8909,7 +8907,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
@@ -14404,6 +14401,15 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/package-lock-only": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/package-lock-only/-/package-lock-only-0.0.4.tgz",
|
||||
"integrity": "sha512-fV1YHeTMWH5LKmdVqfWskm2/SG0iF2IrxJn3ziaPVx9CnpecGJzt8xXtLV+CYINENZwPFMtbxO5qupz0asNz1A==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"chalk": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pacote": {
|
||||
"version": "13.6.2",
|
||||
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.6.2.tgz",
|
||||
@@ -15758,7 +15764,6 @@
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
@@ -21187,7 +21192,6 @@
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
@@ -21719,7 +21723,6 @@
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
@@ -21871,7 +21874,6 @@
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
@@ -21879,8 +21881,7 @@
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"color-support": {
|
||||
"version": "1.1.3",
|
||||
@@ -22680,8 +22681,7 @@
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"escodegen": {
|
||||
"version": "2.0.0",
|
||||
@@ -23831,8 +23831,7 @@
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.0",
|
||||
@@ -27986,6 +27985,14 @@
|
||||
"p-reduce": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"package-lock-only": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/package-lock-only/-/package-lock-only-0.0.4.tgz",
|
||||
"integrity": "sha512-fV1YHeTMWH5LKmdVqfWskm2/SG0iF2IrxJn3ziaPVx9CnpecGJzt8xXtLV+CYINENZwPFMtbxO5qupz0asNz1A==",
|
||||
"requires": {
|
||||
"chalk": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"pacote": {
|
||||
"version": "13.6.2",
|
||||
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.6.2.tgz",
|
||||
@@ -29006,7 +29013,6 @@
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
|
||||
+4
-1
@@ -11,7 +11,7 @@
|
||||
"lint": "eslint packages/**/*.ts",
|
||||
"lint-fix": "eslint packages/**/*.ts --fix",
|
||||
"new-package": "scripts/create-package",
|
||||
"test": "jest --testTimeout 10000"
|
||||
"test": "jest --testTimeout 10000 --forceExit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
@@ -28,5 +28,8 @@
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.9.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"package-lock-only": "^0.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
-30
@@ -9,11 +9,7 @@
|
||||
"version": "3.2.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/glob": "^0.1.0",
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@azure/abort-controller": "^1.1.0",
|
||||
"@azure/ms-rest-js": "^2.6.0",
|
||||
"@azure/storage-blob": "^12.13.0",
|
||||
@@ -43,14 +39,6 @@
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/glob": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
|
||||
@@ -68,11 +56,6 @@
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz",
|
||||
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
||||
},
|
||||
"node_modules/@azure/abort-controller": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
|
||||
@@ -628,14 +611,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@actions/exec": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
|
||||
"requires": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"@actions/glob": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
|
||||
@@ -653,11 +628,6 @@
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"@actions/io": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz",
|
||||
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
||||
},
|
||||
"@azure/abort-controller": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
|
||||
|
||||
@@ -3,9 +3,14 @@ import {promises as fs} from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as io from '../src/io'
|
||||
import * as ioUtil from '../src/io-util'
|
||||
|
||||
describe('cp', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
@@ -192,7 +197,11 @@ describe('cp', () => {
|
||||
})
|
||||
|
||||
describe('mv', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
@@ -294,7 +303,11 @@ describe('mv', () => {
|
||||
})
|
||||
|
||||
describe('rmRF', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
@@ -326,15 +339,25 @@ describe('rmRF', () => {
|
||||
await io.mkdirP(testPath)
|
||||
await assertExists(testPath)
|
||||
|
||||
// can't remove folder with locked file on windows
|
||||
const filePath = path.join(testPath, 'file.txt')
|
||||
await fs.appendFile(filePath, 'some data')
|
||||
await assertExists(filePath)
|
||||
|
||||
const fd = await fs.open(filePath, 'r')
|
||||
const fd = await fs.open(filePath, fs.constants.O_RDONLY | 0x10000000)
|
||||
await io.rmRF(testPath)
|
||||
|
||||
await assertNotExists(testPath)
|
||||
// // can't remove folder with locked file on windows
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
try {
|
||||
// additionally, can't stat an open file on Windows without getting EPERM
|
||||
await io.rmRF(testPath)
|
||||
} catch (err) {
|
||||
expect(err.code).toBe('EPERM')
|
||||
}
|
||||
} else {
|
||||
await io.rmRF(testPath)
|
||||
await assertNotExists(testPath)
|
||||
}
|
||||
|
||||
await fd.close()
|
||||
await io.rmRF(testPath)
|
||||
@@ -737,7 +760,11 @@ describe('rmRF', () => {
|
||||
})
|
||||
|
||||
describe('mkdirP', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
@@ -875,7 +902,11 @@ describe('mkdirP', () => {
|
||||
})
|
||||
|
||||
describe('which', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
@@ -1412,7 +1443,11 @@ describe('which', () => {
|
||||
})
|
||||
|
||||
describe('findInPath', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await io.mkdirP(getTestTemp())
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
export const {
|
||||
access,
|
||||
chmod,
|
||||
copyFile,
|
||||
lstat,
|
||||
@@ -10,12 +10,14 @@ export const {
|
||||
readlink,
|
||||
rename,
|
||||
rmdir,
|
||||
rm,
|
||||
stat,
|
||||
symlink,
|
||||
unlink
|
||||
} = fs.promises
|
||||
|
||||
export const IS_WINDOWS = process.platform === 'win32'
|
||||
export const UV_FS_O_EXLOCK = 0x10000000
|
||||
|
||||
export async function exists(fsPath: string): Promise<boolean> {
|
||||
try {
|
||||
|
||||
+6
-49
@@ -1,12 +1,7 @@
|
||||
import {ok} from 'assert'
|
||||
import * as childProcess from 'child_process'
|
||||
import * as path from 'path'
|
||||
import {promisify} from 'util'
|
||||
import * as ioUtil from './io-util'
|
||||
|
||||
const exec = promisify(childProcess.exec)
|
||||
const execFile = promisify(childProcess.execFile)
|
||||
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
@@ -116,9 +111,6 @@ export async function mv(
|
||||
*/
|
||||
export async function rmRF(inputPath: string): Promise<void> {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
|
||||
// Check for invalid characters
|
||||
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||
if (/[*"<>|]/.test(inputPath)) {
|
||||
@@ -126,48 +118,13 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||
'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'
|
||||
)
|
||||
}
|
||||
try {
|
||||
const cmdPath = ioUtil.getCmdPath()
|
||||
if (await ioUtil.isDirectory(inputPath, true)) {
|
||||
await exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||
env: {inputPath}
|
||||
})
|
||||
} else {
|
||||
await exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||
env: {inputPath}
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
}
|
||||
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
await ioUtil.unlink(inputPath)
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
}
|
||||
} else {
|
||||
let isDir = false
|
||||
try {
|
||||
isDir = await ioUtil.isDirectory(inputPath)
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
return
|
||||
}
|
||||
|
||||
if (isDir) {
|
||||
await execFile(`rm`, [`-rf`, `${inputPath}`])
|
||||
} else {
|
||||
await ioUtil.unlink(inputPath)
|
||||
}
|
||||
}
|
||||
ioUtil.rm(inputPath, {
|
||||
force: true,
|
||||
maxRetries: 3,
|
||||
recursive: true,
|
||||
retryDelay: 300
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user