tambahan
This commit is contained in:
35
bin/g3n.ts
Executable file
35
bin/g3n.ts
Executable 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);
|
||||
})();
|
||||
Reference in New Issue
Block a user