From 08d655735d9596ad250dbb660f00a222db05c5f1 Mon Sep 17 00:00:00 2001 From: Evan Kohilas Date: Mon, 11 Nov 2024 19:28:36 +1100 Subject: [PATCH 1/2] Fix running error by reverting import with type json --- src/index.ts | 2 +- src/schema/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index e1809ea7b..2d1f5f0bb 100755 --- a/src/index.ts +++ b/src/index.ts @@ -10,7 +10,7 @@ import {Argv} from "./argv.js"; import {AssertionError} from "assert"; import {Job, cleanupJobResources} from "./job.js"; import {GitlabRunnerPresetValues} from "./gitlab-preset.js"; -import packageJson from "../package.json" with { type: "json" }; +import packageJson from "../package.json"; const jobs: Job[] = []; diff --git a/src/schema/index.ts b/src/schema/index.ts index 52db0fdb0..205738691 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -1,4 +1,4 @@ -import _schema from "./schema.json" with { type: "json" }; +import _schema from "./schema.json"; const schema: any = _schema; schema.definitions.job_template.properties.gclInjectSSHAgent = { From 8dc096549b38a50214699fee7711a45019e42a10 Mon Sep 17 00:00:00 2001 From: Evan Kohilas Date: Mon, 11 Nov 2024 21:02:19 +1100 Subject: [PATCH 2/2] convert json import to parse --- src/index.ts | 4 ++-- src/schema/index.ts | 4 +--- tsconfig.json | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2d1f5f0bb..a849af614 100755 --- a/src/index.ts +++ b/src/index.ts @@ -10,9 +10,9 @@ import {Argv} from "./argv.js"; import {AssertionError} from "assert"; import {Job, cleanupJobResources} from "./job.js"; import {GitlabRunnerPresetValues} from "./gitlab-preset.js"; -import packageJson from "../package.json"; const jobs: Job[] = []; +const version = JSON.parse("../package.json")["version"]; process.on("SIGINT", async (_: string, code: number) => { await cleanupJobResources(jobs); @@ -26,7 +26,7 @@ process.on("SIGUSR2", async () => await cleanupJobResources(jobs)); const yparser = yargs(process.argv.slice(2)); yparser.parserConfiguration({"greedy-arrays": false}) .showHelpOnFail(false) - .version(packageJson["version"]) + .version(version) .wrap(yparser.terminalWidth?.()) .command({ handler: async (argv) => { diff --git a/src/schema/index.ts b/src/schema/index.ts index 205738691..6b93fd8ad 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -1,6 +1,4 @@ -import _schema from "./schema.json"; - -const schema: any = _schema; +const schema: any = JSON.parse("./schema.json"); schema.definitions.job_template.properties.gclInjectSSHAgent = { "type": "boolean", }; diff --git a/tsconfig.json b/tsconfig.json index d27751840..c7773407c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,5 @@ "inlineSources": true, "strict": true, "skipLibCheck": true, - "resolveJsonModule": true } }