use more modern node/ts (#46)
This commit is contained in:
parent
d3b6ed3fdf
commit
ed9c9d25e0
5 changed files with 59 additions and 68 deletions
99
dist/index.js
generated
vendored
99
dist/index.js
generated
vendored
|
@ -29,15 +29,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
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 }));
|
||||
exports.run = void 0;
|
||||
const core = __importStar(__nccwpck_require__(186));
|
||||
|
@ -45,49 +36,43 @@ const exec = __importStar(__nccwpck_require__(514));
|
|||
const fs = __importStar(__nccwpck_require__(147));
|
||||
const os = __importStar(__nccwpck_require__(37));
|
||||
const path = __importStar(__nccwpck_require__(17));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield setupRTX();
|
||||
yield exec.exec('rtx', ['--version']);
|
||||
if (yield setToolVersions()) {
|
||||
yield exec.exec('rtx', ['install']);
|
||||
}
|
||||
yield setPaths();
|
||||
});
|
||||
async function run() {
|
||||
await setupRTX();
|
||||
await exec.exec('rtx', ['--version']);
|
||||
if (await setToolVersions()) {
|
||||
await exec.exec('rtx', ['install']);
|
||||
}
|
||||
await setPaths();
|
||||
}
|
||||
exports.run = run;
|
||||
function setupRTX() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const rtxBinDir = path.join(os.homedir(), '.local/share/rtx/bin');
|
||||
const platform = `${getOS()}-${os.arch()}`;
|
||||
yield fs.promises.mkdir(rtxBinDir, { recursive: true });
|
||||
yield exec.exec('gh', [
|
||||
'release',
|
||||
'download',
|
||||
'--clobber',
|
||||
'--pattern',
|
||||
`*${platform}`,
|
||||
'--repo',
|
||||
'jdxcode/rtx',
|
||||
'--output',
|
||||
path.join(rtxBinDir, 'rtx')
|
||||
]);
|
||||
yield exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')]);
|
||||
core.addPath(rtxBinDir);
|
||||
});
|
||||
async function setupRTX() {
|
||||
const rtxBinDir = path.join(os.homedir(), '.local/share/rtx/bin');
|
||||
const platform = `${getOS()}-${os.arch()}`;
|
||||
await fs.promises.mkdir(rtxBinDir, { recursive: true });
|
||||
await exec.exec('gh', [
|
||||
'release',
|
||||
'download',
|
||||
'--clobber',
|
||||
'--pattern',
|
||||
`*${platform}`,
|
||||
'--repo',
|
||||
'jdxcode/rtx',
|
||||
'--output',
|
||||
path.join(rtxBinDir, 'rtx')
|
||||
]);
|
||||
await exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')]);
|
||||
core.addPath(rtxBinDir);
|
||||
}
|
||||
// returns true if tool_versions was set
|
||||
function setToolVersions() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const toolVersions = core.getInput('tool_versions', { required: false });
|
||||
if (toolVersions) {
|
||||
yield fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
async function setToolVersions() {
|
||||
const toolVersions = core.getInput('tool_versions', { required: false });
|
||||
if (toolVersions) {
|
||||
await fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getOS() {
|
||||
switch (process.platform) {
|
||||
|
@ -97,18 +82,14 @@ function getOS() {
|
|||
return process.platform;
|
||||
}
|
||||
}
|
||||
function setPaths() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
for (const binPath of yield getBinPaths()) {
|
||||
core.addPath(binPath);
|
||||
}
|
||||
});
|
||||
async function setPaths() {
|
||||
for (const binPath of await getBinPaths()) {
|
||||
core.addPath(binPath);
|
||||
}
|
||||
}
|
||||
function getBinPaths() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const output = yield exec.getExecOutput('rtx', ['bin-paths']);
|
||||
return output.stdout.split('\n');
|
||||
});
|
||||
async function getBinPaths() {
|
||||
const output = await exec.getExecOutput('rtx', ['bin-paths']);
|
||||
return output.stdout.split('\n');
|
||||
}
|
||||
if (require.main === require.cache[eval('__filename')]) {
|
||||
try {
|
||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -13,6 +13,7 @@
|
|||
"@actions/exec": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node16": "^1.0.3",
|
||||
"@types/node": "^18.15.3",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
|
@ -1292,6 +1293,12 @@
|
|||
"@sinonjs/commons": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/babel__core": {
|
||||
"version": "7.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
||||
|
@ -7426,6 +7433,12 @@
|
|||
"@sinonjs/commons": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/babel__core": {
|
||||
"version": "7.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
||||
|
|
|
@ -30,17 +30,18 @@
|
|||
"@actions/exec": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node16": "^1.0.3",
|
||||
"@types/node": "^18.15.3",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-plugin-github": "^4.6.1",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"husky": "^8.0.3",
|
||||
"jest": "^29.5.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.8.5",
|
||||
"ts-jest": "^29.0.5",
|
||||
"typescript": "^5.0.2",
|
||||
"husky": "^8.0.3"
|
||||
"typescript": "^5.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
{
|
||||
"extends": "@tsconfig/node16/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue