@beignet/cli 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +70 -21
- package/dist/choices.d.ts +32 -3
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +54 -3
- package/dist/choices.js.map +1 -1
- package/dist/create-prompts.d.ts +5 -4
- package/dist/create-prompts.d.ts.map +1 -1
- package/dist/create-prompts.js +22 -4
- package/dist/create-prompts.js.map +1 -1
- package/dist/create.d.ts +7 -1
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +13 -3
- package/dist/create.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/dist/make.d.ts +21 -1
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +210 -37
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts +19 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +250 -0
- package/dist/mcp.js.map +1 -0
- package/dist/templates/agents.d.ts +14 -0
- package/dist/templates/agents.d.ts.map +1 -0
- package/dist/templates/agents.js +98 -0
- package/dist/templates/agents.js.map +1 -0
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +79 -9
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/db/index.d.ts +21 -0
- package/dist/templates/db/index.d.ts.map +1 -0
- package/dist/templates/db/index.js +14 -0
- package/dist/templates/db/index.js.map +1 -0
- package/dist/templates/db/mysql.d.ts +4 -0
- package/dist/templates/db/mysql.d.ts.map +1 -0
- package/dist/templates/db/mysql.js +972 -0
- package/dist/templates/db/mysql.js.map +1 -0
- package/dist/templates/db/postgres.d.ts +4 -0
- package/dist/templates/db/postgres.d.ts.map +1 -0
- package/dist/templates/db/postgres.js +863 -0
- package/dist/templates/db/postgres.js.map +1 -0
- package/dist/templates/db/sqlite.d.ts +3 -0
- package/dist/templates/db/sqlite.d.ts.map +1 -0
- package/dist/templates/db/sqlite.js +878 -0
- package/dist/templates/db/sqlite.js.map +1 -0
- package/dist/templates/index.d.ts +5 -5
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +24 -20
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts +3 -3
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +149 -97
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.d.ts +34 -1
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +45 -0
- package/dist/templates/shared.js.map +1 -1
- package/package.json +5 -3
- package/src/choices.ts +70 -3
- package/src/create-prompts.ts +25 -3
- package/src/create.ts +24 -2
- package/src/index.ts +58 -5
- package/src/make.ts +265 -34
- package/src/mcp.ts +367 -0
- package/src/templates/agents.ts +103 -0
- package/src/templates/base.ts +95 -9
- package/src/templates/db/index.ts +34 -0
- package/src/templates/db/mysql.ts +976 -0
- package/src/templates/db/postgres.ts +867 -0
- package/src/templates/{db.ts → db/sqlite.ts} +31 -152
- package/src/templates/index.ts +27 -19
- package/src/templates/server.ts +161 -97
- package/src/templates/shared.ts +90 -1
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for building or running the Beignet MCP server.
|
|
4
|
+
*/
|
|
5
|
+
export type McpServerOptions = {
|
|
6
|
+
cwd: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Build the Beignet MCP server with routes, doctor, lint, and make tools.
|
|
11
|
+
* Every tool resolves against the app directory captured at launch.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildBeignetMcpServer(options: McpServerOptions): McpServer;
|
|
14
|
+
/**
|
|
15
|
+
* Run the Beignet MCP server over stdio until the client disconnects.
|
|
16
|
+
* Stdout belongs to the transport; diagnostics must go to stderr.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runMcpServer(options: McpServerOptions): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA6MF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA2G1E;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU3E"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { applyDoctorFixes, inspectApp } from "./inspect.js";
|
|
6
|
+
import { lintApp } from "./lint.js";
|
|
7
|
+
import { makeAdapter, makeContract, makeEvent, makeFactory, makeFeature, makeFeatureAddonChoices, makeJob, makeListener, makeNotification, makePolicy, makePort, makeResource, makeSchedule, makeSeed, makeTask, makeTest, makeUpload, makeUseCase, } from "./make.js";
|
|
8
|
+
const makeArtifactChoices = [
|
|
9
|
+
"adapter",
|
|
10
|
+
"contract",
|
|
11
|
+
"event",
|
|
12
|
+
"factory",
|
|
13
|
+
"feature",
|
|
14
|
+
"job",
|
|
15
|
+
"listener",
|
|
16
|
+
"notification",
|
|
17
|
+
"policy",
|
|
18
|
+
"port",
|
|
19
|
+
"resource",
|
|
20
|
+
"schedule",
|
|
21
|
+
"seed",
|
|
22
|
+
"task",
|
|
23
|
+
"test",
|
|
24
|
+
"upload",
|
|
25
|
+
"use-case",
|
|
26
|
+
];
|
|
27
|
+
const makeInputSchema = {
|
|
28
|
+
artifact: z
|
|
29
|
+
.enum(makeArtifactChoices)
|
|
30
|
+
.describe("Kind of artifact to generate."),
|
|
31
|
+
name: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe("Artifact name. Feature-owned artifacts use feature-scoped paths such as posts/backfill."),
|
|
34
|
+
with: z
|
|
35
|
+
.array(z.enum(makeFeatureAddonChoices))
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("feature only: add feature-owned artifacts such as policy, events, jobs, notifications, tasks, ui, and uploads."),
|
|
38
|
+
event: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("listener only (required): event to listen to, for example posts/published."),
|
|
42
|
+
cron: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("schedule only: cron expression. Defaults to 0 9 * * *."),
|
|
46
|
+
timezone: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("schedule only: IANA timezone, for example America/Chicago."),
|
|
50
|
+
route: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("schedule only: generate a Next.js cron route for the schedule."),
|
|
54
|
+
auth: z
|
|
55
|
+
.boolean()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("resource only: generate policy metadata and use-case authorization checks for mutating routes."),
|
|
58
|
+
tenant: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("resource only: generate tenant-scoped schemas, repository methods, and use-case checks."),
|
|
62
|
+
events: z
|
|
63
|
+
.boolean()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("resource only: generate domain event definitions and publish resource events."),
|
|
66
|
+
softDelete: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("resource only: generate soft-delete persistence that archives rows with deletedAt."),
|
|
70
|
+
force: z
|
|
71
|
+
.boolean()
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Overwrite conflicting files instead of failing."),
|
|
74
|
+
dryRun: z
|
|
75
|
+
.boolean()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Preview generated changes without writing files."),
|
|
78
|
+
};
|
|
79
|
+
function jsonResult(value) {
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function errorResult(error) {
|
|
85
|
+
return {
|
|
86
|
+
isError: true,
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: error instanceof Error ? error.message : String(error),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function safeToolResult(run) {
|
|
96
|
+
try {
|
|
97
|
+
return await run();
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return errorResult(error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function runMakeTool(cwd, input) {
|
|
104
|
+
const base = {
|
|
105
|
+
name: input.name,
|
|
106
|
+
cwd,
|
|
107
|
+
force: input.force,
|
|
108
|
+
dryRun: input.dryRun,
|
|
109
|
+
};
|
|
110
|
+
switch (input.artifact) {
|
|
111
|
+
case "adapter":
|
|
112
|
+
return makeAdapter(base);
|
|
113
|
+
case "contract":
|
|
114
|
+
return makeContract(base);
|
|
115
|
+
case "event":
|
|
116
|
+
return makeEvent(base);
|
|
117
|
+
case "factory":
|
|
118
|
+
return makeFactory(base);
|
|
119
|
+
case "feature":
|
|
120
|
+
return makeFeature({ ...base, with: input.with });
|
|
121
|
+
case "job":
|
|
122
|
+
return makeJob(base);
|
|
123
|
+
case "listener":
|
|
124
|
+
if (!input.event) {
|
|
125
|
+
throw new Error("make listener requires an event, for example event: posts/published.");
|
|
126
|
+
}
|
|
127
|
+
return makeListener({ ...base, event: input.event });
|
|
128
|
+
case "notification":
|
|
129
|
+
return makeNotification(base);
|
|
130
|
+
case "policy":
|
|
131
|
+
return makePolicy(base);
|
|
132
|
+
case "port":
|
|
133
|
+
return makePort(base);
|
|
134
|
+
case "resource":
|
|
135
|
+
return makeResource({
|
|
136
|
+
...base,
|
|
137
|
+
auth: input.auth,
|
|
138
|
+
tenant: input.tenant,
|
|
139
|
+
events: input.events,
|
|
140
|
+
softDelete: input.softDelete,
|
|
141
|
+
});
|
|
142
|
+
case "schedule":
|
|
143
|
+
return makeSchedule({
|
|
144
|
+
...base,
|
|
145
|
+
cron: input.cron,
|
|
146
|
+
timezone: input.timezone,
|
|
147
|
+
route: input.route,
|
|
148
|
+
});
|
|
149
|
+
case "seed":
|
|
150
|
+
return makeSeed(base);
|
|
151
|
+
case "task":
|
|
152
|
+
return makeTask(base);
|
|
153
|
+
case "test":
|
|
154
|
+
return makeTest(base);
|
|
155
|
+
case "upload":
|
|
156
|
+
return makeUpload(base);
|
|
157
|
+
case "use-case":
|
|
158
|
+
return makeUseCase(base);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Build the Beignet MCP server with routes, doctor, lint, and make tools.
|
|
163
|
+
* Every tool resolves against the app directory captured at launch.
|
|
164
|
+
*/
|
|
165
|
+
export function buildBeignetMcpServer(options) {
|
|
166
|
+
const cwd = path.resolve(options.cwd);
|
|
167
|
+
const server = new McpServer({
|
|
168
|
+
name: "beignet",
|
|
169
|
+
version: options.version,
|
|
170
|
+
});
|
|
171
|
+
server.registerTool("routes", {
|
|
172
|
+
description: "List the app's registered Beignet HTTP routes as JSON: method, path, contract export, contract file, and route handler mapping.",
|
|
173
|
+
annotations: { readOnlyHint: true },
|
|
174
|
+
}, async () => safeToolResult(async () => {
|
|
175
|
+
const result = await inspectApp({ cwd });
|
|
176
|
+
return jsonResult(result.routes.map((route) => ({
|
|
177
|
+
method: route.method,
|
|
178
|
+
path: route.path,
|
|
179
|
+
contract: route.exportName,
|
|
180
|
+
file: route.file,
|
|
181
|
+
handlerFile: route.handlerFile,
|
|
182
|
+
handlerSource: route.handlerSource,
|
|
183
|
+
metadata: route.metadata,
|
|
184
|
+
})));
|
|
185
|
+
}));
|
|
186
|
+
server.registerTool("doctor", {
|
|
187
|
+
description: "Check app wiring and Beignet conventions, returning diagnostics, the detected convention, and applied fixes as JSON. Strict mode (the default) is the CI bar and includes CI-oriented warnings. Read-only; use doctor_fix to repair registration drift.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
strict: z
|
|
190
|
+
.boolean()
|
|
191
|
+
.optional()
|
|
192
|
+
.describe("Include CI-oriented warnings. Defaults to true."),
|
|
193
|
+
},
|
|
194
|
+
annotations: { readOnlyHint: true },
|
|
195
|
+
}, async (input) => safeToolResult(async () => {
|
|
196
|
+
const result = await inspectApp({ cwd, strict: input.strict ?? true });
|
|
197
|
+
return jsonResult({
|
|
198
|
+
diagnostics: result.diagnostics,
|
|
199
|
+
convention: result.convention,
|
|
200
|
+
fixes: result.fixes,
|
|
201
|
+
});
|
|
202
|
+
}));
|
|
203
|
+
server.registerTool("doctor_fix", {
|
|
204
|
+
description: "Apply low-risk doctor fixes, then re-check the app. Repairs route-group, schedule, task, and outbox registration drift; listener registration drift is report-only. Returns applied fixes and remaining diagnostics as JSON.",
|
|
205
|
+
inputSchema: {
|
|
206
|
+
strict: z
|
|
207
|
+
.boolean()
|
|
208
|
+
.optional()
|
|
209
|
+
.describe("Include CI-oriented warnings. Defaults to true."),
|
|
210
|
+
},
|
|
211
|
+
}, async (input) => safeToolResult(async () => {
|
|
212
|
+
const strict = input.strict ?? true;
|
|
213
|
+
const fixes = await applyDoctorFixes({ cwd, strict });
|
|
214
|
+
const result = await inspectApp({ cwd, strict });
|
|
215
|
+
return jsonResult({
|
|
216
|
+
diagnostics: result.diagnostics,
|
|
217
|
+
convention: result.convention,
|
|
218
|
+
fixes,
|
|
219
|
+
});
|
|
220
|
+
}));
|
|
221
|
+
server.registerTool("lint", {
|
|
222
|
+
description: "Check Beignet dependency-direction conventions across domain, use cases, routes, components, and infra. Returns lint diagnostics as JSON.",
|
|
223
|
+
annotations: { readOnlyHint: true },
|
|
224
|
+
}, async () => safeToolResult(async () => {
|
|
225
|
+
return jsonResult(await lintApp({ cwd }));
|
|
226
|
+
}));
|
|
227
|
+
server.registerTool("make", {
|
|
228
|
+
description: "Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, job, listener, notification, policy, port, resource, schedule, seed, task, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts auth, tenant, events, softDelete; listener requires event; schedule accepts cron, timezone, route. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
|
|
229
|
+
inputSchema: makeInputSchema,
|
|
230
|
+
}, async (input) => safeToolResult(async () => {
|
|
231
|
+
return jsonResult(await runMakeTool(cwd, input));
|
|
232
|
+
}));
|
|
233
|
+
return server;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Run the Beignet MCP server over stdio until the client disconnects.
|
|
237
|
+
* Stdout belongs to the transport; diagnostics must go to stderr.
|
|
238
|
+
*/
|
|
239
|
+
export async function runMcpServer(options) {
|
|
240
|
+
const server = buildBeignetMcpServer(options);
|
|
241
|
+
const transport = new StdioServerTransport();
|
|
242
|
+
const closed = new Promise((resolve) => {
|
|
243
|
+
server.server.onclose = () => {
|
|
244
|
+
resolve();
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
await server.connect(transport);
|
|
248
|
+
await closed;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAA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AAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC3C,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE;YAC3B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type TemplateContext } from "./shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* AGENTS.md teaches coding agents the conventions that are not discoverable
|
|
4
|
+
* from the code: registration wiring, generators, and the validation loop.
|
|
5
|
+
* README.md owns setup and the app map; this file must not duplicate it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function agentsMd(ctx: TemplateContext): string;
|
|
8
|
+
/**
|
|
9
|
+
* .mcp.json registers the `beignet mcp` stdio server for MCP-aware clients.
|
|
10
|
+
* The runner must not print banners on stdout, which corrupts JSON-RPC, so
|
|
11
|
+
* the config launches the locally installed CLI bin via bunx/npx.
|
|
12
|
+
*/
|
|
13
|
+
export declare function mcpJson(ctx: TemplateContext): string;
|
|
14
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/templates/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA6ErD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAWpD"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { json, packageRunner } from "./shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* AGENTS.md teaches coding agents the conventions that are not discoverable
|
|
4
|
+
* from the code: registration wiring, generators, and the validation loop.
|
|
5
|
+
* README.md owns setup and the app map; this file must not duplicate it.
|
|
6
|
+
*/
|
|
7
|
+
export function agentsMd(ctx) {
|
|
8
|
+
const cli = packageRunner(ctx);
|
|
9
|
+
const test = ctx.packageManager === "npm"
|
|
10
|
+
? "npm run test"
|
|
11
|
+
: `${ctx.packageManager} run test`;
|
|
12
|
+
const typecheck = ctx.packageManager === "npm"
|
|
13
|
+
? "npm run typecheck"
|
|
14
|
+
: `${ctx.packageManager} run typecheck`;
|
|
15
|
+
return `# ${ctx.name} — agent guide
|
|
16
|
+
|
|
17
|
+
This is a Beignet contract-first app. Full framework docs live at
|
|
18
|
+
https://beignetjs.com (agent-friendly index at https://beignetjs.com/llms.txt).
|
|
19
|
+
README.md covers setup and the app map; this file covers what is not
|
|
20
|
+
discoverable from the code.
|
|
21
|
+
|
|
22
|
+
## Registration is not automatic
|
|
23
|
+
|
|
24
|
+
Creating an artifact file does not wire it into the app. Non-registration is
|
|
25
|
+
a silent failure — the file exists but never runs:
|
|
26
|
+
|
|
27
|
+
- Feature route groups in \`features/<feature>/routes.ts\` must be composed in
|
|
28
|
+
\`server/routes.ts\` via \`defineRoutes([...])\`.
|
|
29
|
+
- Schedules must be added to the \`schedules\` array in \`server/schedules.ts\`.
|
|
30
|
+
- Tasks must be added to \`defineTasks([...])\` in \`server/tasks.ts\`.
|
|
31
|
+
- Outbox events and jobs must be registered in \`defineOutboxRegistry({...})\`
|
|
32
|
+
in \`server/outbox.ts\`.
|
|
33
|
+
- Listeners must be wired through a \`registerListeners(...)\` call in infra
|
|
34
|
+
wiring.
|
|
35
|
+
|
|
36
|
+
The starter ships no workflow registries — generators create them on first
|
|
37
|
+
use, so their absence is fine. \`${cli} doctor\` detects registration drift.
|
|
38
|
+
\`${cli} doctor --fix\` repairs route-group, schedule, task, and outbox
|
|
39
|
+
registration; listener drift is report-only and must be fixed by hand.
|
|
40
|
+
|
|
41
|
+
## Prefer generators
|
|
42
|
+
|
|
43
|
+
\`${cli} make <artifact> <name>\` creates correctly placed, pre-registered
|
|
44
|
+
files — prefer it over hand-writing them. See \`${cli} make --help\` for the
|
|
45
|
+
artifact list. After changing the Drizzle schema in \`infra/db/schema/\`, run
|
|
46
|
+
\`${cli} db generate\` then \`${cli} db migrate\`.
|
|
47
|
+
|
|
48
|
+
## Validation loop
|
|
49
|
+
|
|
50
|
+
Run after every change:
|
|
51
|
+
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
${cli} lint
|
|
54
|
+
${cli} doctor --strict
|
|
55
|
+
${test}
|
|
56
|
+
${typecheck}
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
## Placement rules
|
|
60
|
+
|
|
61
|
+
- Feature artifacts live under \`features/<feature>/\`, with tests in
|
|
62
|
+
\`features/<feature>/tests/\` (not \`__tests__/\`).
|
|
63
|
+
- Domain and use-case code must not import infra, providers, or React.
|
|
64
|
+
- Routes must not import concrete infra.
|
|
65
|
+
|
|
66
|
+
## Naming grammar
|
|
67
|
+
|
|
68
|
+
- \`defineX\` declares things you register: contracts, routes, jobs,
|
|
69
|
+
schedules, and the rest.
|
|
70
|
+
- \`createX\` builds runtime objects you call: servers, clients, providers,
|
|
71
|
+
and the \`createX<AppContext>()\` factories that return app-bound
|
|
72
|
+
\`defineX\` builders.
|
|
73
|
+
|
|
74
|
+
## MCP server
|
|
75
|
+
|
|
76
|
+
\`.mcp.json\` registers the \`beignet mcp\` stdio server, which exposes
|
|
77
|
+
routes/doctor/lint/make as structured tools named exactly: \`routes\`,
|
|
78
|
+
\`doctor\`, \`doctor_fix\`, \`lint\`, \`make\`. Clients that do not read
|
|
79
|
+
\`.mcp.json\` can launch \`${cli} mcp\` directly.
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* .mcp.json registers the `beignet mcp` stdio server for MCP-aware clients.
|
|
84
|
+
* The runner must not print banners on stdout, which corrupts JSON-RPC, so
|
|
85
|
+
* the config launches the locally installed CLI bin via bunx/npx.
|
|
86
|
+
*/
|
|
87
|
+
export function mcpJson(ctx) {
|
|
88
|
+
const command = ctx.packageManager === "bun" ? "bunx" : "npx";
|
|
89
|
+
return json({
|
|
90
|
+
mcpServers: {
|
|
91
|
+
beignet: {
|
|
92
|
+
command,
|
|
93
|
+
args: ["beignet", "mcp"],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/templates/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAExE;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAoB;IAC3C,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,IAAI,GACR,GAAG,CAAC,cAAc,KAAK,KAAK;QAC1B,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,GAAG,GAAG,CAAC,cAAc,WAAW,CAAC;IACvC,MAAM,SAAS,GACb,GAAG,CAAC,cAAc,KAAK,KAAK;QAC1B,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,GAAG,GAAG,CAAC,cAAc,gBAAgB,CAAC;IAE5C,OAAO,KAAK,GAAG,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;mCAsBa,GAAG;IAClC,GAAG;;;;;IAKH,GAAG;kDAC2C,GAAG;;IAEjD,GAAG,yBAAyB,GAAG;;;;;;;EAOjC,GAAG;EACH,GAAG;EACH,IAAI;EACJ,SAAS;;;;;;;;;;;;;;;;;;;;;;;6BAuBkB,GAAG;CAC/B,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,GAAoB;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;IAE9D,OAAO,IAAI,CAAC;QACV,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,OAAO;gBACP,IAAI,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;aACzB;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/templates/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/templates/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAGrB,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAoGxD;AAQD,wBAAgB,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA6KnD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAiD5D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA+DvD;AAED,QAAA,MAAM,KAAK;;;;;CAiDV,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC"}
|
package/dist/templates/base.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { databaseLocalUrl, databaseStartCommand } from "../choices.js";
|
|
1
2
|
import { shadcnDependencies, shadcnDevDependencies } from "./shadcn.js";
|
|
2
3
|
import { externalVersions, hasIntegration, integrationDeps, json, packageRunner, } from "./shared.js";
|
|
3
4
|
import { shellDependencies, shellDevDependencies } from "./shell.js";
|
|
@@ -9,7 +10,6 @@ export function packageJson(ctx) {
|
|
|
9
10
|
"@beignet/provider-auth-better-auth": ctx.beignetVersion,
|
|
10
11
|
"@beignet/provider-db-drizzle": ctx.beignetVersion,
|
|
11
12
|
"@beignet/provider-logger-pino": ctx.beignetVersion,
|
|
12
|
-
"@libsql/client": externalVersions.libsqlClient,
|
|
13
13
|
"better-auth": externalVersions.betterAuth,
|
|
14
14
|
"drizzle-orm": externalVersions.drizzleOrm,
|
|
15
15
|
next: externalVersions.next,
|
|
@@ -18,6 +18,18 @@ export function packageJson(ctx) {
|
|
|
18
18
|
"react-dom": externalVersions.reactDom,
|
|
19
19
|
zod: externalVersions.zod,
|
|
20
20
|
};
|
|
21
|
+
// Ship only the selected database driver.
|
|
22
|
+
switch (ctx.database) {
|
|
23
|
+
case "postgres":
|
|
24
|
+
dependencies.pg = externalVersions.pg;
|
|
25
|
+
break;
|
|
26
|
+
case "mysql":
|
|
27
|
+
dependencies.mysql2 = externalVersions.mysql2;
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
dependencies["@libsql/client"] = externalVersions.libsqlClient;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
21
33
|
if (!ctx.api) {
|
|
22
34
|
dependencies["@beignet/react-query"] = ctx.beignetVersion;
|
|
23
35
|
dependencies["@beignet/react-hook-form"] = ctx.beignetVersion;
|
|
@@ -46,6 +58,11 @@ export function packageJson(ctx) {
|
|
|
46
58
|
"drizzle-kit": externalVersions.drizzleKit,
|
|
47
59
|
typescript: externalVersions.typescript,
|
|
48
60
|
};
|
|
61
|
+
if (ctx.database === "postgres") {
|
|
62
|
+
// PGlite backs infra/db/test-database.ts with in-process Postgres.
|
|
63
|
+
devDependencies["@electric-sql/pglite"] = externalVersions.pglite;
|
|
64
|
+
devDependencies["@types/pg"] = externalVersions.typesPg;
|
|
65
|
+
}
|
|
49
66
|
if (!ctx.api) {
|
|
50
67
|
for (const [name, version] of Object.entries(shadcnDevDependencies)) {
|
|
51
68
|
devDependencies[name] = version;
|
|
@@ -105,6 +122,26 @@ export function readme(ctx) {
|
|
|
105
122
|
- \`components/\` owns the app shell and shadcn/ui primitives.
|
|
106
123
|
- \`client/\` owns the typed API client, React Query helpers, and the Better Auth client.
|
|
107
124
|
`;
|
|
125
|
+
const startDatabase = ctx.database === "sqlite"
|
|
126
|
+
? ""
|
|
127
|
+
: `## Start the database
|
|
128
|
+
|
|
129
|
+
\`\`\`bash
|
|
130
|
+
${databaseStartCommand(ctx.database, ctx.name)}
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
The starter's \`.env.example\` points at this local ${ctx.database === "postgres" ? "Postgres" : "MySQL"} container. Point \`${ctx.database === "postgres" ? "POSTGRES_DB_URL" : "MYSQL_DB_URL"}\` at your own server to skip Docker.
|
|
134
|
+
|
|
135
|
+
`;
|
|
136
|
+
const testingNotes = ctx.database === "postgres"
|
|
137
|
+
? `
|
|
138
|
+
\`infra/db/test-database.ts\` runs repository tests against in-process Postgres via PGlite, so \`${test}\` needs no database server.
|
|
139
|
+
`
|
|
140
|
+
: ctx.database === "mysql"
|
|
141
|
+
? `
|
|
142
|
+
The starter's shipped tests use in-memory ports and need no database server. Database-backed tests can use \`createTestDatabase()\` from \`infra/db/test-database.ts\`, which requires \`MYSQL_TEST_URL\` (see the docker one-liner in \`.env.example\`), creates a uniquely named database per call, and drops it on close. Gate such tests with \`test.skipIf(!isMysqlTestDatabaseAvailable())\`.
|
|
143
|
+
`
|
|
144
|
+
: "";
|
|
108
145
|
return `# ${ctx.name}
|
|
109
146
|
|
|
110
147
|
Beignet app scaffolded with \`@beignet/cli\`.
|
|
@@ -116,7 +153,7 @@ ${install}
|
|
|
116
153
|
cp .env.example .env.local
|
|
117
154
|
\`\`\`
|
|
118
155
|
|
|
119
|
-
## Prepare the database
|
|
156
|
+
${startDatabase}## Prepare the database
|
|
120
157
|
|
|
121
158
|
\`\`\`bash
|
|
122
159
|
${cli} db migrate
|
|
@@ -144,7 +181,7 @@ ${typecheck}
|
|
|
144
181
|
\`\`\`
|
|
145
182
|
|
|
146
183
|
\`routes\` shows the contracts Beignet can inspect. \`lint\` checks dependency direction. \`doctor\` catches route, OpenAPI, and resource drift.
|
|
147
|
-
|
|
184
|
+
${testingNotes}
|
|
148
185
|
## Build for production
|
|
149
186
|
|
|
150
187
|
\`\`\`bash
|
|
@@ -178,16 +215,34 @@ ${cli} doctor
|
|
|
178
215
|
- \`infra/db/schema/\` contains the Drizzle schema, \`drizzle/\` contains the checked-in migrations, and \`infra/todos/\` contains the durable todo repository adapter.
|
|
179
216
|
- \`server/routes.ts\` keeps the central route registry and OpenAPI contract list.
|
|
180
217
|
- \`server/context.ts\` declares the context blueprint shared by the server and route tests.
|
|
181
|
-
- \`server/providers.ts\` wires devtools, Better Auth, pino,
|
|
218
|
+
- \`server/providers.ts\` wires devtools, Better Auth, pino, ${ctx.database === "sqlite"
|
|
219
|
+
? "Drizzle/libSQL"
|
|
220
|
+
: ctx.database === "postgres"
|
|
221
|
+
? "Drizzle/node-postgres"
|
|
222
|
+
: "Drizzle/mysql2"}, and the starter database provider.
|
|
182
223
|
- \`lib/env.ts\` validates deployment configuration at startup.
|
|
183
224
|
- \`lib/auth.ts\` exposes \`requireUser(ctx)\` for protected use cases.
|
|
184
225
|
- \`lib/better-auth.ts\` owns Better Auth setup and keeps provider-specific auth details outside use cases.
|
|
185
226
|
${shellMap}
|
|
186
227
|
## Before deploying
|
|
187
228
|
|
|
188
|
-
-
|
|
229
|
+
- ${ctx.database === "sqlite"
|
|
230
|
+
? "Keep `SQLITE_DB_URL=file:local.db` for local libSQL development or point it at a hosted libSQL database such as Turso."
|
|
231
|
+
: ctx.database === "postgres"
|
|
232
|
+
? "Point `POSTGRES_DB_URL` at your production Postgres 14+ server and run `" +
|
|
233
|
+
cli +
|
|
234
|
+
" db migrate` against it before starting the app."
|
|
235
|
+
: "Point `MYSQL_DB_URL` at your production MySQL 8.0+ server and run `" +
|
|
236
|
+
cli +
|
|
237
|
+
" db migrate` against it before starting the app."}
|
|
189
238
|
- Run \`${cli} db generate\` and \`${cli} db migrate\` after changing the Drizzle schema.
|
|
190
|
-
- Run \`${cli} db reset\` to rebuild a local
|
|
239
|
+
- Run \`${cli} db reset\` to rebuild a local ${ctx.database === "sqlite"
|
|
240
|
+
? "SQLite"
|
|
241
|
+
: ctx.database === "postgres"
|
|
242
|
+
? "Postgres"
|
|
243
|
+
: "MySQL"} database from the checked-in migrations${ctx.database === "sqlite"
|
|
244
|
+
? ""
|
|
245
|
+
: "; it refuses non-local hosts unless `BEIGNET_ALLOW_DATABASE_RESET=true`"}.
|
|
191
246
|
- Remove \`DEVTOOLS_ENABLED=true\` in production unless you add authentication and stricter redaction.
|
|
192
247
|
- Set \`APP_URL\`, \`BETTER_AUTH_SECRET\`, \`LOG_LEVEL\`, and service-specific integration variables in your hosting environment.
|
|
193
248
|
- Set \`BETTER_AUTH_TRUSTED_ORIGINS\` before serving auth across multiple origins.
|
|
@@ -215,6 +270,23 @@ export function integrationsDoc(ctx) {
|
|
|
215
270
|
return `${lines.join("\n")}\n`;
|
|
216
271
|
}
|
|
217
272
|
export function envExample(ctx) {
|
|
273
|
+
const databaseLines = ctx.database === "sqlite"
|
|
274
|
+
? [
|
|
275
|
+
"# Use file:local.db for local libSQL or libsql://... for Turso cloud.",
|
|
276
|
+
"SQLITE_DB_URL=file:local.db",
|
|
277
|
+
"# SQLITE_DB_AUTH_TOKEN=",
|
|
278
|
+
]
|
|
279
|
+
: ctx.database === "postgres"
|
|
280
|
+
? [
|
|
281
|
+
"# Local Postgres matching the docker one-liner below; point at your own server in production.",
|
|
282
|
+
`# ${databaseStartCommand("postgres", ctx.name)}`,
|
|
283
|
+
`POSTGRES_DB_URL=${databaseLocalUrl("postgres", ctx.name)}`,
|
|
284
|
+
]
|
|
285
|
+
: [
|
|
286
|
+
"# Local MySQL matching the docker one-liner below; point at your own server in production.",
|
|
287
|
+
`# ${databaseStartCommand("mysql", ctx.name)}`,
|
|
288
|
+
`MYSQL_DB_URL=${databaseLocalUrl("mysql", ctx.name)}`,
|
|
289
|
+
];
|
|
218
290
|
const lines = [
|
|
219
291
|
"# Copy to .env.local and fill in values for your app.",
|
|
220
292
|
"APP_URL=http://localhost:3000",
|
|
@@ -226,9 +298,7 @@ export function envExample(ctx) {
|
|
|
226
298
|
"LOG_FORMAT=json",
|
|
227
299
|
`LOG_SERVICE=${ctx.name}`,
|
|
228
300
|
"",
|
|
229
|
-
|
|
230
|
-
"SQLITE_DB_URL=file:local.db",
|
|
231
|
-
"# SQLITE_DB_AUTH_TOKEN=",
|
|
301
|
+
...databaseLines,
|
|
232
302
|
"",
|
|
233
303
|
"BETTER_AUTH_SECRET=local-dev-better-auth-secret-change-me",
|
|
234
304
|
"BETTER_AUTH_URL=http://localhost:3000",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/templates/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,IAAI,EACJ,aAAa,GAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,UAAU,WAAW,CAAC,GAAoB;IAC9C,MAAM,YAAY,GAA2B;QAC3C,eAAe,EAAE,GAAG,CAAC,cAAc;QACnC,mBAAmB,EAAE,GAAG,CAAC,cAAc;QACvC,eAAe,EAAE,GAAG,CAAC,cAAc;QACnC,oCAAoC,EAAE,GAAG,CAAC,cAAc;QACxD,8BAA8B,EAAE,GAAG,CAAC,cAAc;QAClD,+BAA+B,EAAE,GAAG,CAAC,cAAc;QACnD,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/templates/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,IAAI,EACJ,aAAa,GAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAA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AO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,KAAK,GAAG;IACZ,SAAS,EAAE;;;;;;;;CAQZ;IACC,OAAO,EAAE;;;;CAIV;IACC,UAAU,EAAE;;;;CAIb;IACC,QAAQ,EAAE,IAAI,CAAC;QACb,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,CAAC;YACtC,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,SAAS;YAC3B,iBAAiB,EAAE,IAAI;YACvB,eAAe,EAAE,IAAI;YACrB,GAAG,EAAE,WAAW;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC3B,KAAK,EAAE;gBACL,KAAK,EAAE,CAAC,KAAK,CAAC;aACf;SACF;QACD,OAAO,EAAE;YACP,eAAe;YACf,SAAS;YACT,UAAU;YACV,qBAAqB;YACrB,yBAAyB;SAC1B;QACD,OAAO,EAAE,CAAC,cAAc,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TemplateContext } from "../shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* Generated database files shared by every dialect. Each dialect module
|
|
4
|
+
* provides the full set so the scaffold surface stays stable across `--db`
|
|
5
|
+
* choices.
|
|
6
|
+
*/
|
|
7
|
+
export type DbTemplateFiles = {
|
|
8
|
+
drizzleConfig: string;
|
|
9
|
+
dbSchema: string;
|
|
10
|
+
drizzleTodoRepository: string;
|
|
11
|
+
dbRepositories: string;
|
|
12
|
+
databaseReady: string;
|
|
13
|
+
dbProvider: string;
|
|
14
|
+
dbReset: string;
|
|
15
|
+
dbTestDatabase: string;
|
|
16
|
+
starterMigrationSql: string;
|
|
17
|
+
starterMigrationJournal: string;
|
|
18
|
+
starterMigrationSnapshot: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function dbFiles(ctx: TemplateContext): DbTemplateFiles;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,wBAAgB,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAS7D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mysqlDbFiles } from "./mysql.js";
|
|
2
|
+
import { postgresDbFiles } from "./postgres.js";
|
|
3
|
+
import { sqliteDbFiles } from "./sqlite.js";
|
|
4
|
+
export function dbFiles(ctx) {
|
|
5
|
+
switch (ctx.database) {
|
|
6
|
+
case "postgres":
|
|
7
|
+
return postgresDbFiles(ctx);
|
|
8
|
+
case "mysql":
|
|
9
|
+
return mysqlDbFiles(ctx);
|
|
10
|
+
default:
|
|
11
|
+
return sqliteDbFiles();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/db/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAqB5C,MAAM,UAAU,OAAO,CAAC,GAAoB;IAC1C,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrB,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B;YACE,OAAO,aAAa,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC"}
|