Bump ES version to 2021

This commit is contained in:
Shivam Mathur 2022-05-30 07:27:29 +05:30
parent b88a8c89d1
commit 43fb4ad30e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,7 @@
{ {
"env": { "node": true, "jest": true }, "env": { "node": true, "jest": true },
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 2019, "sourceType": "module" }, "parserOptions": { "ecmaVersion": 2021, "sourceType": "module" },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/eslint-recommended",

14
dist/index.js vendored
View File

@ -618,13 +618,12 @@ const fs_1 = __importDefault(__nccwpck_require__(147));
const fetch = __importStar(__nccwpck_require__(387)); const fetch = __importStar(__nccwpck_require__(387));
const utils = __importStar(__nccwpck_require__(918)); const utils = __importStar(__nccwpck_require__(918));
async function getSemverVersion(data) { async function getSemverVersion(data) {
var _a;
const search = data['version_prefix'] + data['version']; const search = data['version_prefix'] + data['version'];
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`; const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
const token = await utils.readEnv('COMPOSER_TOKEN'); const token = await utils.readEnv('COMPOSER_TOKEN');
const response = await fetch.fetch(url, token); const response = await fetch.fetch(url, token);
if (response.error || response.data === '[]') { if (response.error || response.data === '[]') {
data['error'] = (_a = response.error) !== null && _a !== void 0 ? _a : `No version found with prefix ${search}.`; data['error'] = response.error ?? `No version found with prefix ${search}.`;
return data['version']; return data['version'];
} }
else { else {
@ -874,7 +873,6 @@ async function addWPCLI(data) {
} }
exports.addWPCLI = addWPCLI; exports.addWPCLI = addWPCLI;
async function getData(release, php_version, os) { async function getData(release, php_version, os) {
var _a, _b, _c, _d, _e;
const json_file_path = path_1.default.join(__dirname, '../src/configs/tools.json'); const json_file_path = path_1.default.join(__dirname, '../src/configs/tools.json');
const json_file = fs_1.default.readFileSync(json_file_path, 'utf8'); const json_file = fs_1.default.readFileSync(json_file_path, 'utf8');
const json_objects = JSON.parse(json_file); const json_objects = JSON.parse(json_file);
@ -905,16 +903,16 @@ async function getData(release, php_version, os) {
} }
} }
data['github'] = 'https://github.com'; data['github'] = 'https://github.com';
(_a = data['domain']) !== null && _a !== void 0 ? _a : (data['domain'] = data['github']); data['domain'] ??= data['github'];
(_b = data['extension']) !== null && _b !== void 0 ? _b : (data['extension'] = '.phar'); data['extension'] ??= '.phar';
data['os'] = os; data['os'] = os;
data['php_version'] = php_version; data['php_version'] = php_version;
data['prefix'] = data['github'] === data['domain'] ? 'releases' : ''; data['prefix'] = data['github'] === data['domain'] ? 'releases' : '';
data['verb'] = data['github'] === data['domain'] ? 'download' : ''; data['verb'] = data['github'] === data['domain'] ? 'download' : '';
(_c = data['fetch_latest']) !== null && _c !== void 0 ? _c : (data['fetch_latest'] = 'false'); data['fetch_latest'] ??= 'false';
(_d = data['scope']) !== null && _d !== void 0 ? _d : (data['scope'] = 'global'); data['scope'] ??= 'global';
data['version_parameter'] = JSON.stringify(data['version_parameter']) || ''; data['version_parameter'] = JSON.stringify(data['version_parameter']) || '';
(_e = data['version_prefix']) !== null && _e !== void 0 ? _e : (data['version_prefix'] = ''); data['version_prefix'] ??= '';
data['release'] = await getRelease(release, data); data['release'] = await getRelease(release, data);
data['version'] = version data['version'] = version
? await getVersion(version, data) ? await getVersion(version, data)

View File

@ -3,7 +3,7 @@
"declaration": true, "declaration": true,
"esModuleInterop": true, "esModuleInterop": true,
"lib": [ "lib": [
"ES2020" "ES2021"
], ],
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
@ -13,7 +13,7 @@
"rootDir": "./src", "rootDir": "./src",
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"target": "ES2019" "target": "ES2021"
}, },
"exclude": ["__tests__", "lib", "node_modules"] "exclude": ["__tests__", "lib", "node_modules"]
} }