mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-11-05 11:35:48 +00:00
Update io
This commit is contained in:
parent
9580326150
commit
be4c7f772f
10 changed files with 159 additions and 119 deletions
80
node_modules/@actions/io/README.md
generated
vendored
80
node_modules/@actions/io/README.md
generated
vendored
|
@ -4,46 +4,50 @@
|
|||
|
||||
## Usage
|
||||
|
||||
#### mkdir -p
|
||||
|
||||
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
||||
|
||||
```
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function cp(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
const io = require('@actions/io');
|
||||
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param path path to remove
|
||||
*/
|
||||
export function rmRF(path: string): Promise<void>
|
||||
await io.mkdirP('path/to/make');
|
||||
```
|
||||
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
*
|
||||
* @param p path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export function mkdirP(p: string): Promise<void>
|
||||
#### cp/mv
|
||||
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function mv(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
||||
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param options optional. See WhichOptions.
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export function which(tool: string, options?: WhichOptions): Promise<string>
|
||||
```
|
||||
```
|
||||
const io = require('@actions/io');
|
||||
|
||||
// Recursive must be true for directories
|
||||
const options = { recursive: true, force: false }
|
||||
|
||||
await io.cp('path/to/directory', 'path/to/dest', options);
|
||||
await io.mv('path/to/file', 'path/to/dest');
|
||||
```
|
||||
|
||||
#### rm -rf
|
||||
|
||||
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
||||
|
||||
```
|
||||
const io = require('@actions/io');
|
||||
|
||||
await io.rmRF('path/to/directory');
|
||||
await io.rmRF('path/to/file');
|
||||
```
|
||||
|
||||
#### which
|
||||
|
||||
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
||||
|
||||
```
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
```
|
||||
|
|
2
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
2
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare const copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, unlink: typeof fs.promises.unlink;
|
||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
||||
export declare const IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
|
|
2
node_modules/@actions/io/lib/io-util.js
generated
vendored
2
node_modules/@actions/io/lib/io-util.js
generated
vendored
|
@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const assert_1 = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
_a = fs.promises, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.unlink = _a.unlink;
|
||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
2
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
2
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
|
@ -1 +1 @@
|
|||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAQE,iMAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAEx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KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
12
node_modules/@actions/io/lib/io.d.ts
generated
vendored
12
node_modules/@actions/io/lib/io.d.ts
generated
vendored
|
@ -7,8 +7,16 @@ export interface CopyOptions {
|
|||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface MoveOptions {
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
|
@ -20,9 +28,9 @@ export declare function cp(source: string, dest: string, options?: CopyOptions):
|
|||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
|
|
171
node_modules/@actions/io/lib/io.js
generated
vendored
171
node_modules/@actions/io/lib/io.js
generated
vendored
|
@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const childProcess = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const util_1 = require("util");
|
||||
const ioUtil = require("./io-util");
|
||||
const exec = util_1.promisify(childProcess.exec);
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
|
@ -23,7 +23,35 @@ const exec = util_1.promisify(childProcess.exec);
|
|||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: false });
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||
// Dest is an existing file, but not forcing
|
||||
if (destStat && destStat.isFile() && !force) {
|
||||
return;
|
||||
}
|
||||
// If dest is an existing directory, should copy inside.
|
||||
const newDest = destStat && destStat.isDirectory()
|
||||
? path.join(dest, path.basename(source))
|
||||
: dest;
|
||||
if (!(yield ioUtil.exists(source))) {
|
||||
throw new Error(`no such file or directory: ${source}`);
|
||||
}
|
||||
const sourceStat = yield ioUtil.stat(source);
|
||||
if (sourceStat.isDirectory()) {
|
||||
if (!recursive) {
|
||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||
}
|
||||
else {
|
||||
yield cpDirRecursive(source, newDest, 0, force);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (path.relative(source, newDest) === '') {
|
||||
// a file cannot be copied to itself
|
||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||
}
|
||||
yield copyFile(source, newDest, force);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
|
@ -32,11 +60,28 @@ exports.cp = cp;
|
|||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: true });
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
let destExists = true;
|
||||
if (yield ioUtil.isDirectory(dest)) {
|
||||
// If dest is directory copy src into dest
|
||||
dest = path.join(dest, path.basename(source));
|
||||
destExists = yield ioUtil.exists(dest);
|
||||
}
|
||||
if (destExists) {
|
||||
if (options.force == null || options.force) {
|
||||
yield rmRF(dest);
|
||||
}
|
||||
else {
|
||||
throw new Error('Destination already exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
yield mkdirP(path.dirname(dest));
|
||||
yield ioUtil.rename(source, dest);
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
|
@ -186,77 +231,59 @@ function which(tool, check) {
|
|||
});
|
||||
}
|
||||
exports.which = which;
|
||||
// Copies contents of source into dest, making any necessary folders along the way.
|
||||
// Deletes the original copy if deleteOriginal is true
|
||||
function copyDirectoryContents(source, dest, force, deleteOriginal = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (yield ioUtil.isDirectory(source)) {
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
if (!(yield ioUtil.isDirectory(dest))) {
|
||||
throw new Error(`${dest} is not a directory`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
yield mkdirP(dest);
|
||||
}
|
||||
// Copy all child files, and directories recursively
|
||||
const sourceChildren = yield ioUtil.readdir(source);
|
||||
for (const newSource of sourceChildren) {
|
||||
const newDest = path.join(dest, path.basename(newSource));
|
||||
yield copyDirectoryContents(path.resolve(source, newSource), newDest, force, deleteOriginal);
|
||||
}
|
||||
if (deleteOriginal) {
|
||||
yield ioUtil.rmdir(source);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (force) {
|
||||
yield ioUtil.copyFile(source, dest);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL);
|
||||
}
|
||||
if (deleteOriginal) {
|
||||
yield ioUtil.unlink(source);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function move(source, dest, options = {}, moveOptions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
if (yield ioUtil.isDirectory(source)) {
|
||||
if (!recursive) {
|
||||
throw new Error(`non-recursive cp failed, ${source} is a directory`);
|
||||
}
|
||||
// If directory exists, move source inside it. Otherwise, create it and move contents of source inside.
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
if (!(yield ioUtil.isDirectory(dest))) {
|
||||
throw new Error(`${dest} is not a directory`);
|
||||
}
|
||||
dest = path.join(dest, path.basename(source));
|
||||
}
|
||||
yield copyDirectoryContents(source, dest, force, moveOptions.deleteOriginal);
|
||||
}
|
||||
else {
|
||||
if ((yield ioUtil.exists(dest)) && (yield ioUtil.isDirectory(dest))) {
|
||||
dest = path.join(dest, path.basename(source));
|
||||
}
|
||||
if (force) {
|
||||
yield ioUtil.copyFile(source, dest);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL);
|
||||
}
|
||||
if (moveOptions.deleteOriginal) {
|
||||
yield ioUtil.unlink(source);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function readCopyOptions(options) {
|
||||
const force = options.force == null ? true : options.force;
|
||||
const recursive = Boolean(options.recursive);
|
||||
return { force, recursive };
|
||||
}
|
||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Ensure there is not a run away recursive copy
|
||||
if (currentDepth >= 255)
|
||||
return;
|
||||
currentDepth++;
|
||||
yield mkdirP(destDir);
|
||||
const files = yield ioUtil.readdir(sourceDir);
|
||||
for (const fileName of files) {
|
||||
const srcFile = `${sourceDir}/${fileName}`;
|
||||
const destFile = `${destDir}/${fileName}`;
|
||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||
if (srcFileStat.isDirectory()) {
|
||||
// Recurse
|
||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||
}
|
||||
else {
|
||||
yield copyFile(srcFile, destFile, force);
|
||||
}
|
||||
}
|
||||
// Change the mode for the newly created directory
|
||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||
});
|
||||
}
|
||||
// Buffered file copy
|
||||
function copyFile(srcFile, destFile, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||
// unlink/re-link it
|
||||
try {
|
||||
yield ioUtil.lstat(destFile);
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
catch (e) {
|
||||
// Try to override file permission
|
||||
if (e.code === 'EPERM') {
|
||||
yield ioUtil.chmod(destFile, '0666');
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
// other errors = it doesn't exist, no work to do
|
||||
}
|
||||
// Copy over symlink
|
||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||
}
|
||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||
yield ioUtil.copyFile(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=io.js.map
|
2
node_modules/@actions/io/lib/io.js.map
generated
vendored
2
node_modules/@actions/io/lib/io.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5
node_modules/@actions/io/package.json
generated
vendored
5
node_modules/@actions/io/package.json
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
"_from": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"_id": "@actions/io@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg==",
|
||||
"_integrity": "sha512-MZUGyOe6m26Ns6ZQnr2JvxXzlwZ33XWYG392b5YuPMim1CE8DbuiBHtqOZeHVm5PenS4fRUG3qMTiMymve1DUA==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
|
@ -17,11 +17,12 @@
|
|||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "1e8f0faca6b39215bebacedf473e5bb0716e39bf",
|
||||
"_shasum": "b9fd92bae7bfb507c75e3e35a107750901a51d00",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"@actions/io": {
|
||||
"version": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg=="
|
||||
"integrity": "sha512-MZUGyOe6m26Ns6ZQnr2JvxXzlwZ33XWYG392b5YuPMim1CE8DbuiBHtqOZeHVm5PenS4fRUG3qMTiMymve1DUA=="
|
||||
},
|
||||
"@actions/tool-cache": {
|
||||
"version": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue