create-prisma 0.4.2-next.37.93.1 → 0.4.2-next.37.98.1
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/README.md +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{create-DGDCo1EV.mjs → create-C5pPk2G0.mjs} +300 -196
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/astro/README.md.hbs +4 -3
- package/templates/create/elysia/README.md.hbs +4 -3
- package/templates/create/hono/README.md.hbs +4 -3
- package/templates/create/minimal/README.md.hbs +4 -3
- package/templates/create/nest/README.md.hbs +4 -3
- package/templates/create/next/README.md.hbs +4 -3
- package/templates/create/nuxt/README.md.hbs +4 -3
- package/templates/create/svelte/README.md.hbs +4 -3
- package/templates/create/tanstack-start/README.md.hbs +4 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Scaffold a new app with Prisma Next already wired up.
|
|
|
8
8
|
|
|
9
9
|
- creates a new app from a supported template
|
|
10
10
|
- adds Prisma Next dependencies for PostgreSQL or MongoDB
|
|
11
|
-
- runs `prisma-next init --no-install` to scaffold `prisma/contract.*`, `prisma-next.config.ts`, `prisma/db.ts`, `prisma-next.md`, `.env.example
|
|
11
|
+
- runs `prisma-next init --no-install` to scaffold `prisma/contract.*`, `prisma-next.config.ts`, `prisma/db.ts`, `prisma-next.md`, and `.env.example`
|
|
12
12
|
- writes a template-specific Prisma Next runtime helper
|
|
13
13
|
- adds `contract:emit`, `db:init`, `db:update`, `db:verify`, `db:seed`, `migration:plan`, `migrate`, `migration:status`, and `migration:show` scripts
|
|
14
14
|
- adds `db:up` / `db:down` and `docker-compose.yml` for default MongoDB projects
|
package/dist/cli.mjs
CHANGED
|
@@ -49,7 +49,7 @@ async function getAnonymousId() {
|
|
|
49
49
|
}
|
|
50
50
|
function getCommonProperties() {
|
|
51
51
|
return {
|
|
52
|
-
"cli-version": "0.4.2-next.37.
|
|
52
|
+
"cli-version": "0.4.2-next.37.98.1",
|
|
53
53
|
"node-version": process.version,
|
|
54
54
|
platform: process.platform,
|
|
55
55
|
arch: process.arch
|
|
@@ -137,61 +137,6 @@ async function trackCreateFailed(params) {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/utils/runtime.ts
|
|
142
|
-
function usesNodeStyleRuntime(packageManager) {
|
|
143
|
-
return packageManager !== void 0 && packageManager !== "bun" && packageManager !== "deno";
|
|
144
|
-
}
|
|
145
|
-
function requiresDotenvConfigImport(packageManager) {
|
|
146
|
-
return usesNodeStyleRuntime(packageManager);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/constants/dependencies.ts
|
|
151
|
-
const dependencyVersionMap = {
|
|
152
|
-
"@elysiajs/node": "^1.4.5",
|
|
153
|
-
"@types/node": "^25.6.2",
|
|
154
|
-
dotenv: "^17.4.2",
|
|
155
|
-
skills: "1.5.7",
|
|
156
|
-
tsx: "^4.21.0"
|
|
157
|
-
};
|
|
158
|
-
const PRISMA_NEXT_PACKAGE_VERSION = "latest";
|
|
159
|
-
function isPrismaNextPackage(packageName) {
|
|
160
|
-
return packageName === "prisma-next" || packageName.startsWith("@prisma-next/");
|
|
161
|
-
}
|
|
162
|
-
function getPrismaNextPackageSpecifier(packageName) {
|
|
163
|
-
return `${packageName}@${PRISMA_NEXT_PACKAGE_VERSION}`;
|
|
164
|
-
}
|
|
165
|
-
function getDependencyVersion(packageName) {
|
|
166
|
-
if (isPrismaNextPackage(packageName)) return PRISMA_NEXT_PACKAGE_VERSION;
|
|
167
|
-
return dependencyVersionMap[packageName];
|
|
168
|
-
}
|
|
169
|
-
function usesViteDevServer(template) {
|
|
170
|
-
return template === "astro" || template === "nuxt" || template === "svelte" || template === "tanstack-start";
|
|
171
|
-
}
|
|
172
|
-
function getCreateTemplateDependencies(template, packageManager) {
|
|
173
|
-
const targets = [];
|
|
174
|
-
if (usesViteDevServer(template)) targets.push({
|
|
175
|
-
packageJsonPath: "package.json",
|
|
176
|
-
dependencies: [],
|
|
177
|
-
devDependencies: ["@prisma-next/vite-plugin-contract-emit"]
|
|
178
|
-
});
|
|
179
|
-
if (template === "minimal" || template === "hono" || template === "elysia" || template === "nest") {
|
|
180
|
-
const runtimeDevDependencies = usesNodeStyleRuntime(packageManager) ? ["tsx"] : [];
|
|
181
|
-
if (template === "elysia" && packageManager !== "deno") targets.push({
|
|
182
|
-
packageJsonPath: "package.json",
|
|
183
|
-
dependencies: ["@elysiajs/node"],
|
|
184
|
-
devDependencies: ["@types/node", ...runtimeDevDependencies]
|
|
185
|
-
});
|
|
186
|
-
else if (runtimeDevDependencies.length > 0) targets.push({
|
|
187
|
-
packageJsonPath: "package.json",
|
|
188
|
-
dependencies: [],
|
|
189
|
-
devDependencies: runtimeDevDependencies
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
return targets;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
140
|
//#endregion
|
|
196
141
|
//#region src/types.ts
|
|
197
142
|
const databaseProviderInputs = [
|
|
@@ -329,11 +274,18 @@ function getPackageManagerManifestValue(packageManager) {
|
|
|
329
274
|
if (!packageManager || packageManager === "deno") return;
|
|
330
275
|
return packageManagerManifestValues[packageManager];
|
|
331
276
|
}
|
|
277
|
+
function getDenoPrismaSpecifier() {
|
|
278
|
+
return "npm:prisma-next";
|
|
279
|
+
}
|
|
280
|
+
function getDenoNpmSpecifier(packageSpecifier) {
|
|
281
|
+
return `npm:${packageSpecifier.replace(/@latest$/, "")}`;
|
|
282
|
+
}
|
|
332
283
|
function getDenoAllowedScriptSpecifiers() {
|
|
333
284
|
return [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
285
|
+
"npm:prisma-next",
|
|
286
|
+
"npm:@prisma-next/postgres",
|
|
287
|
+
"npm:@prisma-next/mongo",
|
|
288
|
+
"npm:mongodb-memory-server"
|
|
337
289
|
].join(",");
|
|
338
290
|
}
|
|
339
291
|
function getInstallCommand(packageManager) {
|
|
@@ -417,7 +369,7 @@ function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
|
417
369
|
args: [
|
|
418
370
|
"run",
|
|
419
371
|
"-A",
|
|
420
|
-
|
|
372
|
+
getDenoNpmSpecifier(packageName),
|
|
421
373
|
...args
|
|
422
374
|
]
|
|
423
375
|
};
|
|
@@ -475,6 +427,15 @@ function getLocalPackageBinaryCommand(packageManager, binaryName, binaryArgs) {
|
|
|
475
427
|
return [execution.command, ...execution.args].join(" ");
|
|
476
428
|
}
|
|
477
429
|
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/utils/runtime.ts
|
|
432
|
+
function usesNodeStyleRuntime(packageManager) {
|
|
433
|
+
return packageManager !== void 0 && packageManager !== "bun" && packageManager !== "deno";
|
|
434
|
+
}
|
|
435
|
+
function requiresDotenvConfigImport(packageManager) {
|
|
436
|
+
return usesNodeStyleRuntime(packageManager);
|
|
437
|
+
}
|
|
438
|
+
|
|
478
439
|
//#endregion
|
|
479
440
|
//#region src/templates/shared.ts
|
|
480
441
|
function getOptionalHashString(hash, key) {
|
|
@@ -586,6 +547,52 @@ async function scaffoldCreateTemplate(opts) {
|
|
|
586
547
|
});
|
|
587
548
|
}
|
|
588
549
|
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/constants/dependencies.ts
|
|
552
|
+
const dependencyVersionMap = {
|
|
553
|
+
"@elysiajs/node": "^1.4.5",
|
|
554
|
+
"@types/node": "^25.6.2",
|
|
555
|
+
dotenv: "^17.4.2",
|
|
556
|
+
"mongodb-memory-server": "^11.1.0",
|
|
557
|
+
tsx: "^4.21.0"
|
|
558
|
+
};
|
|
559
|
+
const PRISMA_NEXT_PACKAGE_VERSION = "latest";
|
|
560
|
+
function isPrismaNextPackage(packageName) {
|
|
561
|
+
return packageName === "prisma-next" || packageName.startsWith("@prisma-next/");
|
|
562
|
+
}
|
|
563
|
+
function getPrismaNextPackageSpecifier(packageName) {
|
|
564
|
+
return `${packageName}@${PRISMA_NEXT_PACKAGE_VERSION}`;
|
|
565
|
+
}
|
|
566
|
+
function getDependencyVersion(packageName) {
|
|
567
|
+
if (isPrismaNextPackage(packageName)) return PRISMA_NEXT_PACKAGE_VERSION;
|
|
568
|
+
return dependencyVersionMap[packageName];
|
|
569
|
+
}
|
|
570
|
+
function usesViteDevServer(template) {
|
|
571
|
+
return template === "astro" || template === "nuxt" || template === "svelte" || template === "tanstack-start";
|
|
572
|
+
}
|
|
573
|
+
function getCreateTemplateDependencies(template, packageManager) {
|
|
574
|
+
const targets = [];
|
|
575
|
+
if (usesViteDevServer(template)) targets.push({
|
|
576
|
+
packageJsonPath: "package.json",
|
|
577
|
+
dependencies: [],
|
|
578
|
+
devDependencies: ["@prisma-next/vite-plugin-contract-emit"]
|
|
579
|
+
});
|
|
580
|
+
if (template === "minimal" || template === "hono" || template === "elysia" || template === "nest") {
|
|
581
|
+
const runtimeDevDependencies = usesNodeStyleRuntime(packageManager) ? ["tsx"] : [];
|
|
582
|
+
if (template === "elysia" && packageManager !== "deno") targets.push({
|
|
583
|
+
packageJsonPath: "package.json",
|
|
584
|
+
dependencies: ["@elysiajs/node"],
|
|
585
|
+
devDependencies: ["@types/node", ...runtimeDevDependencies]
|
|
586
|
+
});
|
|
587
|
+
else if (runtimeDevDependencies.length > 0) targets.push({
|
|
588
|
+
packageJsonPath: "package.json",
|
|
589
|
+
dependencies: [],
|
|
590
|
+
devDependencies: runtimeDevDependencies
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
return targets;
|
|
594
|
+
}
|
|
595
|
+
|
|
589
596
|
//#endregion
|
|
590
597
|
//#region src/constants/db-packages.ts
|
|
591
598
|
function getDbPackages(provider, _packageManager) {
|
|
@@ -602,9 +609,8 @@ function getDbPackages(provider, _packageManager) {
|
|
|
602
609
|
//#endregion
|
|
603
610
|
//#region src/tasks/install.ts
|
|
604
611
|
function getPrismaNextScriptMap(packageManager) {
|
|
605
|
-
const skillsSyncCommand = packageManager === "deno" ? `deno run -A npm:skills@${dependencyVersionMap.skills} experimental_sync --agent "*" -y` : "skills experimental_sync --agent \"*\" -y";
|
|
606
612
|
if (packageManager === "deno") {
|
|
607
|
-
const prismaNextCli = `deno run -A --env-file=.env
|
|
613
|
+
const prismaNextCli = `deno run -A --env-file=.env ${getDenoPrismaSpecifier()}`;
|
|
608
614
|
return {
|
|
609
615
|
"contract:emit": `${prismaNextCli} contract emit`,
|
|
610
616
|
"db:init": `${prismaNextCli} db init`,
|
|
@@ -614,8 +620,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
614
620
|
"migration:plan": `${prismaNextCli} migration plan`,
|
|
615
621
|
migrate: `${prismaNextCli} migrate`,
|
|
616
622
|
"migration:status": `${prismaNextCli} migration status`,
|
|
617
|
-
"migration:show": `${prismaNextCli} migration show
|
|
618
|
-
"skills:sync": skillsSyncCommand
|
|
623
|
+
"migration:show": `${prismaNextCli} migration show`
|
|
619
624
|
};
|
|
620
625
|
}
|
|
621
626
|
if (packageManager === "bun") {
|
|
@@ -629,8 +634,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
629
634
|
"migration:plan": `${prismaNextCli} migration plan`,
|
|
630
635
|
migrate: `${prismaNextCli} migrate`,
|
|
631
636
|
"migration:status": `${prismaNextCli} migration status`,
|
|
632
|
-
"migration:show": `${prismaNextCli} migration show
|
|
633
|
-
"skills:sync": skillsSyncCommand
|
|
637
|
+
"migration:show": `${prismaNextCli} migration show`
|
|
634
638
|
};
|
|
635
639
|
}
|
|
636
640
|
return {
|
|
@@ -642,8 +646,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
642
646
|
"migration:plan": "prisma-next migration plan",
|
|
643
647
|
migrate: "prisma-next migrate",
|
|
644
648
|
"migration:status": "prisma-next migration status",
|
|
645
|
-
"migration:show": "prisma-next migration show"
|
|
646
|
-
"skills:sync": skillsSyncCommand
|
|
649
|
+
"migration:show": "prisma-next migration show"
|
|
647
650
|
};
|
|
648
651
|
}
|
|
649
652
|
function unique(items) {
|
|
@@ -721,9 +724,7 @@ async function writePrismaDependencies(provider, packageManager, authoring, proj
|
|
|
721
724
|
const devDependencies = [
|
|
722
725
|
"prisma-next",
|
|
723
726
|
"@prisma-next/cli",
|
|
724
|
-
"@
|
|
725
|
-
"@types/node",
|
|
726
|
-
"skills"
|
|
727
|
+
"@types/node"
|
|
727
728
|
];
|
|
728
729
|
devDependencies.push(...getGeneratedContractTypePackages(provider));
|
|
729
730
|
devDependencies.push(...getMigrationPackages(provider));
|
|
@@ -823,33 +824,201 @@ const DEFAULT_INSTALL = true;
|
|
|
823
824
|
const DEFAULT_EMIT = true;
|
|
824
825
|
const DEFAULT_INTERACTIVE_PRISMA_POSTGRES = true;
|
|
825
826
|
const DEFAULT_AUTOMATED_PRISMA_POSTGRES = false;
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
retries: 30
|
|
844
|
-
start_period: 5s
|
|
827
|
+
const MONGO_MEMORY_SERVER_SCRIPT = `import { spawn } from "node:child_process";
|
|
828
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
829
|
+
import path from "node:path";
|
|
830
|
+
|
|
831
|
+
const defaultDatabaseUrl = "mongodb://localhost:27017/mydb?replicaSet=rs0&directConnection=true";
|
|
832
|
+
const dataRoot = path.resolve(process.env.MONGO_DB_PATH ?? ".mongo-data");
|
|
833
|
+
const dbPath = path.join(dataRoot, "db");
|
|
834
|
+
const pidFile = path.join(dataRoot, "mongo.pid");
|
|
835
|
+
const logFile = path.join(dataRoot, "mongo.log");
|
|
836
|
+
const readyTimeoutMs = Number(process.env.MONGO_READY_TIMEOUT_MS ?? 60_000);
|
|
837
|
+
|
|
838
|
+
function getMongoConfig() {
|
|
839
|
+
const databaseUrl = process.env.DATABASE_URL ?? defaultDatabaseUrl;
|
|
840
|
+
const url = new URL(databaseUrl);
|
|
841
|
+
if (url.protocol !== "mongodb:") {
|
|
842
|
+
throw new Error("DATABASE_URL must use the mongodb:// protocol.");
|
|
843
|
+
}
|
|
845
844
|
|
|
846
|
-
|
|
847
|
-
|
|
845
|
+
const port = Number(url.port || "27017");
|
|
846
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
847
|
+
throw new Error(\`DATABASE_URL has an invalid MongoDB port: \${url.port}\`);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
return {
|
|
851
|
+
databaseUrl,
|
|
852
|
+
port,
|
|
853
|
+
replSetName: url.searchParams.get("replicaSet") || "rs0",
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function readPid() {
|
|
858
|
+
if (!existsSync(pidFile)) return null;
|
|
859
|
+
const raw = readFileSync(pidFile, "utf8").trim();
|
|
860
|
+
const pid = Number(raw);
|
|
861
|
+
return Number.isFinite(pid) && pid > 0 ? pid : null;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function isAlive(pid) {
|
|
865
|
+
try {
|
|
866
|
+
process.kill(pid, 0);
|
|
867
|
+
return true;
|
|
868
|
+
} catch {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
function getChildCommand() {
|
|
874
|
+
const scriptPath = path.resolve(process.argv[1] ?? "");
|
|
875
|
+
const versions = process.versions;
|
|
876
|
+
if (versions.deno) return { command: process.execPath, args: ["run", "-A", scriptPath, "_run"] };
|
|
877
|
+
return { command: process.execPath, args: [scriptPath, "_run"] };
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
async function runServer() {
|
|
881
|
+
mkdirSync(dbPath, { recursive: true });
|
|
882
|
+
const config = getMongoConfig();
|
|
883
|
+
const memoryServer = await import("mongodb-memory-server");
|
|
884
|
+
const { MongoMemoryReplSet } = memoryServer.default ?? memoryServer;
|
|
885
|
+
const replSet = await MongoMemoryReplSet.create({
|
|
886
|
+
replSet: { name: config.replSetName, count: 1 },
|
|
887
|
+
instanceOpts: [{ port: config.port, storageEngine: "wiredTiger", dbPath }],
|
|
888
|
+
});
|
|
889
|
+
console.log(\`MongoDB server ready for \${config.databaseUrl}\`);
|
|
890
|
+
console.log(\`Data directory: \${dbPath}\`);
|
|
891
|
+
const shutdown = async () => {
|
|
892
|
+
await replSet.stop();
|
|
893
|
+
process.exit(0);
|
|
894
|
+
};
|
|
895
|
+
process.on("SIGINT", shutdown);
|
|
896
|
+
process.on("SIGTERM", shutdown);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
async function up() {
|
|
900
|
+
mkdirSync(dataRoot, { recursive: true });
|
|
901
|
+
const existing = readPid();
|
|
902
|
+
if (existing !== null && isAlive(existing)) {
|
|
903
|
+
console.log(\`MongoDB is already running (PID \${existing}). Use \\\`db:down\\\` to stop.\`);
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
if (existing !== null) rmSync(pidFile, { force: true });
|
|
907
|
+
|
|
908
|
+
writeFileSync(logFile, "");
|
|
909
|
+
const logFd = openSync(logFile, "a");
|
|
910
|
+
const { command, args } = getChildCommand();
|
|
911
|
+
const child = spawn(
|
|
912
|
+
command,
|
|
913
|
+
args,
|
|
914
|
+
{
|
|
915
|
+
detached: true,
|
|
916
|
+
stdio: ["ignore", logFd, logFd],
|
|
917
|
+
env: process.env,
|
|
918
|
+
},
|
|
919
|
+
);
|
|
920
|
+
closeSync(logFd);
|
|
921
|
+
if (typeof child.pid !== "number") throw new Error("Failed to spawn MongoDB child process.");
|
|
922
|
+
writeFileSync(pidFile, String(child.pid));
|
|
923
|
+
child.unref();
|
|
924
|
+
|
|
925
|
+
const start = Date.now();
|
|
926
|
+
while (Date.now() - start < readyTimeoutMs) {
|
|
927
|
+
if (!isAlive(child.pid)) {
|
|
928
|
+
console.error("MongoDB failed to start:");
|
|
929
|
+
console.error(readFileSync(logFile, "utf8"));
|
|
930
|
+
rmSync(pidFile, { force: true });
|
|
931
|
+
process.exit(1);
|
|
932
|
+
}
|
|
933
|
+
const log = readFileSync(logFile, "utf8");
|
|
934
|
+
if (log.includes("MongoDB server ready")) {
|
|
935
|
+
for (const line of log.split("\\n")) {
|
|
936
|
+
if (line.trim().length > 0) console.log(line);
|
|
937
|
+
}
|
|
938
|
+
console.log(\`Detached (PID \${child.pid}). Logs: \${logFile}\`);
|
|
939
|
+
console.log("Stop with \`db:down\` or wipe with \`db:reset\`.");
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
943
|
+
}
|
|
944
|
+
console.error(\`Timed out waiting for MongoDB after \${readyTimeoutMs}ms.\`);
|
|
945
|
+
console.error(readFileSync(logFile, "utf8"));
|
|
946
|
+
try {
|
|
947
|
+
process.kill(child.pid, "SIGTERM");
|
|
948
|
+
} catch {
|
|
949
|
+
// ignore
|
|
950
|
+
}
|
|
951
|
+
rmSync(pidFile, { force: true });
|
|
952
|
+
process.exit(1);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
async function down(wipe) {
|
|
956
|
+
const pid = readPid();
|
|
957
|
+
if (pid !== null && isAlive(pid)) {
|
|
958
|
+
process.kill(pid, "SIGTERM");
|
|
959
|
+
const deadline = Date.now() + 10_000;
|
|
960
|
+
while (Date.now() < deadline && isAlive(pid)) {
|
|
961
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
962
|
+
}
|
|
963
|
+
if (isAlive(pid)) {
|
|
964
|
+
console.warn(\`MongoDB (PID \${pid}) did not exit within 10s; sending SIGKILL.\`);
|
|
965
|
+
try {
|
|
966
|
+
process.kill(pid, "SIGKILL");
|
|
967
|
+
} catch {
|
|
968
|
+
// ignore
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
console.log(\`Stopped MongoDB (PID \${pid}).\`);
|
|
972
|
+
} else if (pid !== null) {
|
|
973
|
+
console.log("MongoDB was not running (stale PID file).");
|
|
974
|
+
} else {
|
|
975
|
+
console.log("MongoDB is not running.");
|
|
976
|
+
}
|
|
977
|
+
rmSync(pidFile, { force: true });
|
|
978
|
+
if (wipe) {
|
|
979
|
+
rmSync(dataRoot, { recursive: true, force: true });
|
|
980
|
+
console.log(\`Removed \${dataRoot}.\`);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
const cmd = process.argv[2] ?? "up";
|
|
985
|
+
switch (cmd) {
|
|
986
|
+
case "up":
|
|
987
|
+
await up();
|
|
988
|
+
break;
|
|
989
|
+
case "down":
|
|
990
|
+
await down(false);
|
|
991
|
+
break;
|
|
992
|
+
case "reset":
|
|
993
|
+
await down(true);
|
|
994
|
+
break;
|
|
995
|
+
case "_run":
|
|
996
|
+
await runServer();
|
|
997
|
+
break;
|
|
998
|
+
default:
|
|
999
|
+
console.error(\`Unknown command: \${cmd}. Use: up | down | reset\`);
|
|
1000
|
+
process.exit(2);
|
|
1001
|
+
}
|
|
848
1002
|
`;
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1003
|
+
function getMongoMemoryScripts(packageManager) {
|
|
1004
|
+
switch (packageManager) {
|
|
1005
|
+
case "bun": return {
|
|
1006
|
+
"db:up": "bun --env-file=.env scripts/mongo.mjs up",
|
|
1007
|
+
"db:down": "bun --env-file=.env scripts/mongo.mjs down",
|
|
1008
|
+
"db:reset": "bun --env-file=.env scripts/mongo.mjs reset"
|
|
1009
|
+
};
|
|
1010
|
+
case "deno": return {
|
|
1011
|
+
"db:up": "deno run -A --env-file=.env scripts/mongo.mjs up",
|
|
1012
|
+
"db:down": "deno run -A --env-file=.env scripts/mongo.mjs down",
|
|
1013
|
+
"db:reset": "deno run -A --env-file=.env scripts/mongo.mjs reset"
|
|
1014
|
+
};
|
|
1015
|
+
default: return {
|
|
1016
|
+
"db:up": "node --env-file=.env scripts/mongo.mjs up",
|
|
1017
|
+
"db:down": "node --env-file=.env scripts/mongo.mjs down",
|
|
1018
|
+
"db:reset": "node --env-file=.env scripts/mongo.mjs reset"
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
853
1022
|
const requiredPrismaFileGroups = [
|
|
854
1023
|
["prisma/contract.prisma", "prisma/contract.ts"],
|
|
855
1024
|
["prisma-next.config.ts"],
|
|
@@ -1109,16 +1278,30 @@ async function ensurePackageScripts(projectDir, scripts) {
|
|
|
1109
1278
|
}
|
|
1110
1279
|
if (didChange) await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1111
1280
|
}
|
|
1112
|
-
async function
|
|
1113
|
-
const
|
|
1114
|
-
if (await fs.pathExists(
|
|
1115
|
-
await fs.
|
|
1281
|
+
async function ensureMongoMemoryServerScript(projectDir) {
|
|
1282
|
+
const scriptPath = path.join(projectDir, "scripts", "mongo.mjs");
|
|
1283
|
+
if (await fs.pathExists(scriptPath)) return;
|
|
1284
|
+
await fs.ensureDir(path.dirname(scriptPath));
|
|
1285
|
+
await fs.writeFile(scriptPath, MONGO_MEMORY_SERVER_SCRIPT, "utf8");
|
|
1116
1286
|
}
|
|
1117
|
-
async function
|
|
1287
|
+
async function ensureMongoMemoryServerDevDependency(projectDir) {
|
|
1288
|
+
const packageJsonPath = path.join(projectDir, "package.json");
|
|
1289
|
+
if (!await fs.pathExists(packageJsonPath)) return;
|
|
1290
|
+
const packageJson = await fs.readJson(packageJsonPath);
|
|
1291
|
+
if (!packageJson.devDependencies) packageJson.devDependencies = {};
|
|
1292
|
+
const memoryServerVersion = getDependencyVersion("mongodb-memory-server");
|
|
1293
|
+
if (packageJson.devDependencies["mongodb-memory-server"] === memoryServerVersion) return;
|
|
1294
|
+
packageJson.devDependencies["mongodb-memory-server"] = memoryServerVersion;
|
|
1295
|
+
packageJson.devDependencies = Object.fromEntries(Object.entries(packageJson.devDependencies).sort(([a], [b]) => a.localeCompare(b)));
|
|
1296
|
+
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1297
|
+
}
|
|
1298
|
+
async function writeMongoLocalHelpersForContext(context, projectDir) {
|
|
1118
1299
|
if (context.databaseProvider !== "mongo" || context.databaseUrl) return true;
|
|
1119
1300
|
try {
|
|
1120
|
-
await
|
|
1121
|
-
await
|
|
1301
|
+
await ensureMongoMemoryServerScript(projectDir);
|
|
1302
|
+
await ensureMongoMemoryServerDevDependency(projectDir);
|
|
1303
|
+
await ensurePackageScripts(projectDir, getMongoMemoryScripts(context.packageManager));
|
|
1304
|
+
await ensureGitignoreEntry(projectDir, ".mongo-data");
|
|
1122
1305
|
return true;
|
|
1123
1306
|
} catch (error) {
|
|
1124
1307
|
cancel(getCommandErrorMessage(error));
|
|
@@ -1255,77 +1438,6 @@ async function installDependenciesForContext(context, projectDir) {
|
|
|
1255
1438
|
return false;
|
|
1256
1439
|
}
|
|
1257
1440
|
}
|
|
1258
|
-
function getSkillsSyncCliCommand(packageManager) {
|
|
1259
|
-
if (packageManager === "deno") return `deno run -A npm:skills@${dependencyVersionMap.skills} experimental_sync --agent "*" -y`;
|
|
1260
|
-
return getLocalPackageBinaryCommand(packageManager, "skills", [
|
|
1261
|
-
"experimental_sync",
|
|
1262
|
-
"--agent",
|
|
1263
|
-
"*",
|
|
1264
|
-
"-y"
|
|
1265
|
-
]);
|
|
1266
|
-
}
|
|
1267
|
-
function getSkillsSyncCliArgs(packageManager) {
|
|
1268
|
-
if (packageManager === "deno") return {
|
|
1269
|
-
command: "deno",
|
|
1270
|
-
args: [
|
|
1271
|
-
"run",
|
|
1272
|
-
"-A",
|
|
1273
|
-
`npm:skills@${dependencyVersionMap.skills}`,
|
|
1274
|
-
"experimental_sync",
|
|
1275
|
-
"--agent",
|
|
1276
|
-
"*",
|
|
1277
|
-
"-y"
|
|
1278
|
-
]
|
|
1279
|
-
};
|
|
1280
|
-
return getLocalPackageBinaryArgs(packageManager, "skills", [
|
|
1281
|
-
"experimental_sync",
|
|
1282
|
-
"--agent",
|
|
1283
|
-
"*",
|
|
1284
|
-
"-y"
|
|
1285
|
-
]);
|
|
1286
|
-
}
|
|
1287
|
-
async function syncAgentSkillsForContext(context, projectDir) {
|
|
1288
|
-
if (!context.shouldInstall) return { didSyncAgentSkills: false };
|
|
1289
|
-
const claudeDirectory = await prepareClaudeSkillsDirectory(projectDir);
|
|
1290
|
-
const syncCommand = getSkillsSyncCliCommand(context.packageManager);
|
|
1291
|
-
if (context.verbose) log.step(`Running ${syncCommand}`);
|
|
1292
|
-
try {
|
|
1293
|
-
const syncArgs = getSkillsSyncCliArgs(context.packageManager);
|
|
1294
|
-
await execa(syncArgs.command, syncArgs.args, {
|
|
1295
|
-
cwd: projectDir,
|
|
1296
|
-
stdio: context.verbose ? "inherit" : "pipe",
|
|
1297
|
-
env: {
|
|
1298
|
-
...process.env,
|
|
1299
|
-
CI: "1"
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1302
|
-
if (context.verbose) log.success("Prisma Next agent skills synced.");
|
|
1303
|
-
return { didSyncAgentSkills: true };
|
|
1304
|
-
} catch (error) {
|
|
1305
|
-
if (context.verbose) log.warn("Could not sync Prisma Next agent skills.");
|
|
1306
|
-
if (claudeDirectory.didCreateClaudeRoot) await removeEmptyClaudeSkillsDirectory(projectDir);
|
|
1307
|
-
return {
|
|
1308
|
-
didSyncAgentSkills: false,
|
|
1309
|
-
warning: `Agent skill sync failed: ${getCommandErrorMessage(error)}`
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
async function prepareClaudeSkillsDirectory(projectDir) {
|
|
1314
|
-
const claudeRoot = path.join(projectDir, ".claude");
|
|
1315
|
-
const didCreateClaudeRoot = !await fs.pathExists(claudeRoot);
|
|
1316
|
-
try {
|
|
1317
|
-
await fs.ensureDir(path.join(projectDir, CLAUDE_SKILLS_DIR));
|
|
1318
|
-
return { didCreateClaudeRoot };
|
|
1319
|
-
} catch {
|
|
1320
|
-
return { didCreateClaudeRoot: false };
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
async function removeEmptyClaudeSkillsDirectory(projectDir) {
|
|
1324
|
-
const claudeSkillsDir = path.join(projectDir, CLAUDE_SKILLS_DIR);
|
|
1325
|
-
const claudeRoot = path.dirname(claudeSkillsDir);
|
|
1326
|
-
if (await fs.pathExists(claudeSkillsDir) && (await fs.readdir(claudeSkillsDir)).length === 0) await fs.remove(claudeSkillsDir);
|
|
1327
|
-
if (await fs.pathExists(claudeRoot) && (await fs.readdir(claudeRoot)).length === 0) await fs.remove(claudeRoot);
|
|
1328
|
-
}
|
|
1329
1441
|
async function finalizePrismaFilesForContext(context, projectDir, provisionResult) {
|
|
1330
1442
|
try {
|
|
1331
1443
|
await finalizePrismaFiles({
|
|
@@ -1342,7 +1454,7 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
|
|
|
1342
1454
|
}
|
|
1343
1455
|
}
|
|
1344
1456
|
function getPrismaNextCliCommand(packageManager, prismaNextArgs) {
|
|
1345
|
-
if (packageManager === "deno") return `deno run -A --env-file=.env
|
|
1457
|
+
if (packageManager === "deno") return `deno run -A --env-file=.env ${getDenoPrismaSpecifier()} ${prismaNextArgs.join(" ")}`;
|
|
1346
1458
|
return getLocalPackageBinaryCommand(packageManager, "prisma-next", prismaNextArgs);
|
|
1347
1459
|
}
|
|
1348
1460
|
function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
@@ -1352,7 +1464,7 @@ function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
|
1352
1464
|
"run",
|
|
1353
1465
|
"-A",
|
|
1354
1466
|
"--env-file=.env",
|
|
1355
|
-
|
|
1467
|
+
getDenoPrismaSpecifier(),
|
|
1356
1468
|
...prismaNextArgs
|
|
1357
1469
|
]
|
|
1358
1470
|
};
|
|
@@ -1382,24 +1494,19 @@ async function emitPrismaNextContractForContext(context, projectDir) {
|
|
|
1382
1494
|
};
|
|
1383
1495
|
}
|
|
1384
1496
|
}
|
|
1385
|
-
function buildWarningLines(provisionWarning, emitWarning
|
|
1497
|
+
function buildWarningLines(provisionWarning, emitWarning) {
|
|
1386
1498
|
const warningLines = [];
|
|
1387
1499
|
if (provisionWarning) warningLines.push(`- ${provisionWarning}`);
|
|
1388
|
-
if (skillSyncWarning) warningLines.push(`- ${skillSyncWarning}`);
|
|
1389
1500
|
if (emitWarning) warningLines.push(`- ${emitWarning}`);
|
|
1390
1501
|
return warningLines;
|
|
1391
1502
|
}
|
|
1392
1503
|
function buildNextStepsForContext(opts) {
|
|
1393
|
-
const { context, options, didEmitContract
|
|
1504
|
+
const { context, options, didEmitContract } = opts;
|
|
1394
1505
|
const nextSteps = [...options.prependNextSteps ?? []];
|
|
1395
1506
|
if (!context.shouldInstall) nextSteps.push({
|
|
1396
1507
|
command: getInstallCommand(context.packageManager),
|
|
1397
1508
|
description: "Install the project dependencies."
|
|
1398
1509
|
});
|
|
1399
|
-
if (!didSyncAgentSkills) nextSteps.push({
|
|
1400
|
-
command: getRunScriptCommand(context.packageManager, "skills:sync"),
|
|
1401
|
-
description: "Sync the Prisma Next agent skills from installed packages."
|
|
1402
|
-
});
|
|
1403
1510
|
if (!didEmitContract || !context.shouldEmit) nextSteps.push({
|
|
1404
1511
|
command: getRunScriptCommand(context.packageManager, "contract:emit"),
|
|
1405
1512
|
description: "Emit contract.json and TypeScript types from your Prisma Next contract."
|
|
@@ -1410,7 +1517,7 @@ function buildNextStepsForContext(opts) {
|
|
|
1410
1517
|
});
|
|
1411
1518
|
if (context.databaseProvider === "mongo" && !context.databaseUrl) nextSteps.push({
|
|
1412
1519
|
command: getRunScriptCommand(context.packageManager, "db:up"),
|
|
1413
|
-
description: "Start the local MongoDB replica set with
|
|
1520
|
+
description: "Start the local MongoDB replica set with mongodb-memory-server. Stop with `db:down`, wipe with `db:reset`."
|
|
1414
1521
|
});
|
|
1415
1522
|
nextSteps.push({
|
|
1416
1523
|
command: getRunScriptCommand(context.packageManager, "migration:plan"),
|
|
@@ -1433,14 +1540,14 @@ function buildNextStepsForContext(opts) {
|
|
|
1433
1540
|
function formatNextSteps(nextSteps) {
|
|
1434
1541
|
return nextSteps.map((step) => `${step.command}\n ${step.description}`).join("\n\n");
|
|
1435
1542
|
}
|
|
1436
|
-
function formatAgentPrompt(
|
|
1543
|
+
function formatAgentPrompt() {
|
|
1437
1544
|
return [
|
|
1438
1545
|
"Ask your agent:",
|
|
1439
1546
|
"What can I do with Prisma Next?",
|
|
1440
1547
|
"",
|
|
1441
1548
|
"Learn more:",
|
|
1442
1549
|
`Docs: prisma-next.md`,
|
|
1443
|
-
|
|
1550
|
+
"Skills: https://github.com/prisma/prisma-next/tree/main/skills"
|
|
1444
1551
|
].join("\n");
|
|
1445
1552
|
}
|
|
1446
1553
|
async function executePrismaSetupContext(context, options = {}) {
|
|
@@ -1465,34 +1572,31 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1465
1572
|
stopProgressOnFailure();
|
|
1466
1573
|
return false;
|
|
1467
1574
|
}
|
|
1575
|
+
if (!await writeMongoLocalHelpersForContext(context, projectDir)) {
|
|
1576
|
+
stopProgressOnFailure();
|
|
1577
|
+
return false;
|
|
1578
|
+
}
|
|
1468
1579
|
if (context.shouldInstall) progressSpinner?.message("Installing dependencies...");
|
|
1469
1580
|
if (!await installDependenciesForContext(context, projectDir)) {
|
|
1470
1581
|
stopProgressOnFailure();
|
|
1471
1582
|
return false;
|
|
1472
1583
|
}
|
|
1473
|
-
if (context.shouldInstall) progressSpinner?.message("Syncing Prisma Next agent skills...");
|
|
1474
|
-
const skillSyncResult = await syncAgentSkillsForContext(context, projectDir);
|
|
1475
1584
|
progressSpinner?.message("Configuring Prisma Next...");
|
|
1476
1585
|
if (!await finalizePrismaFilesForContext(context, projectDir, provisionResult)) {
|
|
1477
1586
|
stopProgressOnFailure();
|
|
1478
1587
|
return false;
|
|
1479
1588
|
}
|
|
1480
|
-
if (!await writeMongoDockerHelpersForContext(context, projectDir)) {
|
|
1481
|
-
stopProgressOnFailure();
|
|
1482
|
-
return false;
|
|
1483
|
-
}
|
|
1484
1589
|
if (context.shouldEmit && context.shouldInstall) progressSpinner?.message("Emitting Prisma Next contract artifacts...");
|
|
1485
1590
|
const emitResult = await emitPrismaNextContractForContext(context, projectDir);
|
|
1486
|
-
const warningLines = buildWarningLines(provisionResult.warning, emitResult.warning
|
|
1591
|
+
const warningLines = buildWarningLines(provisionResult.warning, emitResult.warning);
|
|
1487
1592
|
const nextSteps = buildNextStepsForContext({
|
|
1488
1593
|
context,
|
|
1489
1594
|
options,
|
|
1490
|
-
didEmitContract: emitResult.didEmitContract
|
|
1491
|
-
didSyncAgentSkills: skillSyncResult.didSyncAgentSkills
|
|
1595
|
+
didEmitContract: emitResult.didEmitContract
|
|
1492
1596
|
});
|
|
1493
1597
|
progressSpinner?.stop("Prisma Next project ready.");
|
|
1494
1598
|
if (warningLines.length > 0) note(warningLines.map((line) => line.replace(/^- /, "")).join("\n"), "Heads up");
|
|
1495
|
-
note(formatAgentPrompt(
|
|
1599
|
+
note(formatAgentPrompt(), "Agent prompt");
|
|
1496
1600
|
if (context.verbose) note(formatNextSteps(nextSteps), "Next steps for Prisma Next");
|
|
1497
1601
|
outro("Prisma Next setup complete.");
|
|
1498
1602
|
return true;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-C5pPk2G0.mjs";
|
|
3
3
|
import { os } from "@orpc/server";
|
|
4
4
|
import { createCli } from "trpc-cli";
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
7
|
-
const CLI_VERSION = "0.4.2-next.37.
|
|
7
|
+
const CLI_VERSION = "0.4.2-next.37.98.1";
|
|
8
8
|
const router = os.router({ create: os.meta({
|
|
9
9
|
description: "Create a new project with Prisma setup",
|
|
10
10
|
default: true,
|
package/package.json
CHANGED
|
@@ -22,8 +22,9 @@ Database helper scripts are added to `package.json`:
|
|
|
22
22
|
|
|
23
23
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
24
24
|
{{#if (eq provider "mongo")}}
|
|
25
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
26
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
25
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
26
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
27
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
27
28
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
28
29
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
29
30
|
{{else}}
|
|
@@ -35,7 +36,7 @@ Database helper scripts are added to `package.json`:
|
|
|
35
36
|
|
|
36
37
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
37
38
|
|
|
38
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
39
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
39
40
|
The Astro Vite dev server also auto-emits Prisma Next contract artifacts when the contract changes.
|
|
40
41
|
|
|
41
42
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
@@ -20,8 +20,9 @@ Database helper scripts are added to `package.json`:
|
|
|
20
20
|
|
|
21
21
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
22
22
|
{{#if (eq provider "mongo")}}
|
|
23
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
24
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
25
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
26
27
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
27
28
|
{{else}}
|
|
@@ -33,7 +34,7 @@ Database helper scripts are added to `package.json`:
|
|
|
33
34
|
|
|
34
35
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
35
36
|
|
|
36
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
37
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
37
38
|
|
|
38
39
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
39
40
|
|
|
@@ -20,8 +20,9 @@ Database helper scripts are added to `package.json`:
|
|
|
20
20
|
|
|
21
21
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
22
22
|
{{#if (eq provider "mongo")}}
|
|
23
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
24
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
25
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
26
27
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
27
28
|
{{else}}
|
|
@@ -33,7 +34,7 @@ Database helper scripts are added to `package.json`:
|
|
|
33
34
|
|
|
34
35
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
35
36
|
|
|
36
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
37
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
37
38
|
|
|
38
39
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
39
40
|
|
|
@@ -19,8 +19,9 @@ Database helper scripts are added to `package.json`:
|
|
|
19
19
|
|
|
20
20
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
21
21
|
{{#if (eq provider "mongo")}}
|
|
22
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
23
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
22
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
23
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
24
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
24
25
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
25
26
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
26
27
|
{{else}}
|
|
@@ -31,7 +32,7 @@ Database helper scripts are added to `package.json`:
|
|
|
31
32
|
{{/if}}
|
|
32
33
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
33
34
|
|
|
34
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
35
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
35
36
|
|
|
36
37
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
37
38
|
|
|
@@ -21,8 +21,9 @@ Database helper scripts are added to `package.json`:
|
|
|
21
21
|
|
|
22
22
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
23
23
|
{{#if (eq provider "mongo")}}
|
|
24
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
25
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
27
28
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
28
29
|
{{else}}
|
|
@@ -34,7 +35,7 @@ Database helper scripts are added to `package.json`:
|
|
|
34
35
|
|
|
35
36
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
36
37
|
|
|
37
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
38
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
38
39
|
|
|
39
40
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
40
41
|
|
|
@@ -20,8 +20,9 @@ Database helper scripts are added to `package.json`:
|
|
|
20
20
|
|
|
21
21
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
22
22
|
{{#if (eq provider "mongo")}}
|
|
23
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
24
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
25
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
26
27
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
27
28
|
{{else}}
|
|
@@ -33,7 +34,7 @@ Database helper scripts are added to `package.json`:
|
|
|
33
34
|
|
|
34
35
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
35
36
|
|
|
36
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
37
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
37
38
|
|
|
38
39
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
39
40
|
|
|
@@ -22,8 +22,9 @@ Database helper scripts are added to `package.json`:
|
|
|
22
22
|
|
|
23
23
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
24
24
|
{{#if (eq provider "mongo")}}
|
|
25
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
26
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
25
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
26
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
27
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
27
28
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
28
29
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
29
30
|
{{else}}
|
|
@@ -35,7 +36,7 @@ Database helper scripts are added to `package.json`:
|
|
|
35
36
|
|
|
36
37
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
37
38
|
|
|
38
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
39
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
39
40
|
The Nuxt Vite dev server also auto-emits Prisma Next contract artifacts when the contract changes.
|
|
40
41
|
|
|
41
42
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
@@ -21,8 +21,9 @@ Database helper scripts are added to `package.json`:
|
|
|
21
21
|
|
|
22
22
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
23
23
|
{{#if (eq provider "mongo")}}
|
|
24
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
25
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
27
28
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
28
29
|
{{else}}
|
|
@@ -34,7 +35,7 @@ Database helper scripts are added to `package.json`:
|
|
|
34
35
|
|
|
35
36
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
36
37
|
|
|
37
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
38
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
38
39
|
The SvelteKit Vite dev server also auto-emits Prisma Next contract artifacts when the contract changes.
|
|
39
40
|
|
|
40
41
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
@@ -21,8 +21,9 @@ Database helper scripts are added to `package.json`:
|
|
|
21
21
|
|
|
22
22
|
- `{{runScriptCommand packageManager "contract:emit"}}` - emit contract artifacts after contract changes
|
|
23
23
|
{{#if (eq provider "mongo")}}
|
|
24
|
-
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set
|
|
25
|
-
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
|
+
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
|
+
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
27
28
|
- `{{runScriptCommand packageManager "migrate"}}` - apply the planned MongoDB migration
|
|
28
29
|
{{else}}
|
|
@@ -34,7 +35,7 @@ Database helper scripts are added to `package.json`:
|
|
|
34
35
|
|
|
35
36
|
- `{{runScriptCommand packageManager "db:seed"}}` - insert sample users manually
|
|
36
37
|
|
|
37
|
-
For provider-specific Prisma Next reference docs, see `prisma-next.md`.
|
|
38
|
+
For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
|
|
38
39
|
The TanStack Start Vite dev server also auto-emits Prisma Next contract artifacts when the contract changes.
|
|
39
40
|
|
|
40
41
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|