mirror of
https://github.com/DeterminateSystems/flake-checker-action.git
synced 2025-05-06 03:20:08 +02:00
Switch to tsup-based build
This commit is contained in:
parent
c1c09e0135
commit
650a00ab83
10 changed files with 1783 additions and 96820 deletions
2
dist/index.d.ts
generated
vendored
Normal file
2
dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
export { }
|
94733
dist/index.js
generated
vendored
94733
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
Normal file
1
dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/main.d.ts
generated
vendored
1
dist/main.d.ts
generated
vendored
|
@ -1 +0,0 @@
|
||||||
export {};
|
|
83
dist/main.js
generated
vendored
83
dist/main.js
generated
vendored
|
@ -1,83 +0,0 @@
|
||||||
import * as actionsCore from "@actions/core";
|
|
||||||
import * as actionsExec from "@actions/exec";
|
|
||||||
import { IdsToolbox } from "detsys-ts";
|
|
||||||
class FlakeCheckerAction {
|
|
||||||
constructor() {
|
|
||||||
this.idslib = new IdsToolbox({
|
|
||||||
name: "flake-checker",
|
|
||||||
fetchStyle: "gh-env-style",
|
|
||||||
diagnosticsUrl: new URL("https://install.determinate.systems/flake-checker/telemetry"),
|
|
||||||
});
|
|
||||||
this.flakeLockPath =
|
|
||||||
actionInputStringOrNull("flake-lock-path") || "flake.lock";
|
|
||||||
this.nixpkgsKeys = actionInputStringOrNull("nixpkgs-keys") || "nixpkgs";
|
|
||||||
this.checkOutdated = actionInputBool("check-outdated");
|
|
||||||
this.checkOwner = actionInputBool("check-owner");
|
|
||||||
this.checkSupported = actionInputBool("check-supported");
|
|
||||||
this.ignoreMissingFlakeLock = actionInputBool("ignore-missing-flake-lock");
|
|
||||||
this.failMode = actionInputBool("fail-mode");
|
|
||||||
this.sendStatistics = actionInputBool("send-statistics");
|
|
||||||
}
|
|
||||||
async executionEnvironment() {
|
|
||||||
const executionEnv = {};
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH = this.flakeLockPath;
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_NIXPKGS_KEYS = this.nixpkgsKeys;
|
|
||||||
if (!this.sendStatistics) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_NO_TELEMETRY = "false";
|
|
||||||
}
|
|
||||||
if (!this.checkOutdated) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_CHECK_OUTDATED = "false";
|
|
||||||
}
|
|
||||||
if (!this.checkOwner) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_CHECK_OWNER = "false";
|
|
||||||
}
|
|
||||||
if (!this.checkSupported) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_CHECK_SUPPORTED = "false";
|
|
||||||
}
|
|
||||||
if (!this.ignoreMissingFlakeLock) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK = "false";
|
|
||||||
}
|
|
||||||
if (this.failMode) {
|
|
||||||
executionEnv.NIX_FLAKE_CHECKER_FAIL_MODE = "true";
|
|
||||||
}
|
|
||||||
return executionEnv;
|
|
||||||
}
|
|
||||||
async check() {
|
|
||||||
const binaryPath = await this.idslib.fetchExecutable();
|
|
||||||
const executionEnv = await this.executionEnvironment();
|
|
||||||
actionsCore.debug(`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`);
|
|
||||||
const exitCode = await actionsExec.exec(binaryPath, [], {
|
|
||||||
env: {
|
|
||||||
...executionEnv,
|
|
||||||
...process.env, // To get $PATH, etc
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (exitCode !== 0) {
|
|
||||||
this.idslib.recordEvent("execution_failure", {
|
|
||||||
exitCode,
|
|
||||||
});
|
|
||||||
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
|
|
||||||
}
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function actionInputStringOrNull(name) {
|
|
||||||
const value = actionsCore.getInput(name);
|
|
||||||
if (value === "") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function actionInputBool(name) {
|
|
||||||
return actionsCore.getBooleanInput(name);
|
|
||||||
}
|
|
||||||
function main() {
|
|
||||||
const checker = new FlakeCheckerAction();
|
|
||||||
checker.idslib.onMain(async () => {
|
|
||||||
await checker.check();
|
|
||||||
});
|
|
||||||
checker.idslib.execute();
|
|
||||||
}
|
|
||||||
main();
|
|
3
dist/package.json
generated
vendored
3
dist/package.json
generated
vendored
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"type": "module"
|
|
||||||
}
|
|
|
@ -2,11 +2,11 @@
|
||||||
"name": "flake-checker-action",
|
"name": "flake-checker-action",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./dist/main.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/main.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsup",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"package": "ncc build",
|
"package": "ncc build",
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
|
"tsup": "^8.0.2",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3757
pnpm-lock.yaml
generated
3757
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
16
tsup.config.ts
Normal file
16
tsup.config.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { defineConfig } from "tsup";
|
||||||
|
import { name } from "./package.json";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
name,
|
||||||
|
entry: ["src/index.ts"],
|
||||||
|
format: ["esm"],
|
||||||
|
target: "node20",
|
||||||
|
bundle: true,
|
||||||
|
splitting: false,
|
||||||
|
sourcemap: true,
|
||||||
|
clean: true,
|
||||||
|
dts: {
|
||||||
|
resolve: true,
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue