create-stackrjs 1.4.0 → 1.5.0
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/index.js +38 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,17 +14,26 @@ var REGISTRY = {
|
|
|
14
14
|
{ value: "postgres", label: "PostgreSQL", status: "stable" },
|
|
15
15
|
{ value: "mysql", label: "MySQL", status: "stable" },
|
|
16
16
|
// MongoDB pairs with the Mongoose ODM (Prisma/Drizzle here are SQL-only).
|
|
17
|
-
{ value: "mongodb", label: "MongoDB", status: "stable", requires: { orm: ["mongoose"] } }
|
|
17
|
+
{ value: "mongodb", label: "MongoDB", status: "stable", requires: { orm: ["mongoose"] } },
|
|
18
|
+
// No database: there is nothing for an ORM to talk to, so it forces "no ORM".
|
|
19
|
+
// NB: shares the value "none" with the ORM dimension, so keep the label generic
|
|
20
|
+
// (OPTION_LABELS is keyed by value across all dimensions).
|
|
21
|
+
{ value: "none", label: "None", status: "stable", requires: { orm: ["none"] } }
|
|
18
22
|
],
|
|
19
23
|
orm: [
|
|
20
|
-
|
|
24
|
+
// Prisma/Drizzle/Mongoose each need a real database to sit on top of.
|
|
25
|
+
{ value: "prisma", label: "Prisma", status: "stable", requires: { database: ["postgres", "mysql", "mongodb"] } },
|
|
21
26
|
// Drizzle is SQL-only: no MongoDB.
|
|
22
27
|
{ value: "drizzle", label: "Drizzle", status: "stable", requires: { database: ["postgres", "mysql"] } },
|
|
23
28
|
// Mongoose is MongoDB-only.
|
|
24
|
-
{ value: "mongoose", label: "Mongoose", status: "stable", requires: { database: ["mongodb"] } }
|
|
29
|
+
{ value: "mongoose", label: "Mongoose", status: "stable", requires: { database: ["mongodb"] } },
|
|
30
|
+
// No data layer: only valid when there is no database either.
|
|
31
|
+
{ value: "none", label: "None", status: "stable", requires: { database: ["none"] } }
|
|
25
32
|
],
|
|
26
33
|
auth: [
|
|
27
|
-
|
|
34
|
+
// NextAuth's credentials provider reads/writes users through an ORM overlay,
|
|
35
|
+
// so it needs a data layer (Prisma / Drizzle / Mongoose).
|
|
36
|
+
{ value: "nextauth", label: "NextAuth (Auth.js)", status: "stable", requires: { orm: ["prisma", "drizzle", "mongoose"] } },
|
|
28
37
|
// Clerk is hosted auth, independent of the chosen ORM/database.
|
|
29
38
|
{ value: "clerk", label: "Clerk", status: "stable" },
|
|
30
39
|
// Supabase Auth is backed by a Supabase Postgres project.
|
|
@@ -598,7 +607,7 @@ function resolveInstallers(selections) {
|
|
|
598
607
|
if (selections.styling === "shadcn") installers.push(shadcnInstaller);
|
|
599
608
|
return installers;
|
|
600
609
|
}
|
|
601
|
-
installers.push(databaseInstaller);
|
|
610
|
+
if (selections.database !== "none") installers.push(databaseInstaller);
|
|
602
611
|
if (selections.orm === "prisma") installers.push(prismaInstaller);
|
|
603
612
|
if (selections.orm === "drizzle") installers.push(drizzleInstaller);
|
|
604
613
|
if (selections.orm === "mongoose") installers.push(mongooseInstaller);
|
|
@@ -630,7 +639,7 @@ function getLayout(architecture) {
|
|
|
630
639
|
// src/helpers/generateReadme.ts
|
|
631
640
|
function generateReadme(selections) {
|
|
632
641
|
const interfaces = selections.interfaces.length ? selections.interfaces.map((i) => `- ${optionLabel(i)}`).join("\n") : "- _(none)_";
|
|
633
|
-
const dbEngine = { postgres: "Postgres", mysql: "MySQL", mongodb: "MongoDB" }[selections.database]
|
|
642
|
+
const dbEngine = { postgres: "Postgres", mysql: "MySQL", mongodb: "MongoDB", none: null }[selections.database];
|
|
634
643
|
const gettingStarted = selections.architecture === "microservices" ? microservicesGettingStarted() : monolithGettingStarted(dbEngine, selections.orm);
|
|
635
644
|
return `# ${selections.projectName}
|
|
636
645
|
|
|
@@ -653,15 +662,16 @@ ${gettingStarted}`;
|
|
|
653
662
|
function monolithGettingStarted(dbEngine, orm) {
|
|
654
663
|
const schemaStep = orm === "prisma" ? "\n# 3. Create the database schema\nnpx prisma migrate dev --name init\n" : orm === "drizzle" ? "\n# 3. Create the database schema\nnpm run db:push\n" : "";
|
|
655
664
|
const dbScriptRows = orm === "prisma" ? "| `npm run db:migrate` | Run Prisma migrations |\n| `npm run db:studio` | Open Prisma Studio |\n" : orm === "drizzle" ? "| `npm run db:push` | Push the schema to the database |\n| `npm run db:studio` | Open Drizzle Studio |\n" : "";
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
\`\`\`bash
|
|
659
|
-
# 1. Start a local ${dbEngine} (requires Docker)
|
|
665
|
+
const dbStep = dbEngine ? `# 1. Start a local ${dbEngine} (requires Docker)
|
|
660
666
|
docker compose up -d
|
|
661
667
|
|
|
662
668
|
# 2. Install dependencies
|
|
663
669
|
npm install
|
|
664
|
-
|
|
670
|
+
` : "# 1. Install dependencies\nnpm install\n";
|
|
671
|
+
return `## Getting started
|
|
672
|
+
|
|
673
|
+
\`\`\`bash
|
|
674
|
+
${dbStep}${schemaStep}
|
|
665
675
|
# Run the app
|
|
666
676
|
npm run dev
|
|
667
677
|
\`\`\`
|
|
@@ -967,7 +977,12 @@ async function runWizard(defaults) {
|
|
|
967
977
|
const selection = {};
|
|
968
978
|
selection.architecture = await selectDimension("Architecture?", "architecture", selection);
|
|
969
979
|
selection.database = await selectDimension("Database?", "database", selection);
|
|
970
|
-
selection.
|
|
980
|
+
if (selection.database === "none") {
|
|
981
|
+
selection.orm = "none";
|
|
982
|
+
p.log.info("No database selected \u2014 skipping the ORM step.");
|
|
983
|
+
} else {
|
|
984
|
+
selection.orm = await selectDimension("ORM / data layer?", "orm", selection);
|
|
985
|
+
}
|
|
971
986
|
selection.auth = await selectDimension("Authentication?", "auth", selection);
|
|
972
987
|
selection.styling = await selectDimension("Styling?", "styling", selection);
|
|
973
988
|
const picked = unwrap(
|
|
@@ -1005,12 +1020,15 @@ function projectNameFromArgs(args) {
|
|
|
1005
1020
|
return positionals[0];
|
|
1006
1021
|
}
|
|
1007
1022
|
function selectionsFromFlags(args) {
|
|
1023
|
+
const database = args.database ?? "postgres";
|
|
1024
|
+
const ormDefault = database === "none" ? "none" : "prisma";
|
|
1025
|
+
const authDefault = database === "none" ? "clerk" : "nextauth";
|
|
1008
1026
|
return {
|
|
1009
1027
|
projectName: projectNameFromArgs(args) ?? "my-app",
|
|
1010
1028
|
architecture: args.architecture ?? "monolith",
|
|
1011
|
-
database
|
|
1012
|
-
orm: args.orm ??
|
|
1013
|
-
auth: args.auth ??
|
|
1029
|
+
database,
|
|
1030
|
+
orm: args.orm ?? ormDefault,
|
|
1031
|
+
auth: args.auth ?? authDefault,
|
|
1014
1032
|
styling: args.styling ?? "tailwind",
|
|
1015
1033
|
interfaces: args.interfaces ?? ["auth-pages"]
|
|
1016
1034
|
};
|
|
@@ -1100,11 +1118,11 @@ Usage:
|
|
|
1100
1118
|
|
|
1101
1119
|
Options:
|
|
1102
1120
|
--architecture <a> monolith (monorepo/microservices/bff: coming soon)
|
|
1103
|
-
--database <db> postgres (mysql/
|
|
1104
|
-
--orm <orm> prisma (drizzle/mongoose
|
|
1105
|
-
--auth <auth> nextauth (clerk/supabase/
|
|
1106
|
-
--styling <s> tailwind (
|
|
1107
|
-
--interfaces <list> comma-separated
|
|
1121
|
+
--database <db> postgres (postgres/mysql/mongodb/none)
|
|
1122
|
+
--orm <orm> prisma (prisma/drizzle/mongoose/none \u2014 none requires --database none)
|
|
1123
|
+
--auth <auth> nextauth (nextauth/clerk/supabase/better-auth; clerk only with --database none)
|
|
1124
|
+
--styling <s> tailwind (tailwind/shadcn)
|
|
1125
|
+
--interfaces <list> comma-separated (auth-pages,dashboard,admin,landing); empty for none
|
|
1108
1126
|
-y, --yes skip the wizard, use flags + defaults
|
|
1109
1127
|
--ci non-interactive: implies --yes --no-install --no-git
|
|
1110
1128
|
--no-install do not run npm install
|