create-meridian-app 0.1.16 → 0.1.17
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/dist/{chunk-BHKKG34J.js → chunk-HSKUQA7V.js} +102 -5
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,10 @@ function renderPackageJson(vars) {
|
|
|
40
40
|
"@meridianjs/project-member": "latest",
|
|
41
41
|
"@meridianjs/meridian": "latest",
|
|
42
42
|
"dotenv": "^16.0.0",
|
|
43
|
-
...vars.dashboard ? { "@meridianjs/admin-dashboard": "latest" } : {}
|
|
43
|
+
...vars.dashboard ? { "@meridianjs/admin-dashboard": "latest" } : {},
|
|
44
|
+
...Object.fromEntries(
|
|
45
|
+
vars.optionalModules.map((id) => [`@meridianjs/${id}`, "latest"])
|
|
46
|
+
)
|
|
44
47
|
},
|
|
45
48
|
devDependencies: {
|
|
46
49
|
"create-meridian-app": "latest",
|
|
@@ -79,7 +82,59 @@ function renderTsConfig() {
|
|
|
79
82
|
2
|
|
80
83
|
);
|
|
81
84
|
}
|
|
85
|
+
function renderOptionalModuleBlock(id, vars) {
|
|
86
|
+
switch (id) {
|
|
87
|
+
case "google-oauth":
|
|
88
|
+
return ` {
|
|
89
|
+
resolve: "@meridianjs/google-oauth",
|
|
90
|
+
options: {
|
|
91
|
+
clientId: process.env.GOOGLE_CLIENT_ID ?? "",
|
|
92
|
+
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
|
93
|
+
callbackUrl: "http://localhost:${vars.httpPort}/auth/google/callback",
|
|
94
|
+
frontendUrl: "http://localhost:${vars.dashboardPort}",
|
|
95
|
+
},
|
|
96
|
+
},`;
|
|
97
|
+
case "email-sendgrid":
|
|
98
|
+
return ` {
|
|
99
|
+
resolve: "@meridianjs/email-sendgrid",
|
|
100
|
+
options: {
|
|
101
|
+
apiKey: process.env.SENDGRID_API_KEY ?? "",
|
|
102
|
+
fromAddress: process.env.EMAIL_FROM ?? "noreply@example.com",
|
|
103
|
+
},
|
|
104
|
+
},`;
|
|
105
|
+
case "email-resend":
|
|
106
|
+
return ` {
|
|
107
|
+
resolve: "@meridianjs/email-resend",
|
|
108
|
+
options: {
|
|
109
|
+
apiKey: process.env.RESEND_API_KEY ?? "",
|
|
110
|
+
fromAddress: process.env.EMAIL_FROM ?? "noreply@example.com",
|
|
111
|
+
},
|
|
112
|
+
},`;
|
|
113
|
+
case "email-ses":
|
|
114
|
+
return ` {
|
|
115
|
+
resolve: "@meridianjs/email-ses",
|
|
116
|
+
options: {
|
|
117
|
+
fromAddress: process.env.EMAIL_FROM ?? "noreply@example.com",
|
|
118
|
+
region: process.env.AWS_REGION ?? "us-east-1",
|
|
119
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? "",
|
|
120
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? "",
|
|
121
|
+
},
|
|
122
|
+
},`;
|
|
123
|
+
case "storage-s3":
|
|
124
|
+
return ` {
|
|
125
|
+
resolve: "@meridianjs/storage-s3",
|
|
126
|
+
options: {
|
|
127
|
+
bucket: process.env.S3_BUCKET ?? "",
|
|
128
|
+
region: process.env.AWS_REGION ?? "us-east-1",
|
|
129
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? "",
|
|
130
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? "",
|
|
131
|
+
// endpoint: process.env.S3_ENDPOINT, // uncomment for R2 / MinIO
|
|
132
|
+
},
|
|
133
|
+
},`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
82
136
|
function renderMeridianConfig(vars) {
|
|
137
|
+
const optBlocks = vars.optionalModules.map((id) => renderOptionalModuleBlock(id, vars)).join("\n");
|
|
83
138
|
return `import { defineConfig } from "@meridianjs/framework"
|
|
84
139
|
import dotenv from "dotenv"
|
|
85
140
|
dotenv.config()
|
|
@@ -96,7 +151,8 @@ export default defineConfig({
|
|
|
96
151
|
modules: [
|
|
97
152
|
// Infrastructure \u2014 swap for @meridianjs/event-bus-redis in production
|
|
98
153
|
{ resolve: "@meridianjs/event-bus-local" },
|
|
99
|
-
// Core domain modules are automatically loaded by the @meridianjs/meridian plugin
|
|
154
|
+
// Core domain modules are automatically loaded by the @meridianjs/meridian plugin${optBlocks ? `
|
|
155
|
+
${optBlocks}` : ""}
|
|
100
156
|
],
|
|
101
157
|
plugins: [
|
|
102
158
|
{ resolve: "@meridianjs/meridian" },
|
|
@@ -173,12 +229,39 @@ Thumbs.db
|
|
|
173
229
|
`;
|
|
174
230
|
}
|
|
175
231
|
function renderEnvExample(vars) {
|
|
232
|
+
const mods = vars.optionalModules;
|
|
233
|
+
const sections = [];
|
|
234
|
+
if (mods.includes("google-oauth")) {
|
|
235
|
+
sections.push(`# Google OAuth
|
|
236
|
+
GOOGLE_CLIENT_ID=
|
|
237
|
+
GOOGLE_CLIENT_SECRET=`);
|
|
238
|
+
}
|
|
239
|
+
const hasEmail = mods.includes("email-sendgrid") || mods.includes("email-resend") || mods.includes("email-ses");
|
|
240
|
+
if (hasEmail) {
|
|
241
|
+
const emailLines = ["# Email", "EMAIL_FROM=noreply@example.com"];
|
|
242
|
+
if (mods.includes("email-sendgrid")) emailLines.push("SENDGRID_API_KEY=");
|
|
243
|
+
if (mods.includes("email-resend")) emailLines.push("RESEND_API_KEY=");
|
|
244
|
+
sections.push(emailLines.join("\n"));
|
|
245
|
+
}
|
|
246
|
+
if (mods.includes("storage-s3")) {
|
|
247
|
+
sections.push(`# File storage (S3 / compatible)
|
|
248
|
+
S3_BUCKET=
|
|
249
|
+
# S3_ENDPOINT= # uncomment for R2 / MinIO`);
|
|
250
|
+
}
|
|
251
|
+
const hasAws = mods.includes("email-ses") || mods.includes("storage-s3");
|
|
252
|
+
if (hasAws) {
|
|
253
|
+
sections.push(`# AWS credentials (used by ${[mods.includes("email-ses") ? "SES" : "", mods.includes("storage-s3") ? "S3" : ""].filter(Boolean).join(" + ")})
|
|
254
|
+
AWS_REGION=us-east-1
|
|
255
|
+
AWS_ACCESS_KEY_ID=
|
|
256
|
+
AWS_SECRET_ACCESS_KEY=`);
|
|
257
|
+
}
|
|
258
|
+
const optionalEnv = sections.length > 0 ? "\n" + sections.join("\n\n") : "";
|
|
176
259
|
return `# Copy this file to .env and fill in your values
|
|
177
260
|
DATABASE_URL=${vars.databaseUrl}
|
|
178
261
|
PORT=${vars.httpPort}
|
|
179
262
|
JWT_SECRET=changeme-replace-in-production
|
|
180
|
-
${vars.dashboard ? `DASHBOARD_PORT=${vars.dashboardPort}
|
|
181
|
-
`.trimEnd() + "\n";
|
|
263
|
+
${vars.dashboard ? `DASHBOARD_PORT=${vars.dashboardPort}
|
|
264
|
+
` : ""}${optionalEnv}`.trimEnd() + "\n";
|
|
182
265
|
}
|
|
183
266
|
function renderReadme(vars) {
|
|
184
267
|
return `# ${vars.name}
|
|
@@ -541,6 +624,19 @@ async function runNew(projectName) {
|
|
|
541
624
|
message: "Dashboard port",
|
|
542
625
|
initial: 5174
|
|
543
626
|
},
|
|
627
|
+
{
|
|
628
|
+
type: "multiselect",
|
|
629
|
+
name: "optionalModules",
|
|
630
|
+
message: "Optional modules (Space to toggle, Return to confirm)",
|
|
631
|
+
choices: [
|
|
632
|
+
{ title: "Google OAuth \u2014 sign in with Google", value: "google-oauth" },
|
|
633
|
+
{ title: "Email \u2014 SendGrid", value: "email-sendgrid" },
|
|
634
|
+
{ title: "Email \u2014 Resend", value: "email-resend" },
|
|
635
|
+
{ title: "Email \u2014 AWS SES", value: "email-ses" },
|
|
636
|
+
{ title: "File storage \u2014 AWS S3 / compatible", value: "storage-s3" }
|
|
637
|
+
],
|
|
638
|
+
hint: "none selected = add manually later"
|
|
639
|
+
},
|
|
544
640
|
{
|
|
545
641
|
type: "confirm",
|
|
546
642
|
name: "installDeps",
|
|
@@ -555,7 +651,8 @@ async function runNew(projectName) {
|
|
|
555
651
|
databaseUrl: answers.databaseUrl,
|
|
556
652
|
httpPort: answers.httpPort,
|
|
557
653
|
dashboard: answers.dashboard,
|
|
558
|
-
dashboardPort: answers.dashboardPort ?? 5174
|
|
654
|
+
dashboardPort: answers.dashboardPort ?? 5174,
|
|
655
|
+
optionalModules: answers.optionalModules ?? []
|
|
559
656
|
};
|
|
560
657
|
const spinner = ora("Scaffolding project...").start();
|
|
561
658
|
try {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED