-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37975 from kubabutkiewicz/ts-migration/G18
[TS migration] Migrate 'sanitizeStringForJSONParse.js', 'promiseWhile.js', 'CONST.js', 'versionUpdater.js', 'ActionUtils.js' .github file to TypeScript
- Loading branch information
Showing
29 changed files
with
1,104 additions
and
7,856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16846,9 +16846,12 @@ exports["default"] = newComponentCategory; | |
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
const CONST = { | ||
const GIT_CONST = { | ||
GITHUB_OWNER: 'Expensify', | ||
APP_REPO: 'App', | ||
}; | ||
const CONST = { | ||
...GIT_CONST, | ||
APPLAUSE_BOT: 'applausebot', | ||
OS_BOTIFY: 'OSBotify', | ||
LABELS: { | ||
|
@@ -16857,11 +16860,9 @@ const CONST = { | |
INTERNAL_QA: 'InternalQA', | ||
}, | ||
DATE_FORMAT_STRING: 'yyyy-MM-dd', | ||
APP_REPO_URL: '', | ||
APP_REPO_GIT_URL: '', | ||
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`, | ||
APP_REPO_GIT_URL: `[email protected]:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`, | ||
}; | ||
CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`; | ||
CONST.APP_REPO_GIT_URL = `[email protected]:${CONST.GITHUB_OWNER}/${CONST.APP_REPO}.git`; | ||
exports["default"] = CONST; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,108 +4,6 @@ | |
/******/ (() => { // webpackBootstrap | ||
/******/ var __webpack_modules__ = ({ | ||
|
||
/***/ 970: | ||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { | ||
|
||
const core = __nccwpck_require__(2186); | ||
|
||
/** | ||
* Safely parse a JSON input to a GitHub Action. | ||
* | ||
* @param {String} name - The name of the input. | ||
* @param {Object} options - Options to pass to core.getInput | ||
* @param {*} [defaultValue] - A default value to provide for the input. | ||
* Not required if the {required: true} option is given in the second arg to this function. | ||
* @returns {any} | ||
*/ | ||
function getJSONInput(name, options, defaultValue = undefined) { | ||
const input = core.getInput(name, options); | ||
if (input) { | ||
return JSON.parse(input); | ||
} | ||
return defaultValue; | ||
} | ||
|
||
/** | ||
* Safely access a string input to a GitHub Action, or fall back on a default if the string is empty. | ||
* | ||
* @param {String} name | ||
* @param {Object} options | ||
* @param {*} [defaultValue] | ||
* @returns {string|undefined} | ||
*/ | ||
function getStringInput(name, options, defaultValue = undefined) { | ||
const input = core.getInput(name, options); | ||
if (!input) { | ||
return defaultValue; | ||
} | ||
return input; | ||
} | ||
|
||
module.exports = { | ||
getJSONInput, | ||
getStringInput, | ||
}; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 4502: | ||
/***/ ((module) => { | ||
|
||
/** | ||
* Simulates a while loop where the condition is determined by the result of a Promise. | ||
* | ||
* @param {Function} condition | ||
* @param {Function} action | ||
* @returns {Promise} | ||
*/ | ||
function promiseWhile(condition, action) { | ||
console.info('[promiseWhile] promiseWhile()'); | ||
|
||
return new Promise((resolve, reject) => { | ||
const loop = function () { | ||
if (!condition()) { | ||
resolve(); | ||
} else { | ||
const actionResult = action(); | ||
console.info('[promiseWhile] promiseWhile() actionResult', actionResult); | ||
Promise.resolve(actionResult).then(loop).catch(reject); | ||
} | ||
}; | ||
loop(); | ||
}); | ||
} | ||
|
||
/** | ||
* Simulates a do-while loop where the condition is determined by the result of a Promise. | ||
* | ||
* @param {Function} condition | ||
* @param {Function} action | ||
* @returns {Promise} | ||
*/ | ||
function promiseDoWhile(condition, action) { | ||
console.info('[promiseWhile] promiseDoWhile()'); | ||
|
||
return new Promise((resolve, reject) => { | ||
console.info('[promiseWhile] promiseDoWhile() condition', condition); | ||
const actionResult = action(); | ||
console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); | ||
actionResult | ||
.then(() => promiseWhile(condition, action)) | ||
.then(() => resolve()) | ||
.catch(reject); | ||
}); | ||
} | ||
|
||
module.exports = { | ||
promiseWhile, | ||
promiseDoWhile, | ||
}; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 7351: | ||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
|
||
|
@@ -12251,16 +12149,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | |
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const throttle_1 = __importDefault(__nccwpck_require__(2891)); | ||
const ActionUtils_1 = __importDefault(__nccwpck_require__(970)); | ||
const ActionUtils_1 = __nccwpck_require__(6981); | ||
const CONST_1 = __importDefault(__nccwpck_require__(9873)); | ||
const GithubUtils_1 = __importStar(__nccwpck_require__(9296)); | ||
const promiseWhile_1 = __nccwpck_require__(4502); | ||
const promiseWhile_1 = __nccwpck_require__(9438); | ||
function run() { | ||
console.info('[awaitStagingDeploys] run()'); | ||
console.info('[awaitStagingDeploys] ActionUtils', ActionUtils_1.default); | ||
console.info('[awaitStagingDeploys] getStringInput', ActionUtils_1.getStringInput); | ||
console.info('[awaitStagingDeploys] GitHubUtils', GithubUtils_1.default); | ||
console.info('[awaitStagingDeploys] promiseDoWhile', promiseWhile_1.promiseDoWhile); | ||
const tag = ActionUtils_1.default.getStringInput('TAG', { required: false }); | ||
const tag = (0, ActionUtils_1.getStringInput)('TAG', { required: false }); | ||
console.info('[awaitStagingDeploys] run() tag', tag); | ||
let currentStagingDeploys = []; | ||
console.info('[awaitStagingDeploys] run() _.throttle', throttle_1.default); | ||
|
@@ -12304,6 +12202,68 @@ if (require.main === require.cache[eval('__filename')]) { | |
exports["default"] = run; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 6981: | ||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||
|
||
"use strict"; | ||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
exports.getStringInput = exports.getJSONInput = void 0; | ||
const core = __importStar(__nccwpck_require__(2186)); | ||
/** | ||
* Safely parse a JSON input to a GitHub Action. | ||
* | ||
* @param name - The name of the input. | ||
* @param options - Options to pass to core.getInput | ||
* @param [defaultValue] - A default value to provide for the input. | ||
* Not required if the {required: true} option is given in the second arg to this function. | ||
*/ | ||
function getJSONInput(name, options, defaultValue) { | ||
const input = core.getInput(name, options); | ||
if (input) { | ||
return JSON.parse(input); | ||
} | ||
return defaultValue; | ||
} | ||
exports.getJSONInput = getJSONInput; | ||
/** | ||
* Safely access a string input to a GitHub Action, or fall back on a default if the string is empty. | ||
*/ | ||
function getStringInput(name, options, defaultValue) { | ||
const input = core.getInput(name, options); | ||
if (!input) { | ||
return defaultValue; | ||
} | ||
return input; | ||
} | ||
exports.getStringInput = getStringInput; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 9873: | ||
|
@@ -12312,9 +12272,12 @@ exports["default"] = run; | |
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
const CONST = { | ||
const GIT_CONST = { | ||
GITHUB_OWNER: 'Expensify', | ||
APP_REPO: 'App', | ||
}; | ||
const CONST = { | ||
...GIT_CONST, | ||
APPLAUSE_BOT: 'applausebot', | ||
OS_BOTIFY: 'OSBotify', | ||
LABELS: { | ||
|
@@ -12323,11 +12286,9 @@ const CONST = { | |
INTERNAL_QA: 'InternalQA', | ||
}, | ||
DATE_FORMAT_STRING: 'yyyy-MM-dd', | ||
APP_REPO_URL: '', | ||
APP_REPO_GIT_URL: '', | ||
APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`, | ||
APP_REPO_GIT_URL: `[email protected]:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`, | ||
}; | ||
CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`; | ||
CONST.APP_REPO_GIT_URL = `[email protected]:${CONST.GITHUB_OWNER}/${CONST.APP_REPO}.git`; | ||
exports["default"] = CONST; | ||
|
||
|
||
|
@@ -12784,6 +12745,53 @@ exports["default"] = GithubUtils; | |
module.exports = GithubUtils; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 9438: | ||
/***/ ((__unused_webpack_module, exports) => { | ||
|
||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
exports.promiseDoWhile = exports.promiseWhile = void 0; | ||
/** | ||
* Simulates a while loop where the condition is determined by the result of a Promise. | ||
*/ | ||
function promiseWhile(condition, action) { | ||
console.info('[promiseWhile] promiseWhile()'); | ||
return new Promise((resolve, reject) => { | ||
const loop = function () { | ||
if (!condition()) { | ||
resolve(); | ||
} | ||
else { | ||
const actionResult = action?.(); | ||
console.info('[promiseWhile] promiseWhile() actionResult', actionResult); | ||
Promise.resolve(actionResult).then(loop).catch(reject); | ||
} | ||
}; | ||
loop(); | ||
}); | ||
} | ||
exports.promiseWhile = promiseWhile; | ||
/** | ||
* Simulates a do-while loop where the condition is determined by the result of a Promise. | ||
*/ | ||
function promiseDoWhile(condition, action) { | ||
console.info('[promiseWhile] promiseDoWhile()'); | ||
return new Promise((resolve, reject) => { | ||
console.info('[promiseWhile] promiseDoWhile() condition', condition); | ||
const actionResult = action?.(); | ||
console.info('[promiseWhile] promiseDoWhile() actionResult', actionResult); | ||
actionResult | ||
?.then(() => promiseWhile(condition, action)) | ||
.then(() => resolve()) | ||
.catch(reject); | ||
}); | ||
} | ||
exports.promiseDoWhile = promiseDoWhile; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 8227: | ||
|
Oops, something went wrong.