This commit is contained in:
bipproduction
2025-08-19 14:40:48 +08:00
commit 4e6480c913
9 changed files with 284 additions and 0 deletions

35
bin/g3n.ts Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bun
import minimist from "minimist";
import path from "path";
import { generateEnvTypes } from "../generate/env.generate.js";
const args = minimist(process.argv.slice(2));
const help = `
g3n [command] [options]
Commands:
env Generate env.d.ts from .env file
Options:
--env Path ke file .env (default: .env)
--out Path file output (default: types/env.d.ts)
Examples:
g3n env --env .env.local --out src/types/env.d.ts
`;
(async () => {
const cmd = args._[0];
if (cmd === "env") {
generateEnvTypes({
envFilePath: args.env,
outputDir: args.out ? path.dirname(args.out) : undefined,
outputFileName: args.out ? path.basename(args.out) : undefined,
});
return;
}
console.error(help);
})();