Skip to content

Commit

Permalink
Fix json import (#1424)
Browse files Browse the repository at this point in the history
* Fix running error by reverting import with type json

* convert json import to parse
  • Loading branch information
ekohilas authored Nov 14, 2024
1 parent 9842909 commit 3c41ae5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import chalk from "chalk";
import {readFileSync} from "fs";
import yargs from "yargs";
import {Parser} from "./parser.js";
import * as state from "./state.js";
Expand All @@ -10,10 +11,11 @@ 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" };

const jobs: Job[] = [];

const version = JSON.parse(readFileSync("package.json", "utf8"))["version"];

process.on("SIGINT", async (_: string, code: number) => {
await cleanupJobResources(jobs);
process.exit(code);
Expand All @@ -26,7 +28,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) => {
Expand Down
5 changes: 2 additions & 3 deletions src/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _schema from "./schema.json" with { type: "json" };

const schema: any = _schema;
import {readFileSync} from "fs";
const schema: any = JSON.parse(readFileSync("src/schema/schema.json", "utf8"));
schema.definitions.job_template.properties.gclInjectSSHAgent = {
"type": "boolean",
};
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"inlineSources": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}

0 comments on commit 3c41ae5

Please sign in to comment.