@beignet/cli 0.0.38 → 0.0.39
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 +9 -0
- package/README.md +120 -96
- package/dist/choices.d.ts +17 -21
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +21 -67
- package/dist/choices.js.map +1 -1
- package/dist/create-prompts.d.ts +5 -6
- package/dist/create-prompts.d.ts.map +1 -1
- package/dist/create-prompts.js +15 -15
- package/dist/create-prompts.js.map +1 -1
- package/dist/create.d.ts +11 -2
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +38 -28
- package/dist/create.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +149 -47
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +54 -1
- package/dist/inspect.js.map +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/make/inbox.js +3 -3
- package/dist/make/inbox.js.map +1 -1
- package/dist/make/payments.js +3 -3
- package/dist/make/payments.js.map +1 -1
- package/dist/make/shared.d.ts +10 -3
- package/dist/make/shared.d.ts.map +1 -1
- package/dist/make/shared.js +7 -8
- package/dist/make/shared.js.map +1 -1
- package/dist/make.d.ts +3 -2
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +455 -185
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +15 -11
- package/dist/mcp.js.map +1 -1
- package/dist/provider-add.d.ts +21 -3
- package/dist/provider-add.d.ts.map +1 -1
- package/dist/provider-add.js +101 -65
- package/dist/provider-add.js.map +1 -1
- package/dist/task.js +1 -1
- package/dist/task.js.map +1 -1
- package/dist/templates/base.d.ts +1 -1
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +15 -15
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +5 -5
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +17 -13
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.d.ts +4 -4
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +6 -6
- package/dist/templates/shared.js.map +1 -1
- package/package.json +2 -2
- package/skills/app-structure/SKILL.md +13 -8
- package/src/choices.ts +38 -88
- package/src/create-prompts.ts +20 -21
- package/src/create.ts +54 -36
- package/src/index.ts +193 -65
- package/src/inspect.ts +101 -1
- package/src/lib.ts +1 -1
- package/src/make/inbox.ts +3 -3
- package/src/make/payments.ts +3 -3
- package/src/make/shared.ts +16 -10
- package/src/make.ts +578 -176
- package/src/mcp.ts +20 -13
- package/src/provider-add.ts +159 -79
- package/src/task.ts +1 -1
- package/src/templates/base.ts +16 -16
- package/src/templates/index.ts +6 -6
- package/src/templates/server.ts +17 -13
- package/src/templates/shared.ts +10 -10
- package/src/test-helpers/generated-app.ts +1 -0
package/dist/mcp.js
CHANGED
|
@@ -37,11 +37,11 @@ const makeInputSchema = {
|
|
|
37
37
|
name: z
|
|
38
38
|
.string()
|
|
39
39
|
.optional()
|
|
40
|
-
.describe("Artifact name. Required except for inbox, outbox, payments, and tenancy. Feature-owned artifacts use
|
|
40
|
+
.describe("Artifact name. Required except for inbox, outbox, payments, and tenancy. Feature-owned artifacts use identities such as posts.backfill."),
|
|
41
41
|
with: z
|
|
42
42
|
.array(z.enum(makeFeatureAddonChoices))
|
|
43
43
|
.optional()
|
|
44
|
-
.describe("feature only: add feature-owned artifacts such as policy,
|
|
44
|
+
.describe("feature only: add feature-owned artifacts such as policy, factory, seed, event, listener, job, notification, schedule, task, ui, and upload."),
|
|
45
45
|
recipe: z
|
|
46
46
|
.enum(makeFeatureRecipeChoices)
|
|
47
47
|
.optional()
|
|
@@ -49,7 +49,7 @@ const makeInputSchema = {
|
|
|
49
49
|
event: z
|
|
50
50
|
.string()
|
|
51
51
|
.optional()
|
|
52
|
-
.describe("listener only (required): event to listen to, for example posts
|
|
52
|
+
.describe("listener only (required): event to listen to, for example posts.published."),
|
|
53
53
|
cron: z
|
|
54
54
|
.string()
|
|
55
55
|
.optional()
|
|
@@ -62,11 +62,15 @@ const makeInputSchema = {
|
|
|
62
62
|
.boolean()
|
|
63
63
|
.optional()
|
|
64
64
|
.describe("schedule only: generate a Next.js cron route for the schedule."),
|
|
65
|
-
|
|
65
|
+
ui: z
|
|
66
|
+
.boolean()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("upload only: generate a typed React upload client and component."),
|
|
69
|
+
authorization: z
|
|
66
70
|
.boolean()
|
|
67
71
|
.optional()
|
|
68
72
|
.describe("resource only: generate policy metadata and use-case authorization checks for mutating routes."),
|
|
69
|
-
|
|
73
|
+
tenantScoped: z
|
|
70
74
|
.boolean()
|
|
71
75
|
.optional()
|
|
72
76
|
.describe("resource only: generate tenant-scoped schemas, repository methods, and use-case checks."),
|
|
@@ -174,7 +178,7 @@ async function runMakeTool(cwd, input) {
|
|
|
174
178
|
return makeJob(base);
|
|
175
179
|
case "listener":
|
|
176
180
|
if (!input.event) {
|
|
177
|
-
throw new Error("make listener requires an event, for example event: posts
|
|
181
|
+
throw new Error("make listener requires an event, for example event: posts.published.");
|
|
178
182
|
}
|
|
179
183
|
return makeListener({ ...base, event: input.event });
|
|
180
184
|
case "notification":
|
|
@@ -186,8 +190,8 @@ async function runMakeTool(cwd, input) {
|
|
|
186
190
|
case "resource":
|
|
187
191
|
return makeResource({
|
|
188
192
|
...base,
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
authorization: input.authorization,
|
|
194
|
+
tenantScoped: input.tenantScoped,
|
|
191
195
|
events: input.events,
|
|
192
196
|
softDelete: input.softDelete,
|
|
193
197
|
});
|
|
@@ -205,7 +209,7 @@ async function runMakeTool(cwd, input) {
|
|
|
205
209
|
case "test":
|
|
206
210
|
return makeTest(base);
|
|
207
211
|
case "upload":
|
|
208
|
-
return makeUpload(base);
|
|
212
|
+
return makeUpload({ ...base, ui: input.ui });
|
|
209
213
|
case "use-case":
|
|
210
214
|
return makeUseCase(base);
|
|
211
215
|
}
|
|
@@ -284,13 +288,13 @@ export function buildBeignetMcpServer(options) {
|
|
|
284
288
|
return jsonResult(await lintApp({ cwd }));
|
|
285
289
|
}));
|
|
286
290
|
server.registerTool("make", {
|
|
287
|
-
description: "Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, inbox, job, listener, notification, outbox, payments, policy, port, resource, schedule, seed, task, tenancy, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts
|
|
291
|
+
description: "Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, inbox, job, listener, notification, outbox, payments, policy, port, resource, schedule, seed, task, tenancy, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts authorization, tenantScoped, events, softDelete; listener requires event; schedule accepts cron, timezone, route; upload accepts ui. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
|
|
288
292
|
inputSchema: makeInputSchema,
|
|
289
293
|
}, async (input) => safeToolResult(async () => {
|
|
290
294
|
return jsonResult(await runMakeTool(cwd, input));
|
|
291
295
|
}));
|
|
292
296
|
server.registerTool("provider_add", {
|
|
293
|
-
description: `Add a Beignet provider setup preset to this app. Updates dependencies, provider registration, app port wiring, .env.example, and docs/
|
|
297
|
+
description: `Add a Beignet provider setup preset to this app. Updates dependencies, provider registration, app port wiring, .env.example, and docs/providers.md. Presets: ${providerPresetDescription}. Supports dryRun.`,
|
|
294
298
|
inputSchema: providerAddInputSchema,
|
|
295
299
|
}, async (input) => safeToolResult(async () => {
|
|
296
300
|
return jsonResult(await runProviderAddTool(cwd, input));
|
package/dist/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,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AAS,CAAC,CAAC;IAChC,MAAM,MAAM,CAAC;AACf,CAAC"}
|
package/dist/provider-add.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ProviderPresetName, type StarterProviderName } from "./choices.js";
|
|
2
2
|
export type AddProviderPresetOptions = {
|
|
3
3
|
name: ProviderPresetName | string;
|
|
4
4
|
cwd?: string;
|
|
@@ -15,14 +15,32 @@ export type AddProviderPresetResult = {
|
|
|
15
15
|
skippedFiles: string[];
|
|
16
16
|
nextSteps: string[];
|
|
17
17
|
};
|
|
18
|
+
type ProviderPlanFile = {
|
|
19
|
+
path: string;
|
|
20
|
+
content: string;
|
|
21
|
+
};
|
|
22
|
+
export type CreateProviderPresetPlan = {
|
|
23
|
+
files: ProviderPlanFile[];
|
|
24
|
+
presets: AddProviderPresetResult[];
|
|
25
|
+
};
|
|
18
26
|
/**
|
|
19
27
|
* Whether a preset ships `.env.example` entries the user must fill in.
|
|
20
28
|
*/
|
|
21
29
|
export declare function providerPresetNeedsEnv(name: ProviderPresetName): boolean;
|
|
22
30
|
/**
|
|
23
31
|
* Fail fast when a create-time selection combines presets or template
|
|
24
|
-
*
|
|
32
|
+
* starter providers that fill the same app port, before any files are written.
|
|
25
33
|
*/
|
|
26
|
-
export declare function assertCompatibleCreatePresets(presetNames: readonly ProviderPresetName[],
|
|
34
|
+
export declare function assertCompatibleCreatePresets(presetNames: readonly ProviderPresetName[], starterProviders: readonly StarterProviderName[]): void;
|
|
27
35
|
export declare function addProviderPreset(options: AddProviderPresetOptions): Promise<AddProviderPresetResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Apply provider presets to an in-memory fresh scaffold. Each preset reads the
|
|
38
|
+
* previous preset's output so dry runs model the real sequential create path.
|
|
39
|
+
*/
|
|
40
|
+
export declare function planProviderPresetsForCreate(options: {
|
|
41
|
+
targetDir: string;
|
|
42
|
+
files: readonly ProviderPlanFile[];
|
|
43
|
+
names: readonly ProviderPresetName[];
|
|
44
|
+
}): Promise<CreateProviderPresetPlan>;
|
|
45
|
+
export {};
|
|
28
46
|
//# sourceMappingURL=provider-add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-add.d.ts","sourceRoot":"","sources":["../src/provider-add.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"provider-add.d.ts","sourceRoot":"","sources":["../src/provider-add.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAgBtB,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAoCF,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACpC,CAAC;AAonBF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAExE;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,SAAS,kBAAkB,EAAE,EAC1C,gBAAgB,EAAE,SAAS,mBAAmB,EAAE,GAC/C,IAAI,CAsBN;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CA6BlC;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,EAAE;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAgCpC"}
|
package/dist/provider-add.js
CHANGED
|
@@ -36,7 +36,7 @@ const presets = {
|
|
|
36
36
|
nextSteps: [
|
|
37
37
|
"Run your package manager install command.",
|
|
38
38
|
"Configure an OpenFeature provider before relying on non-default flag values.",
|
|
39
|
-
"Run beignet
|
|
39
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
"jobs-bullmq": {
|
|
@@ -79,7 +79,7 @@ const presets = {
|
|
|
79
79
|
"Run your package manager install command.",
|
|
80
80
|
"Set BULLMQ_REDIS_URL in .env.local or your deployment environment.",
|
|
81
81
|
"Add a worker entrypoint that runs createBullMQJobWorker(...) in a worker process; dispatched jobs do not execute without one. See the jobs docs page.",
|
|
82
|
-
"Run beignet
|
|
82
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
83
83
|
],
|
|
84
84
|
conflictingProviderEntries: ["createInngestJobsProvider"],
|
|
85
85
|
},
|
|
@@ -121,7 +121,7 @@ const presets = {
|
|
|
121
121
|
"Run your package manager install command.",
|
|
122
122
|
"Set INNGEST_APP_NAME and, for Inngest cloud, INNGEST_EVENT_KEY in .env.local or your deployment environment.",
|
|
123
123
|
"Expose an Inngest serve route with createInngestJobFunction(...) so dispatched jobs execute. See the jobs docs page.",
|
|
124
|
-
"Run beignet
|
|
124
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
125
125
|
],
|
|
126
126
|
conflictingProviderEntries: ["createBullMQJobsProvider"],
|
|
127
127
|
},
|
|
@@ -161,7 +161,7 @@ const presets = {
|
|
|
161
161
|
nextSteps: [
|
|
162
162
|
"Run your package manager install command.",
|
|
163
163
|
"Set RESEND_API_KEY and RESEND_FROM in .env.local or your deployment environment.",
|
|
164
|
-
"Run beignet
|
|
164
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
165
165
|
],
|
|
166
166
|
conflictingProviderEntries: [
|
|
167
167
|
"createSmtpMailProvider",
|
|
@@ -207,7 +207,7 @@ const presets = {
|
|
|
207
207
|
nextSteps: [
|
|
208
208
|
"Run your package manager install command.",
|
|
209
209
|
"Set MAIL_HOST, MAIL_PORT, MAIL_USER, MAIL_PASS, and MAIL_FROM in .env.local or your deployment environment.",
|
|
210
|
-
"Run beignet
|
|
210
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
211
211
|
],
|
|
212
212
|
conflictingProviderEntries: [
|
|
213
213
|
"createResendMailProvider",
|
|
@@ -257,7 +257,7 @@ const presets = {
|
|
|
257
257
|
"Run your package manager install command.",
|
|
258
258
|
"Set STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET in .env.local or your deployment environment.",
|
|
259
259
|
"Run beignet make payments for the full billing slice; Stripe needs its webhook route before subscription state can sync.",
|
|
260
|
-
"Run beignet
|
|
260
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
261
261
|
],
|
|
262
262
|
conflictingProviderEntries: ["createMemoryPaymentsProvider"],
|
|
263
263
|
},
|
|
@@ -297,11 +297,11 @@ const presets = {
|
|
|
297
297
|
nextSteps: [
|
|
298
298
|
"Run your package manager install command.",
|
|
299
299
|
"Set MEILISEARCH_HOST and any needed MEILISEARCH_* values in .env.local or your deployment environment.",
|
|
300
|
-
"Run beignet
|
|
300
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
301
301
|
],
|
|
302
302
|
},
|
|
303
|
-
sentry: {
|
|
304
|
-
name: "sentry",
|
|
303
|
+
"error-reporting-sentry": {
|
|
304
|
+
name: "error-reporting-sentry",
|
|
305
305
|
displayName: "Sentry error reporting",
|
|
306
306
|
importName: "createSentryErrorReportingProvider",
|
|
307
307
|
importFrom: "@beignet/provider-error-reporting-sentry",
|
|
@@ -331,11 +331,11 @@ const presets = {
|
|
|
331
331
|
nextSteps: [
|
|
332
332
|
"Run your package manager install command.",
|
|
333
333
|
"Set SENTRY_DSN in .env.local or your deployment environment.",
|
|
334
|
-
"Run beignet
|
|
334
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
335
335
|
],
|
|
336
336
|
},
|
|
337
|
-
"redis
|
|
338
|
-
name: "redis
|
|
337
|
+
"cache-redis": {
|
|
338
|
+
name: "cache-redis",
|
|
339
339
|
displayName: "Redis cache",
|
|
340
340
|
importName: "createRedisCacheProvider",
|
|
341
341
|
importFrom: "@beignet/provider-cache-redis",
|
|
@@ -370,7 +370,7 @@ const presets = {
|
|
|
370
370
|
nextSteps: [
|
|
371
371
|
"Run your package manager install command.",
|
|
372
372
|
"Set REDIS_URL in .env.local or your deployment environment.",
|
|
373
|
-
"Run beignet
|
|
373
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
374
374
|
],
|
|
375
375
|
},
|
|
376
376
|
"event-bus-redis": {
|
|
@@ -412,12 +412,12 @@ const presets = {
|
|
|
412
412
|
"Run your package manager install command.",
|
|
413
413
|
"Set REDIS_EVENT_BUS_URL in .env.local or your deployment environment.",
|
|
414
414
|
"Keep durable side effects on the outbox/jobs path; Redis Pub/Sub does not replay missed events.",
|
|
415
|
-
"Run beignet
|
|
415
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
416
416
|
],
|
|
417
417
|
conflictingProviderEntries: ["createMemoryEventBusProvider"],
|
|
418
418
|
},
|
|
419
|
-
"redis
|
|
420
|
-
name: "redis
|
|
419
|
+
"locks-redis": {
|
|
420
|
+
name: "locks-redis",
|
|
421
421
|
displayName: "Redis locks",
|
|
422
422
|
importName: "createRedisLocksProvider",
|
|
423
423
|
importFrom: "@beignet/provider-locks-redis",
|
|
@@ -453,11 +453,11 @@ const presets = {
|
|
|
453
453
|
nextSteps: [
|
|
454
454
|
"Run your package manager install command.",
|
|
455
455
|
"Set REDIS_LOCKS_URL in .env.local or your deployment environment.",
|
|
456
|
-
"Run beignet
|
|
456
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
457
457
|
],
|
|
458
458
|
},
|
|
459
|
-
"s3
|
|
460
|
-
name: "s3
|
|
459
|
+
"storage-s3": {
|
|
460
|
+
name: "storage-s3",
|
|
461
461
|
displayName: "S3-compatible storage",
|
|
462
462
|
importName: "createS3StorageProvider",
|
|
463
463
|
importFrom: "@beignet/provider-storage-s3",
|
|
@@ -514,15 +514,15 @@ const presets = {
|
|
|
514
514
|
nextSteps: [
|
|
515
515
|
"Run your package manager install command.",
|
|
516
516
|
"Set STORAGE_S3_BUCKET and any needed STORAGE_S3_* credentials in .env.local or your deployment environment.",
|
|
517
|
-
"Run beignet
|
|
517
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
518
518
|
],
|
|
519
519
|
conflictingProviderEntries: [
|
|
520
520
|
"createLocalStorageProvider",
|
|
521
521
|
"createVercelBlobStorageProvider",
|
|
522
522
|
],
|
|
523
523
|
},
|
|
524
|
-
"vercel-blob
|
|
525
|
-
name: "vercel-blob
|
|
524
|
+
"storage-vercel-blob": {
|
|
525
|
+
name: "storage-vercel-blob",
|
|
526
526
|
displayName: "Vercel Blob storage",
|
|
527
527
|
importName: "createVercelBlobStorageProvider",
|
|
528
528
|
importFrom: "@beignet/provider-storage-vercel-blob",
|
|
@@ -560,15 +560,15 @@ const presets = {
|
|
|
560
560
|
nextSteps: [
|
|
561
561
|
"Run your package manager install command.",
|
|
562
562
|
"Connect a Vercel Blob store to the project (or set BLOB_READ_WRITE_TOKEN manually).",
|
|
563
|
-
"Run beignet
|
|
563
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
564
564
|
],
|
|
565
565
|
conflictingProviderEntries: [
|
|
566
566
|
"createLocalStorageProvider",
|
|
567
567
|
"createS3StorageProvider",
|
|
568
568
|
],
|
|
569
569
|
},
|
|
570
|
-
"
|
|
571
|
-
name: "
|
|
570
|
+
"rate-limit-upstash": {
|
|
571
|
+
name: "rate-limit-upstash",
|
|
572
572
|
displayName: "Upstash rate limit",
|
|
573
573
|
importName: "createUpstashRateLimitProvider",
|
|
574
574
|
importFrom: "@beignet/provider-rate-limit-upstash",
|
|
@@ -606,19 +606,19 @@ const presets = {
|
|
|
606
606
|
nextSteps: [
|
|
607
607
|
"Run your package manager install command.",
|
|
608
608
|
"Set UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN in .env.local or your deployment environment.",
|
|
609
|
-
"Run beignet
|
|
609
|
+
"Run beignet provider audit and beignet doctor --strict.",
|
|
610
610
|
],
|
|
611
611
|
},
|
|
612
612
|
};
|
|
613
613
|
const providerPresetSet = new Set(providerPresetChoices);
|
|
614
614
|
/**
|
|
615
615
|
* Provider entries the starter template wires for each create-time
|
|
616
|
-
*
|
|
616
|
+
* provider, used to pre-validate preset selections at create time.
|
|
617
617
|
*/
|
|
618
|
-
const
|
|
619
|
-
inngest: "createInngestJobsProvider",
|
|
620
|
-
resend: "createResendMailProvider",
|
|
621
|
-
"
|
|
618
|
+
const starterProviderEntries = {
|
|
619
|
+
"jobs-inngest": "createInngestJobsProvider",
|
|
620
|
+
"mail-resend": "createResendMailProvider",
|
|
621
|
+
"rate-limit-upstash": "createUpstashRateLimitProvider",
|
|
622
622
|
};
|
|
623
623
|
/**
|
|
624
624
|
* Whether a preset ships `.env.example` entries the user must fill in.
|
|
@@ -628,12 +628,12 @@ export function providerPresetNeedsEnv(name) {
|
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* Fail fast when a create-time selection combines presets or template
|
|
631
|
-
*
|
|
631
|
+
* starter providers that fill the same app port, before any files are written.
|
|
632
632
|
*/
|
|
633
|
-
export function assertCompatibleCreatePresets(presetNames,
|
|
633
|
+
export function assertCompatibleCreatePresets(presetNames, starterProviders) {
|
|
634
634
|
const selectedEntries = new Map();
|
|
635
|
-
for (const
|
|
636
|
-
selectedEntries.set(
|
|
635
|
+
for (const starterProvider of starterProviders) {
|
|
636
|
+
selectedEntries.set(starterProviderEntries[starterProvider], starterProvider);
|
|
637
637
|
}
|
|
638
638
|
for (const name of presetNames) {
|
|
639
639
|
selectedEntries.set(presets[name].importName, name);
|
|
@@ -642,7 +642,7 @@ export function assertCompatibleCreatePresets(presetNames, integrations) {
|
|
|
642
642
|
for (const conflict of presets[name].conflictingProviderEntries ?? []) {
|
|
643
643
|
const other = selectedEntries.get(conflict);
|
|
644
644
|
if (other !== undefined && other !== name) {
|
|
645
|
-
throw new Error(`--
|
|
645
|
+
throw new Error(`--providers selections "${name}" and "${other}" fill the same app port. Pick one of them.`);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
}
|
|
@@ -654,52 +654,88 @@ export async function addProviderPreset(options) {
|
|
|
654
654
|
const preset = presets[options.name];
|
|
655
655
|
const targetDir = path.resolve(options.cwd ?? process.cwd());
|
|
656
656
|
const config = await loadBeignetConfig(targetDir);
|
|
657
|
+
const readSource = (filePath) => readOptionalAppFile(targetDir, filePath);
|
|
658
|
+
const filesToPlan = await providerPresetFiles(preset, config, readSource);
|
|
659
|
+
const plannedFiles = await planFiles(filesToPlan, readSource);
|
|
660
|
+
if (!options.dryRun) {
|
|
661
|
+
for (const file of plannedFiles) {
|
|
662
|
+
await writePlannedFile(targetDir, file);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return providerPresetResult(preset, targetDir, Boolean(options.dryRun), plannedFiles);
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Apply provider presets to an in-memory fresh scaffold. Each preset reads the
|
|
669
|
+
* previous preset's output so dry runs model the real sequential create path.
|
|
670
|
+
*/
|
|
671
|
+
export async function planProviderPresetsForCreate(options) {
|
|
672
|
+
const sources = new Map(options.files.map((file) => [file.path, file.content]));
|
|
673
|
+
const config = await loadBeignetConfig(options.targetDir);
|
|
674
|
+
const presetResults = [];
|
|
675
|
+
const readSource = async (filePath) => {
|
|
676
|
+
const generatedSource = sources.get(filePath);
|
|
677
|
+
return generatedSource ?? readOptionalAppFile(options.targetDir, filePath);
|
|
678
|
+
};
|
|
679
|
+
for (const name of options.names) {
|
|
680
|
+
const preset = presets[name];
|
|
681
|
+
const filesToPlan = await providerPresetFiles(preset, config, readSource);
|
|
682
|
+
const plannedFiles = await planFiles(filesToPlan, readSource);
|
|
683
|
+
for (const file of plannedFiles) {
|
|
684
|
+
sources.set(file.path, file.content);
|
|
685
|
+
}
|
|
686
|
+
presetResults.push(providerPresetResult(preset, options.targetDir, true, plannedFiles));
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
files: [...sources].map(([filePath, content]) => ({
|
|
690
|
+
path: filePath,
|
|
691
|
+
content,
|
|
692
|
+
})),
|
|
693
|
+
presets: presetResults,
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
async function providerPresetFiles(preset, config, readSource) {
|
|
657
697
|
const packageJsonPath = "package.json";
|
|
658
698
|
const providersPath = serverProvidersPath(config);
|
|
659
|
-
const
|
|
660
|
-
const packageJsonSource = await
|
|
699
|
+
const providersDocsPath = "docs/providers.md";
|
|
700
|
+
const packageJsonSource = await readRequiredSource(readSource, packageJsonPath);
|
|
661
701
|
const packageJson = parsePackageJson(packageJsonSource);
|
|
662
|
-
const
|
|
663
|
-
const
|
|
664
|
-
const filesToPlan = [
|
|
702
|
+
const envExampleContent = updateEnvExample(await readSource(".env.example"), preset);
|
|
703
|
+
const files = [
|
|
665
704
|
{
|
|
666
705
|
path: packageJsonPath,
|
|
667
706
|
content: updatePackageJson(packageJsonSource, packageJson, preset),
|
|
668
707
|
},
|
|
669
708
|
{
|
|
670
709
|
path: providersPath,
|
|
671
|
-
content: updateServerProviders(await
|
|
710
|
+
content: updateServerProviders(await readRequiredSource(readSource, providersPath), preset),
|
|
672
711
|
},
|
|
673
712
|
{
|
|
674
713
|
path: config.paths.ports,
|
|
675
|
-
content: updatePortsFile(await
|
|
714
|
+
content: updatePortsFile(await readRequiredSource(readSource, config.paths.ports), preset.appPort),
|
|
676
715
|
},
|
|
677
716
|
{
|
|
678
717
|
path: config.paths.portWiring,
|
|
679
|
-
content: updateInfrastructurePortsFile(await
|
|
718
|
+
content: updateInfrastructurePortsFile(await readRequiredSource(readSource, config.paths.portWiring), preset.appPort.key),
|
|
680
719
|
},
|
|
681
720
|
{
|
|
682
|
-
path:
|
|
683
|
-
content:
|
|
721
|
+
path: providersDocsPath,
|
|
722
|
+
content: updateProvidersDoc(await readSource(providersDocsPath), preset),
|
|
684
723
|
},
|
|
685
724
|
];
|
|
686
725
|
if (envExampleContent !== undefined) {
|
|
687
|
-
|
|
726
|
+
files.splice(files.length - 1, 0, {
|
|
688
727
|
path: ".env.example",
|
|
689
728
|
content: envExampleContent,
|
|
690
729
|
});
|
|
691
730
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
await writePlannedFile(targetDir, file);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
731
|
+
return files;
|
|
732
|
+
}
|
|
733
|
+
function providerPresetResult(preset, targetDir, dryRun, plannedFiles) {
|
|
698
734
|
return {
|
|
699
735
|
schemaVersion: 1,
|
|
700
736
|
name: preset.name,
|
|
701
737
|
targetDir,
|
|
702
|
-
dryRun
|
|
738
|
+
dryRun,
|
|
703
739
|
files: plannedFiles.map((file) => file.path),
|
|
704
740
|
createdFiles: plannedFiles
|
|
705
741
|
.filter((file) => file.result === "created")
|
|
@@ -713,6 +749,13 @@ export async function addProviderPreset(options) {
|
|
|
713
749
|
nextSteps: preset.nextSteps,
|
|
714
750
|
};
|
|
715
751
|
}
|
|
752
|
+
async function readRequiredSource(readSource, filePath) {
|
|
753
|
+
const content = await readSource(filePath);
|
|
754
|
+
if (content === undefined) {
|
|
755
|
+
throw new Error(`Could not find ${filePath}. Run this command in a Beignet app.`);
|
|
756
|
+
}
|
|
757
|
+
return content;
|
|
758
|
+
}
|
|
716
759
|
function beignetDependencyVersion(packageJson) {
|
|
717
760
|
return (packageJson.dependencies?.["@beignet/core"] ??
|
|
718
761
|
packageJson.dependencies?.["@beignet/next"] ??
|
|
@@ -798,10 +841,10 @@ function updateEnvExample(source, preset) {
|
|
|
798
841
|
}
|
|
799
842
|
return appendSection(current, preset.envExample);
|
|
800
843
|
}
|
|
801
|
-
function
|
|
844
|
+
function updateProvidersDoc(source, preset) {
|
|
802
845
|
const current = source ??
|
|
803
846
|
[
|
|
804
|
-
"#
|
|
847
|
+
"# Providers",
|
|
805
848
|
"",
|
|
806
849
|
"This file tracks app-level provider setup added after the initial scaffold.",
|
|
807
850
|
"",
|
|
@@ -910,10 +953,10 @@ function appendSection(source, section) {
|
|
|
910
953
|
function sortRecord(record) {
|
|
911
954
|
return Object.fromEntries(Object.entries(record).sort(([left], [right]) => left.localeCompare(right)));
|
|
912
955
|
}
|
|
913
|
-
async function planFiles(
|
|
956
|
+
async function planFiles(files, readSource) {
|
|
914
957
|
const planned = [];
|
|
915
958
|
for (const file of files) {
|
|
916
|
-
const existing = await
|
|
959
|
+
const existing = await readSource(file.path);
|
|
917
960
|
planned.push({
|
|
918
961
|
...file,
|
|
919
962
|
result: existing === file.content
|
|
@@ -932,13 +975,6 @@ async function writePlannedFile(targetDir, file) {
|
|
|
932
975
|
await mkdir(path.dirname(destination), { recursive: true });
|
|
933
976
|
await writeFile(destination, file.content);
|
|
934
977
|
}
|
|
935
|
-
async function readRequiredAppFile(targetDir, filePath) {
|
|
936
|
-
const content = await readOptionalAppFile(targetDir, filePath);
|
|
937
|
-
if (content === undefined) {
|
|
938
|
-
throw new Error(`Could not find ${filePath}. Run this command in a Beignet app.`);
|
|
939
|
-
}
|
|
940
|
-
return content;
|
|
941
|
-
}
|
|
942
978
|
async function readOptionalAppFile(targetDir, filePath) {
|
|
943
979
|
const absolutePath = path.join(targetDir, filePath);
|
|
944
980
|
try {
|