-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathindex.ts
More file actions
62 lines (53 loc) · 1.89 KB
/
Copy pathindex.ts
File metadata and controls
62 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env node
import { Command } from "commander";
import { initProject } from "./commands/init/index.js";
import { buildSchema } from "./commands/generate/index.js";
import { addPackage } from "./commands/add/index.js";
import { toggleAnalytics } from "./commands/init/utils.js";
const program = new Command();
program.name("kirimase").description("Kirimase CLI").version("0.0.56");
program
.command("analytics")
.option("-t, --toggle", "toggle anonymous analytics")
.action(toggleAnalytics);
addCommonOptions(program.command("init"))
.description("initialise and configure kirimase within directory")
.action(initProject);
program
.command("generate")
.alias("g")
.description("Generate a new resource")
.action(buildSchema);
addCommonOptions(program.command("add"))
.description("Add and setup additional packages")
.action(addPackage);
program.parse(process.argv);
function addCommonOptions(command: Command) {
return command
.option("-sf, --has-src-folder", "has a src folder")
.option(
"-pm, --package-manager <pm>",
"preferred package manager (npm, yarn, pnpm, bun)"
)
.option(
"-cl, --component-lib <component-lib>",
"preferred component library (shadcn-ui)"
)
.option("-o, --orm <orm>", "preferred orm (prisma, drizzle)")
.option("-db, --db <db>", "preferred database (pg, mysql, sqlite)")
.option("-dbp, --db-provider <db>", "database provider")
.option("-a, --auth <auth>", "preferred auth (next-auth, clerk, lucia)")
.option(
"-ap, --auth-providers <auth-providers...>",
"auth providers (if using next-auth - discord, google, github, apple)"
)
.option(
"-mp, --misc-packages <packages...>",
"misc packages (resend, stripe, trpc)"
)
.option("-ie, --include-example", "include example model in schema");
}
process.on("SIGINT", () => {
// Then end process
process.exit();
});