Skip to content

Commit c8be50e

Browse files
fix(cli): Read version from package.json instead of hardcoding
1 parent de90f7f commit c8be50e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cli/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#!/usr/bin/env node
2+
import { createRequire } from "node:module";
23
import dotenv from "dotenv";
34
import pc from "picocolors";
45
import { init } from "./init.js";
56

67
dotenv.config();
78

9+
const require = createRequire(import.meta.url);
10+
const { version: VERSION } = require("../../package.json");
11+
812
const args = process.argv.slice(2);
913
const command = args[0];
1014

11-
const VERSION = "0.1.0";
12-
1315
const LOGO = `
1416
${pc.magenta(" █████╗ ██████╗ ██╗ ██╗ ██████╗██╗ █████╗ ██╗ ██╗")}
1517
${pc.magenta(" ██╔══██╗██╔══██╗██║ ██╔╝ ██╔════╝██║ ██╔══██╗██║ ██║")}

0 commit comments

Comments
 (0)