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);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
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 }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.run = void 0;
|
exports.run = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(186));
|
const core = __importStar(__nccwpck_require__(186));
|
||||||
|
@ -45,49 +36,43 @@ const exec = __importStar(__nccwpck_require__(514));
|
||||||
const fs = __importStar(__nccwpck_require__(147));
|
const fs = __importStar(__nccwpck_require__(147));
|
||||||
const os = __importStar(__nccwpck_require__(37));
|
const os = __importStar(__nccwpck_require__(37));
|
||||||
const path = __importStar(__nccwpck_require__(17));
|
const path = __importStar(__nccwpck_require__(17));
|
||||||
function run() {
|
async function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
await setupRTX();
|
||||||
yield setupRTX();
|
await exec.exec('rtx', ['--version']);
|
||||||
yield exec.exec('rtx', ['--version']);
|
if (await setToolVersions()) {
|
||||||
if (yield setToolVersions()) {
|
await exec.exec('rtx', ['install']);
|
||||||
yield exec.exec('rtx', ['install']);
|
}
|
||||||
}
|
await setPaths();
|
||||||
yield setPaths();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
function setupRTX() {
|
async function setupRTX() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const rtxBinDir = path.join(os.homedir(), '.local/share/rtx/bin');
|
||||||
const rtxBinDir = path.join(os.homedir(), '.local/share/rtx/bin');
|
const platform = `${getOS()}-${os.arch()}`;
|
||||||
const platform = `${getOS()}-${os.arch()}`;
|
await fs.promises.mkdir(rtxBinDir, { recursive: true });
|
||||||
yield fs.promises.mkdir(rtxBinDir, { recursive: true });
|
await exec.exec('gh', [
|
||||||
yield exec.exec('gh', [
|
'release',
|
||||||
'release',
|
'download',
|
||||||
'download',
|
'--clobber',
|
||||||
'--clobber',
|
'--pattern',
|
||||||
'--pattern',
|
`*${platform}`,
|
||||||
`*${platform}`,
|
'--repo',
|
||||||
'--repo',
|
'jdxcode/rtx',
|
||||||
'jdxcode/rtx',
|
'--output',
|
||||||
'--output',
|
path.join(rtxBinDir, 'rtx')
|
||||||
path.join(rtxBinDir, 'rtx')
|
]);
|
||||||
]);
|
await exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')]);
|
||||||
yield exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')]);
|
core.addPath(rtxBinDir);
|
||||||
core.addPath(rtxBinDir);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// returns true if tool_versions was set
|
// returns true if tool_versions was set
|
||||||
function setToolVersions() {
|
async function setToolVersions() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const toolVersions = core.getInput('tool_versions', { required: false });
|
||||||
const toolVersions = core.getInput('tool_versions', { required: false });
|
if (toolVersions) {
|
||||||
if (toolVersions) {
|
await fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||||
yield fs.promises.writeFile('.tool-versions', toolVersions, {
|
encoding: 'utf8'
|
||||||
encoding: 'utf8'
|
});
|
||||||
});
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function getOS() {
|
function getOS() {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
|
@ -97,18 +82,14 @@ function getOS() {
|
||||||
return process.platform;
|
return process.platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function setPaths() {
|
async function setPaths() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
for (const binPath of await getBinPaths()) {
|
||||||
for (const binPath of yield getBinPaths()) {
|
core.addPath(binPath);
|
||||||
core.addPath(binPath);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function getBinPaths() {
|
async function getBinPaths() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const output = await exec.getExecOutput('rtx', ['bin-paths']);
|
||||||
const output = yield exec.getExecOutput('rtx', ['bin-paths']);
|
return output.stdout.split('\n');
|
||||||
return output.stdout.split('\n');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (require.main === require.cache[eval('__filename')]) {
|
if (require.main === require.cache[eval('__filename')]) {
|
||||||
try {
|
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"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tsconfig/node16": "^1.0.3",
|
||||||
"@types/node": "^18.15.3",
|
"@types/node": "^18.15.3",
|
||||||
"@typescript-eslint/parser": "^5.55.0",
|
"@typescript-eslint/parser": "^5.55.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
|
@ -1292,6 +1293,12 @@
|
||||||
"@sinonjs/commons": "^2.0.0"
|
"@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": {
|
"node_modules/@types/babel__core": {
|
||||||
"version": "7.20.0",
|
"version": "7.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
||||||
|
@ -7426,6 +7433,12 @@
|
||||||
"@sinonjs/commons": "^2.0.0"
|
"@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": {
|
"@types/babel__core": {
|
||||||
"version": "7.20.0",
|
"version": "7.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz",
|
||||||
|
|
|
@ -30,17 +30,18 @@
|
||||||
"@actions/exec": "^1.1.1"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tsconfig/node16": "^1.0.3",
|
||||||
"@types/node": "^18.15.3",
|
"@types/node": "^18.15.3",
|
||||||
"@typescript-eslint/parser": "^5.55.0",
|
"@typescript-eslint/parser": "^5.55.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.36.0",
|
"eslint": "^8.36.0",
|
||||||
"eslint-plugin-github": "^4.6.1",
|
"eslint-plugin-github": "^4.6.1",
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
|
"husky": "^8.0.3",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "2.8.5",
|
"prettier": "2.8.5",
|
||||||
"ts-jest": "^29.0.5",
|
"ts-jest": "^29.0.5",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2"
|
||||||
"husky": "^8.0.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"extends": "@tsconfig/node16/tsconfig.json",
|
||||||
"compilerOptions": {
|
"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. */
|
"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. */
|
"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'. */
|
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue