Skip to content

Commit d6f2279

Browse files
authored
prepare dist (#30)
1 parent 968e3d5 commit d6f2279

File tree

2 files changed

+40
-65
lines changed

2 files changed

+40
-65
lines changed

dist/index.js

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,11 +4506,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45064506
};
45074507
var _a;
45084508
Object.defineProperty(exports, "__esModule", ({ value: true }));
4509-
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
4509+
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
45104510
const fs = __importStar(__nccwpck_require__(7147));
45114511
const path = __importStar(__nccwpck_require__(1017));
4512-
_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;
4512+
_a = fs.promises
4513+
// export const {open} = 'fs'
4514+
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
4515+
// export const {open} = 'fs'
45134516
exports.IS_WINDOWS = process.platform === 'win32';
4517+
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
4518+
exports.UV_FS_O_EXLOCK = 0x10000000;
4519+
exports.READONLY = fs.constants.O_RDONLY;
45144520
function exists(fsPath) {
45154521
return __awaiter(this, void 0, void 0, function* () {
45164522
try {
@@ -4691,12 +4697,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
46914697
Object.defineProperty(exports, "__esModule", ({ value: true }));
46924698
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
46934699
const assert_1 = __nccwpck_require__(9491);
4694-
const childProcess = __importStar(__nccwpck_require__(2081));
46954700
const path = __importStar(__nccwpck_require__(1017));
4696-
const util_1 = __nccwpck_require__(3837);
46974701
const ioUtil = __importStar(__nccwpck_require__(1962));
4698-
const exec = util_1.promisify(childProcess.exec);
4699-
const execFile = util_1.promisify(childProcess.execFile);
47004702
/**
47014703
* Copies a file or folder.
47024704
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -4777,61 +4779,23 @@ exports.mv = mv;
47774779
function rmRF(inputPath) {
47784780
return __awaiter(this, void 0, void 0, function* () {
47794781
if (ioUtil.IS_WINDOWS) {
4780-
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
4781-
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
47824782
// Check for invalid characters
47834783
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
47844784
if (/[*"<>|]/.test(inputPath)) {
47854785
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
47864786
}
4787-
try {
4788-
const cmdPath = ioUtil.getCmdPath();
4789-
if (yield ioUtil.isDirectory(inputPath, true)) {
4790-
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
4791-
env: { inputPath }
4792-
});
4793-
}
4794-
else {
4795-
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
4796-
env: { inputPath }
4797-
});
4798-
}
4799-
}
4800-
catch (err) {
4801-
// if you try to delete a file that doesn't exist, desired result is achieved
4802-
// other errors are valid
4803-
if (err.code !== 'ENOENT')
4804-
throw err;
4805-
}
4806-
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
4807-
try {
4808-
yield ioUtil.unlink(inputPath);
4809-
}
4810-
catch (err) {
4811-
// if you try to delete a file that doesn't exist, desired result is achieved
4812-
// other errors are valid
4813-
if (err.code !== 'ENOENT')
4814-
throw err;
4815-
}
48164787
}
4817-
else {
4818-
let isDir = false;
4819-
try {
4820-
isDir = yield ioUtil.isDirectory(inputPath);
4821-
}
4822-
catch (err) {
4823-
// if you try to delete a file that doesn't exist, desired result is achieved
4824-
// other errors are valid
4825-
if (err.code !== 'ENOENT')
4826-
throw err;
4827-
return;
4828-
}
4829-
if (isDir) {
4830-
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
4831-
}
4832-
else {
4833-
yield ioUtil.unlink(inputPath);
4834-
}
4788+
try {
4789+
// note if path does not exist, error is silent
4790+
yield ioUtil.rm(inputPath, {
4791+
force: true,
4792+
maxRetries: 3,
4793+
recursive: true,
4794+
retryDelay: 300
4795+
});
4796+
}
4797+
catch (err) {
4798+
throw new Error(`File was unable to be removed ${err}`);
48354799
}
48364800
});
48374801
}
@@ -7994,9 +7958,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
79947958
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
79957959

79967960
var Bottleneck = _interopDefault(__nccwpck_require__(1174));
7961+
var requestError = __nccwpck_require__(537);
79977962

79987963
// @ts-ignore
7999-
async function errorRequest(octokit, state, error, options) {
7964+
async function errorRequest(state, octokit, error, options) {
80007965
if (!error.request || !error.request.request) {
80017966
// address https://github.com/octokit/plugin-retry.js/issues/8
80027967
throw error;
@@ -8011,11 +7976,9 @@ async function errorRequest(octokit, state, error, options) {
80117976
throw error;
80127977
}
80137978

8014-
// @ts-ignore
8015-
// @ts-ignore
8016-
async function wrapRequest(state, request, options) {
7979+
// @ts-nocheck
7980+
async function wrapRequest(state, octokit, request, options) {
80177981
const limiter = new Bottleneck();
8018-
// @ts-ignore
80197982
limiter.on("failed", function (error, info) {
80207983
const maxRetries = ~~error.request.request.retries;
80217984
const after = ~~error.request.request.retryAfter;
@@ -8026,10 +7989,22 @@ async function wrapRequest(state, request, options) {
80267989
return after * state.retryAfterBaseValue;
80277990
}
80287991
});
8029-
return limiter.schedule(request, options);
7992+
return limiter.schedule(requestWithGraphqlErrorHandling.bind(null, state, octokit, request), options);
7993+
}
7994+
async function requestWithGraphqlErrorHandling(state, octokit, request, options) {
7995+
const response = await request(request, options);
7996+
if (response.data && response.data.errors && /Something went wrong while executing your query/.test(response.data.errors[0].message)) {
7997+
// simulate 500 request error for retry handling
7998+
const error = new requestError.RequestError(response.data.errors[0].message, 500, {
7999+
request: options,
8000+
response
8001+
});
8002+
return errorRequest(state, octokit, error, options);
8003+
}
8004+
return response;
80308005
}
80318006

8032-
const VERSION = "4.0.4";
8007+
const VERSION = "4.1.3";
80338008
function retry(octokit, octokitOptions) {
80348009
const state = Object.assign({
80358010
enabled: true,
@@ -8038,8 +8013,8 @@ function retry(octokit, octokitOptions) {
80388013
retries: 3
80398014
}, octokitOptions.retry);
80408015
if (state.enabled) {
8041-
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
8042-
octokit.hook.wrap("request", wrapRequest.bind(null, state));
8016+
octokit.hook.error("request", errorRequest.bind(null, state, octokit));
8017+
octokit.hook.wrap("request", wrapRequest.bind(null, state, octokit));
80438018
}
80448019
return {
80458020
retry: {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)