Skip to content

Commit 36445f7

Browse files
Lock version number in CLI to version in package.json
1 parent a66cf0a commit 36445f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cli.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import yargs from "yargs";
22
import { hideBin } from "yargs/helpers";
3+
import { createRequire } from "node:module";
34
import { mergeJsonc, type MergeOptions } from "./core.js";
45
import { loadConfig, type ConfigOptions } from "./config.js";
56

7+
const require = createRequire(import.meta.url);
8+
const { version } = require("../package.json") as { version: string };
9+
610
interface ParsedArgs {
711
out?: string;
812
skipMissing?: boolean;
@@ -85,7 +89,7 @@ async function run() {
8589
})
8690
.help("help")
8791
.alias("help", "h")
88-
.version("0.1.0")
92+
.version(version)
8993
.alias("version", "v")
9094
.demandCommand(1, "You must provide at least one input file")
9195
.example(

0 commit comments

Comments
 (0)