From 4b3176632feaf69118f144397c2352aa5654edd6 Mon Sep 17 00:00:00 2001 From: firebelley <4622925+firebelley@users.noreply.github.com> Date: Thu, 17 Nov 2022 20:08:33 -0500 Subject: [PATCH] v4.3.0 (#93) * updates to ouput setting * update dist * update release action Co-authored-by: Firebelley --- .github/workflows/build-example.yml | 12 +- README.md | 14 +- dist/index.js | 813 +++++++++++++++++++++++----- package.json | 2 +- src/godot.ts | 9 +- yarn.lock | 8 +- 6 files changed, 685 insertions(+), 173 deletions(-) diff --git a/.github/workflows/build-example.yml b/.github/workflows/build-example.yml index 99b50f6b..03eb4158 100644 --- a/.github/workflows/build-example.yml +++ b/.github/workflows/build-example.yml @@ -15,12 +15,12 @@ jobs: - name: get tag from version id: tag_version run: | - echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/v} + echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: install wine id: wine_install run: | sudo apt install wine64 - echo ::set-output name=WINE_PATH::$(which wine64) + echo "WINE_PATH=$(which wine64)" >> $GITHUB_OUTPUT - name: export game id: export uses: firebelley/godot-export@v4.2.0 @@ -32,9 +32,9 @@ jobs: archive_output: true wine_path: ${{ steps.wine_install.outputs.WINE_PATH }} - name: create release - uses: softprops/action-gh-release@v0.1.14 + uses: ncipollo/release-action@v1.11.2 with: token: ${{ secrets.GITHUB_TOKEN }} - generate_release_notes: true - tag_name: ${{ steps.tag_version.outputs.TAG_VERSION }} - files: ${{ steps.export.outputs.archive_directory }}/* # Added "/*" at the end is glob pattern match for this action + generateReleaseNotes: true + tag: ${{ steps.tag_version.outputs.TAG_VERSION }} + artifacts: ${{ steps.export.outputs.archive_directory }}/* # Added "/*" at the end is glob pattern match for this action diff --git a/README.md b/README.md index e987fe8f..56345304 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ jobs: - name: get tag from version id: tag_version run: | - echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/v} + echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: export game id: export @@ -96,14 +96,14 @@ jobs: archive_output: true # This release action has worked well for me. However, you can most likely use any release action of your choosing. - # https://github.com/softprops/action-gh-release + # https://github.com/ncipollo/release-action - name: create release - uses: softprops/action-gh-release@v0.1.14 + uses: ncipollo/release-action@v1.11.2 with: token: ${{ secrets.GITHUB_TOKEN }} - generate_release_notes: true - tag_name: ${{ steps.tag_version.outputs.TAG_VERSION }} - files: ${{ steps.export.outputs.archive_directory }}/* + generateReleaseNotes: true + tag: ${{ steps.tag_version.outputs.TAG_VERSION }} + artifacts: ${{ steps.export.outputs.archive_directory }}/* ``` ## Custom Editor Settings @@ -137,7 +137,7 @@ In order to configure this action to update your game's Windows exe icon, includ id: wine_install run: | sudo apt install wine64 - echo ::set-output name=WINE_PATH::$(which wine64) + echo "WINE_PATH=$(which wine64)" >> $GITHUB_OUTPUT # Any other intermediate steps can go here diff --git a/dist/index.js b/dist/index.js index 1931b195..e56d6d36 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 351: +/***/ 7351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -27,8 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; -const os = __importStar(__nccwpck_require__(37)); -const utils_1 = __nccwpck_require__(278); +const os = __importStar(__nccwpck_require__(2037)); +const utils_1 = __nccwpck_require__(5278); /** * Commands * @@ -100,7 +100,7 @@ function escapeProperty(s) { /***/ }), -/***/ 186: +/***/ 2186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -135,13 +135,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(351); +const command_1 = __nccwpck_require__(7351); const file_command_1 = __nccwpck_require__(717); -const utils_1 = __nccwpck_require__(278); -const os = __importStar(__nccwpck_require__(37)); -const path = __importStar(__nccwpck_require__(17)); -const uuid_1 = __nccwpck_require__(840); -const oidc_utils_1 = __nccwpck_require__(41); +const utils_1 = __nccwpck_require__(5278); +const os = __importStar(__nccwpck_require__(2037)); +const path = __importStar(__nccwpck_require__(1017)); +const oidc_utils_1 = __nccwpck_require__(8041); /** * The code to exit an action */ @@ -170,20 +169,9 @@ function exportVariable(name, val) { process.env[name] = convertedVal; const filePath = process.env['GITHUB_ENV'] || ''; if (filePath) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - // These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter. - if (name.includes(delimiter)) { - throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); - } - if (convertedVal.includes(delimiter)) { - throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); - } - const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; - file_command_1.issueCommand('ENV', commandValue); - } - else { - command_1.issueCommand('set-env', { name }, convertedVal); + return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); } + command_1.issueCommand('set-env', { name }, convertedVal); } exports.exportVariable = exportVariable; /** @@ -201,7 +189,7 @@ exports.setSecret = setSecret; function addPath(inputPath) { const filePath = process.env['GITHUB_PATH'] || ''; if (filePath) { - file_command_1.issueCommand('PATH', inputPath); + file_command_1.issueFileCommand('PATH', inputPath); } else { command_1.issueCommand('add-path', {}, inputPath); @@ -241,7 +229,10 @@ function getMultilineInput(name, options) { const inputs = getInput(name, options) .split('\n') .filter(x => x !== ''); - return inputs; + if (options && options.trimWhitespace === false) { + return inputs; + } + return inputs.map(input => input.trim()); } exports.getMultilineInput = getMultilineInput; /** @@ -274,8 +265,12 @@ exports.getBooleanInput = getBooleanInput; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { + const filePath = process.env['GITHUB_OUTPUT'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); + } process.stdout.write(os.EOL); - command_1.issueCommand('set-output', { name }, value); + command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); } exports.setOutput = setOutput; /** @@ -404,7 +399,11 @@ exports.group = group; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function saveState(name, value) { - command_1.issueCommand('save-state', { name }, value); + const filePath = process.env['GITHUB_STATE'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); + } + command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value)); } exports.saveState = saveState; /** @@ -426,17 +425,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(327); +var summary_1 = __nccwpck_require__(1327); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(327); +var summary_2 = __nccwpck_require__(1327); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(981); +var path_utils_1 = __nccwpck_require__(2981); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -470,13 +469,14 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.issueCommand = void 0; +exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__nccwpck_require__(147)); -const os = __importStar(__nccwpck_require__(37)); -const utils_1 = __nccwpck_require__(278); -function issueCommand(command, message) { +const fs = __importStar(__nccwpck_require__(7147)); +const os = __importStar(__nccwpck_require__(2037)); +const uuid_1 = __nccwpck_require__(5840); +const utils_1 = __nccwpck_require__(5278); +function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); @@ -488,12 +488,27 @@ function issueCommand(command, message) { encoding: 'utf8' }); } -exports.issueCommand = issueCommand; +exports.issueFileCommand = issueFileCommand; +function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${uuid_1.v4()}`; + const convertedValue = utils_1.toCommandValue(value); + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; +} +exports.prepareKeyValueMessage = prepareKeyValueMessage; //# sourceMappingURL=file-command.js.map /***/ }), -/***/ 41: +/***/ 8041: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -509,9 +524,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(255); -const auth_1 = __nccwpck_require__(526); -const core_1 = __nccwpck_require__(186); +const http_client_1 = __nccwpck_require__(6255); +const auth_1 = __nccwpck_require__(5526); +const core_1 = __nccwpck_require__(2186); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -577,7 +592,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 981: +/***/ 2981: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -603,7 +618,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; -const path = __importStar(__nccwpck_require__(17)); +const path = __importStar(__nccwpck_require__(1017)); /** * toPosixPath converts the given path to the posix form. On Windows, \\ will be * replaced with /. @@ -642,7 +657,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 327: +/***/ 1327: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -658,8 +673,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; -const os_1 = __nccwpck_require__(37); -const fs_1 = __nccwpck_require__(147); +const os_1 = __nccwpck_require__(2037); +const fs_1 = __nccwpck_require__(7147); const { access, appendFile, writeFile } = fs_1.promises; exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; @@ -932,7 +947,7 @@ exports.summary = _summary; /***/ }), -/***/ 278: +/***/ 5278: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -979,7 +994,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 514: +/***/ 1514: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1014,8 +1029,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; -const string_decoder_1 = __nccwpck_require__(576); -const tr = __importStar(__nccwpck_require__(159)); +const string_decoder_1 = __nccwpck_require__(1576); +const tr = __importStar(__nccwpck_require__(8159)); /** * Exec a command. * Output will be streamed to the live console. @@ -1089,7 +1104,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 159: +/***/ 8159: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1124,13 +1139,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.argStringToArray = exports.ToolRunner = void 0; -const os = __importStar(__nccwpck_require__(37)); -const events = __importStar(__nccwpck_require__(361)); -const child = __importStar(__nccwpck_require__(81)); -const path = __importStar(__nccwpck_require__(17)); -const io = __importStar(__nccwpck_require__(436)); -const ioUtil = __importStar(__nccwpck_require__(962)); -const timers_1 = __nccwpck_require__(512); +const os = __importStar(__nccwpck_require__(2037)); +const events = __importStar(__nccwpck_require__(2361)); +const child = __importStar(__nccwpck_require__(2081)); +const path = __importStar(__nccwpck_require__(1017)); +const io = __importStar(__nccwpck_require__(9326)); +const ioUtil = __importStar(__nccwpck_require__(277)); +const timers_1 = __nccwpck_require__(9512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -1714,7 +1729,506 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 526: +/***/ 277: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const assert_1 = __nccwpck_require__(9491); +const fs = __nccwpck_require__(7147); +const path = __nccwpck_require__(1017); +_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* () { + try { + yield exports.stat(fsPath); + } + catch (err) { + if (err.code === 'ENOENT') { + return false; + } + throw err; + } + return true; + }); +} +exports.exists = exists; +function isDirectory(fsPath, useStat = false) { + return __awaiter(this, void 0, void 0, function* () { + const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); + return stats.isDirectory(); + }); +} +exports.isDirectory = isDirectory; +/** + * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: + * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). + */ +function isRooted(p) { + p = normalizeSeparators(p); + if (!p) { + throw new Error('isRooted() parameter "p" cannot be empty'); + } + if (exports.IS_WINDOWS) { + return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello + ); // e.g. C: or C:\hello + } + return p.startsWith('/'); +} +exports.isRooted = isRooted; +/** + * Recursively create a directory at `fsPath`. + * + * This implementation is optimistic, meaning it attempts to create the full + * path first, and backs up the path stack from there. + * + * @param fsPath The path to create + * @param maxDepth The maximum recursion depth + * @param depth The current recursion depth + */ +function mkdirP(fsPath, maxDepth = 1000, depth = 1) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(fsPath, 'a path argument must be provided'); + fsPath = path.resolve(fsPath); + if (depth >= maxDepth) + return exports.mkdir(fsPath); + try { + yield exports.mkdir(fsPath); + return; + } + catch (err) { + switch (err.code) { + case 'ENOENT': { + yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1); + yield exports.mkdir(fsPath); + return; + } + default: { + let stats; + try { + stats = yield exports.stat(fsPath); + } + catch (err2) { + throw err; + } + if (!stats.isDirectory()) + throw err; + } + } + } + }); +} +exports.mkdirP = mkdirP; +/** + * Best effort attempt to determine whether a file exists and is executable. + * @param filePath file path to check + * @param extensions additional file extensions to try + * @return if file exists and is executable, returns the file path. otherwise empty string. + */ +function tryGetExecutablePath(filePath, extensions) { + return __awaiter(this, void 0, void 0, function* () { + let stats = undefined; + try { + // test file exists + stats = yield exports.stat(filePath); + } + catch (err) { + if (err.code !== 'ENOENT') { + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports.IS_WINDOWS) { + // on Windows, test for valid extension + const upperExt = path.extname(filePath).toUpperCase(); + if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { + return filePath; + } + } + else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + // try each extension + const originalFilePath = filePath; + for (const extension of extensions) { + filePath = originalFilePath + extension; + stats = undefined; + try { + stats = yield exports.stat(filePath); + } + catch (err) { + if (err.code !== 'ENOENT') { + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports.IS_WINDOWS) { + // preserve the case of the actual file (since an extension was appended) + try { + const directory = path.dirname(filePath); + const upperName = path.basename(filePath).toUpperCase(); + for (const actualName of yield exports.readdir(directory)) { + if (upperName === actualName.toUpperCase()) { + filePath = path.join(directory, actualName); + break; + } + } + } + catch (err) { + // eslint-disable-next-line no-console + console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); + } + return filePath; + } + else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + } + return ''; + }); +} +exports.tryGetExecutablePath = tryGetExecutablePath; +function normalizeSeparators(p) { + p = p || ''; + if (exports.IS_WINDOWS) { + // convert slashes on Windows + p = p.replace(/\//g, '\\'); + // remove redundant slashes + return p.replace(/\\\\+/g, '\\'); + } + // remove redundant slashes + return p.replace(/\/\/+/g, '/'); +} +// on Mac/Linux, test the execute bit +// R W X R W X R W X +// 256 128 64 32 16 8 4 2 1 +function isUnixExecutable(stats) { + return ((stats.mode & 1) > 0 || + ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || + ((stats.mode & 64) > 0 && stats.uid === process.getuid())); +} +//# sourceMappingURL=io-util.js.map + +/***/ }), + +/***/ 9326: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const childProcess = __nccwpck_require__(2081); +const path = __nccwpck_require__(1017); +const util_1 = __nccwpck_require__(3837); +const ioUtil = __nccwpck_require__(277); +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 + * @param options optional. See CopyOptions. + */ +function cp(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + 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; +/** + * Moves a path. + * + * @param source source path + * @param dest destination path + * @param options optional. See MoveOptions. + */ +function mv(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + 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; +/** + * Remove a path recursively with force + * + * @param inputPath path to remove + */ +function rmRF(inputPath) { + return __awaiter(this, void 0, void 0, function* () { + 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. + try { + if (yield ioUtil.isDirectory(inputPath, true)) { + yield exec(`rd /s /q "${inputPath}"`); + } + else { + yield exec(`del /f /a "${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 { + yield 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 = yield 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) { + yield exec(`rm -rf "${inputPath}"`); + } + else { + yield ioUtil.unlink(inputPath); + } + } + }); +} +exports.rmRF = rmRF; +/** + * Make a directory. Creates the full path with folders in between + * Will throw if it fails + * + * @param fsPath path to create + * @returns Promise + */ +function mkdirP(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + yield ioUtil.mkdirP(fsPath); + }); +} +exports.mkdirP = mkdirP; +/** + * Returns path of a tool had the tool actually been invoked. Resolves via paths. + * If you check and the tool does not exist, it will throw. + * + * @param tool name of the tool + * @param check whether to check if tool exists + * @returns Promise path to tool + */ +function which(tool, check) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + // recursive when check=true + if (check) { + const result = yield which(tool, false); + if (!result) { + if (ioUtil.IS_WINDOWS) { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); + } + else { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); + } + } + } + try { + // build the list of extensions to try + const extensions = []; + if (ioUtil.IS_WINDOWS && process.env.PATHEXT) { + for (const extension of process.env.PATHEXT.split(path.delimiter)) { + if (extension) { + extensions.push(extension); + } + } + } + // if it's rooted, return it if exists. otherwise return empty. + if (ioUtil.isRooted(tool)) { + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return filePath; + } + return ''; + } + // if any path separators, return empty + if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) { + return ''; + } + // build the list of directories + // + // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, + // it feels like we should not do this. Checking the current directory seems like more of a use + // case of a shell, and the which() function exposed by the toolkit should strive for consistency + // across platforms. + const directories = []; + if (process.env.PATH) { + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); + } + } + } + // return the first match + for (const directory of directories) { + const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); + if (filePath) { + return filePath; + } + } + return ''; + } + catch (err) { + throw new Error(`which failed with message ${err.message}`); + } + }); +} +exports.which = which; +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 + +/***/ }), + +/***/ 5526: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -1802,7 +2316,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 255: +/***/ 6255: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1838,10 +2352,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(__nccwpck_require__(685)); -const https = __importStar(__nccwpck_require__(687)); -const pm = __importStar(__nccwpck_require__(835)); -const tunnel = __importStar(__nccwpck_require__(294)); +const http = __importStar(__nccwpck_require__(3685)); +const https = __importStar(__nccwpck_require__(5687)); +const pm = __importStar(__nccwpck_require__(9835)); +const tunnel = __importStar(__nccwpck_require__(4294)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -2414,7 +2928,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 835: +/***/ 9835: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -2482,7 +2996,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 962: +/***/ 1962: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2518,8 +3032,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); 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; -const fs = __importStar(__nccwpck_require__(147)); -const path = __importStar(__nccwpck_require__(17)); +const fs = __importStar(__nccwpck_require__(7147)); +const path = __importStar(__nccwpck_require__(1017)); _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) { @@ -2666,7 +3180,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 436: +/***/ 7436: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2701,11 +3215,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; -const assert_1 = __nccwpck_require__(491); -const childProcess = __importStar(__nccwpck_require__(81)); -const path = __importStar(__nccwpck_require__(17)); -const util_1 = __nccwpck_require__(837); -const ioUtil = __importStar(__nccwpck_require__(962)); +const assert_1 = __nccwpck_require__(9491); +const childProcess = __importStar(__nccwpck_require__(2081)); +const path = __importStar(__nccwpck_require__(1017)); +const util_1 = __nccwpck_require__(3837); +const ioUtil = __importStar(__nccwpck_require__(1962)); const exec = util_1.promisify(childProcess.exec); const execFile = util_1.promisify(childProcess.execFile); /** @@ -3249,7 +3763,7 @@ module.exports = { /***/ }), -/***/ 976: +/***/ 9976: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -3283,7 +3797,7 @@ module.exports = { * @return {String} Sanitized filename */ -var truncate = __nccwpck_require__(699); +var truncate = __nccwpck_require__(9699); var illegalRe = /[\/\?<>\\:\*\|"]/g; var controlRe = /[\x00-\x1f\x80-\x9f]/g; @@ -3316,20 +3830,20 @@ module.exports = function (input, options) { /***/ }), -/***/ 699: +/***/ 9699: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var truncate = __nccwpck_require__(758); +var truncate = __nccwpck_require__(6758); var getLength = Buffer.byteLength.bind(Buffer); module.exports = truncate.bind(null, getLength); /***/ }), -/***/ 758: +/***/ 6758: /***/ ((module) => { "use strict"; @@ -3380,27 +3894,27 @@ module.exports = function truncate(getLength, string, byteLength) { /***/ }), -/***/ 294: +/***/ 4294: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(219); +module.exports = __nccwpck_require__(4219); /***/ }), -/***/ 219: +/***/ 4219: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var net = __nccwpck_require__(808); -var tls = __nccwpck_require__(404); -var http = __nccwpck_require__(685); -var https = __nccwpck_require__(687); -var events = __nccwpck_require__(361); -var assert = __nccwpck_require__(491); -var util = __nccwpck_require__(837); +var net = __nccwpck_require__(1808); +var tls = __nccwpck_require__(4404); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var events = __nccwpck_require__(2361); +var assert = __nccwpck_require__(9491); +var util = __nccwpck_require__(3837); exports.httpOverHttp = httpOverHttp; @@ -3660,7 +4174,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 840: +/***/ 5840: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3724,29 +4238,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(628)); +var _v = _interopRequireDefault(__nccwpck_require__(8628)); -var _v2 = _interopRequireDefault(__nccwpck_require__(409)); +var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); -var _v3 = _interopRequireDefault(__nccwpck_require__(122)); +var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); -var _v4 = _interopRequireDefault(__nccwpck_require__(120)); +var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); -var _nil = _interopRequireDefault(__nccwpck_require__(332)); +var _nil = _interopRequireDefault(__nccwpck_require__(5332)); -var _version = _interopRequireDefault(__nccwpck_require__(595)); +var _version = _interopRequireDefault(__nccwpck_require__(1595)); -var _validate = _interopRequireDefault(__nccwpck_require__(900)); +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); -var _stringify = _interopRequireDefault(__nccwpck_require__(950)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); -var _parse = _interopRequireDefault(__nccwpck_require__(746)); +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 569: +/***/ 4569: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3757,7 +4271,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _crypto = _interopRequireDefault(__nccwpck_require__(113)); +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3776,7 +4290,7 @@ exports["default"] = _default; /***/ }), -/***/ 332: +/***/ 5332: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -3791,7 +4305,7 @@ exports["default"] = _default; /***/ }), -/***/ 746: +/***/ 2746: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3802,7 +4316,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(900)); +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3869,7 +4383,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = rng; -var _crypto = _interopRequireDefault(__nccwpck_require__(113)); +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3889,7 +4403,7 @@ function rng() { /***/ }), -/***/ 274: +/***/ 5274: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3900,7 +4414,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _crypto = _interopRequireDefault(__nccwpck_require__(113)); +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3919,7 +4433,7 @@ exports["default"] = _default; /***/ }), -/***/ 950: +/***/ 8950: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3930,7 +4444,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(900)); +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3965,7 +4479,7 @@ exports["default"] = _default; /***/ }), -/***/ 628: +/***/ 8628: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3978,7 +4492,7 @@ exports["default"] = void 0; var _rng = _interopRequireDefault(__nccwpck_require__(807)); -var _stringify = _interopRequireDefault(__nccwpck_require__(950)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4079,7 +4593,7 @@ exports["default"] = _default; /***/ }), -/***/ 409: +/***/ 6409: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4090,9 +4604,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(998)); +var _v = _interopRequireDefault(__nccwpck_require__(5998)); -var _md = _interopRequireDefault(__nccwpck_require__(569)); +var _md = _interopRequireDefault(__nccwpck_require__(4569)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4102,7 +4616,7 @@ exports["default"] = _default; /***/ }), -/***/ 998: +/***/ 5998: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4114,9 +4628,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(950)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); -var _parse = _interopRequireDefault(__nccwpck_require__(746)); +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4187,7 +4701,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 122: +/***/ 5122: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4200,7 +4714,7 @@ exports["default"] = void 0; var _rng = _interopRequireDefault(__nccwpck_require__(807)); -var _stringify = _interopRequireDefault(__nccwpck_require__(950)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4231,7 +4745,7 @@ exports["default"] = _default; /***/ }), -/***/ 120: +/***/ 9120: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4242,9 +4756,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(998)); +var _v = _interopRequireDefault(__nccwpck_require__(5998)); -var _sha = _interopRequireDefault(__nccwpck_require__(274)); +var _sha = _interopRequireDefault(__nccwpck_require__(5274)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4254,7 +4768,7 @@ exports["default"] = _default; /***/ }), -/***/ 900: +/***/ 6900: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4278,7 +4792,7 @@ exports["default"] = _default; /***/ }), -/***/ 595: +/***/ 1595: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4289,7 +4803,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(900)); +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -4306,7 +4820,7 @@ exports["default"] = _default; /***/ }), -/***/ 491: +/***/ 9491: /***/ ((module) => { "use strict"; @@ -4314,7 +4828,7 @@ module.exports = require("assert"); /***/ }), -/***/ 81: +/***/ 2081: /***/ ((module) => { "use strict"; @@ -4322,7 +4836,7 @@ module.exports = require("child_process"); /***/ }), -/***/ 113: +/***/ 6113: /***/ ((module) => { "use strict"; @@ -4330,7 +4844,7 @@ module.exports = require("crypto"); /***/ }), -/***/ 361: +/***/ 2361: /***/ ((module) => { "use strict"; @@ -4338,7 +4852,7 @@ module.exports = require("events"); /***/ }), -/***/ 147: +/***/ 7147: /***/ ((module) => { "use strict"; @@ -4346,7 +4860,7 @@ module.exports = require("fs"); /***/ }), -/***/ 685: +/***/ 3685: /***/ ((module) => { "use strict"; @@ -4354,7 +4868,7 @@ module.exports = require("http"); /***/ }), -/***/ 687: +/***/ 5687: /***/ ((module) => { "use strict"; @@ -4362,7 +4876,7 @@ module.exports = require("https"); /***/ }), -/***/ 808: +/***/ 1808: /***/ ((module) => { "use strict"; @@ -4370,7 +4884,7 @@ module.exports = require("net"); /***/ }), -/***/ 37: +/***/ 2037: /***/ ((module) => { "use strict"; @@ -4378,7 +4892,7 @@ module.exports = require("os"); /***/ }), -/***/ 17: +/***/ 1017: /***/ ((module) => { "use strict"; @@ -4386,7 +4900,7 @@ module.exports = require("path"); /***/ }), -/***/ 576: +/***/ 1576: /***/ ((module) => { "use strict"; @@ -4394,7 +4908,7 @@ module.exports = require("string_decoder"); /***/ }), -/***/ 512: +/***/ 9512: /***/ ((module) => { "use strict"; @@ -4402,7 +4916,7 @@ module.exports = require("timers"); /***/ }), -/***/ 404: +/***/ 4404: /***/ ((module) => { "use strict"; @@ -4410,7 +4924,7 @@ module.exports = require("tls"); /***/ }), -/***/ 837: +/***/ 3837: /***/ ((module) => { "use strict"; @@ -4504,23 +5018,23 @@ var __webpack_exports__ = {}; __nccwpck_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js -var core = __nccwpck_require__(186); +var core = __nccwpck_require__(2186); // EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js -var exec = __nccwpck_require__(514); +var exec = __nccwpck_require__(1514); // EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js -var io = __nccwpck_require__(436); +var io = __nccwpck_require__(7436); // EXTERNAL MODULE: external "path" -var external_path_ = __nccwpck_require__(17); +var external_path_ = __nccwpck_require__(1017); var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_); // EXTERNAL MODULE: external "fs" -var external_fs_ = __nccwpck_require__(147); +var external_fs_ = __nccwpck_require__(7147); // EXTERNAL MODULE: ./node_modules/ini/lib/ini.js var ini = __nccwpck_require__(45); // EXTERNAL MODULE: ./node_modules/sanitize-filename/index.js -var sanitize_filename = __nccwpck_require__(976); +var sanitize_filename = __nccwpck_require__(9976); var sanitize_filename_default = /*#__PURE__*/__nccwpck_require__.n(sanitize_filename); // EXTERNAL MODULE: external "os" -var external_os_ = __nccwpck_require__(37); +var external_os_ = __nccwpck_require__(2037); ;// CONCATENATED MODULE: ./src/constants.ts @@ -4557,6 +5071,7 @@ const GODOT_PROJECT_FILE_PATH = external_path_default().join(GODOT_PROJECT_PATH, const GODOT_EXECUTABLE = 'godot_executable'; const GODOT_ZIP = 'godot.zip'; const GODOT_TEMPLATES_FILENAME = 'godot_templates.tpz'; +const EDITOR_SETTINGS_FILENAME = USE_GODOT_4 ? 'editor_settings-4.tres' : 'editor_settings-3.tres'; async function exportBuilds() { if (!hasExportPresets()) { core.setFailed('No export_presets.cfg found. Please ensure you have defined at least one export via the Godot editor.'); @@ -4703,8 +5218,7 @@ function configureWindowsExport() { const rceditPath = external_path_.join(__dirname, 'rcedit-x64.exe'); core.info(`Writing rcedit path to editor settings ${rceditPath}`); core.info(`Writing wine path to editor settings ${WINE_PATH}`); - const editorSettings = 'editor_settings-3.tres'; - const editorSettingsPath = external_path_.join(GODOT_CONFIG_PATH, editorSettings); + const editorSettingsPath = external_path_.join(GODOT_CONFIG_PATH, EDITOR_SETTINGS_FILENAME); external_fs_.writeFileSync(editorSettingsPath, `export/windows/rcedit = "${rceditPath}"\n`, { flag: 'a' }); external_fs_.writeFileSync(editorSettingsPath, `export/windows/wine = "${WINE_PATH}"\n`, { flag: 'a' }); // TODO: remove this @@ -4750,10 +5264,9 @@ function getExportPresets() { return exportPrests; } async function addEditorSettings() { - const editorSettings = 'editor_settings-3.tres'; - const editorSettingsDist = external_path_.join(__dirname, editorSettings); + const editorSettingsDist = external_path_.join(__dirname, EDITOR_SETTINGS_FILENAME); await io.mkdirP(GODOT_CONFIG_PATH); - const editorSettingsPath = external_path_.join(GODOT_CONFIG_PATH, editorSettings); + const editorSettingsPath = external_path_.join(GODOT_CONFIG_PATH, EDITOR_SETTINGS_FILENAME); await io.cp(editorSettingsDist, editorSettingsPath, { force: false }); core.info(`Wrote editor settings to ${editorSettingsPath}`); } diff --git a/package.json b/package.json index a07fc58a..6bdd5554 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "homepage": "https://github.com/firebelley/godot-export#readme", "dependencies": { - "@actions/core": "^1.9.1", + "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.2", "ini": "^3.0.0", diff --git a/src/godot.ts b/src/godot.ts index 63b1d8f2..25981a7f 100644 --- a/src/godot.ts +++ b/src/godot.ts @@ -24,6 +24,7 @@ import { const GODOT_EXECUTABLE = 'godot_executable'; const GODOT_ZIP = 'godot.zip'; const GODOT_TEMPLATES_FILENAME = 'godot_templates.tpz'; +const EDITOR_SETTINGS_FILENAME = USE_GODOT_4 ? 'editor_settings-4.tres' : 'editor_settings-3.tres'; async function exportBuilds(): Promise { if (!hasExportPresets()) { @@ -200,8 +201,7 @@ function configureWindowsExport(): void { core.info(`Writing rcedit path to editor settings ${rceditPath}`); core.info(`Writing wine path to editor settings ${WINE_PATH}`); - const editorSettings = 'editor_settings-3.tres'; - const editorSettingsPath = path.join(GODOT_CONFIG_PATH, editorSettings); + const editorSettingsPath = path.join(GODOT_CONFIG_PATH, EDITOR_SETTINGS_FILENAME); fs.writeFileSync(editorSettingsPath, `export/windows/rcedit = "${rceditPath}"\n`, { flag: 'a' }); fs.writeFileSync(editorSettingsPath, `export/windows/wine = "${WINE_PATH}"\n`, { flag: 'a' }); @@ -253,11 +253,10 @@ function getExportPresets(): ExportPreset[] { } async function addEditorSettings(): Promise { - const editorSettings = 'editor_settings-3.tres'; - const editorSettingsDist = path.join(__dirname, editorSettings); + const editorSettingsDist = path.join(__dirname, EDITOR_SETTINGS_FILENAME); await io.mkdirP(GODOT_CONFIG_PATH); - const editorSettingsPath = path.join(GODOT_CONFIG_PATH, editorSettings); + const editorSettingsPath = path.join(GODOT_CONFIG_PATH, EDITOR_SETTINGS_FILENAME); await io.cp(editorSettingsDist, editorSettingsPath, { force: false }); core.info(`Wrote editor settings to ${editorSettingsPath}`); } diff --git a/yarn.lock b/yarn.lock index 1e6309a6..2dbb8fb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@actions/core@^1.9.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.9.1.tgz#97c0201b1f9856df4f7c3a375cdcdb0c2a2f750b" - integrity sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA== +"@actions/core@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" + integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== dependencies: "@actions/http-client" "^2.0.1" uuid "^8.3.2"