create-prisma 0.4.2-pr.38.95.1 → 0.4.2-pr.38.96.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/dist/cli.mjs +1 -1
- package/dist/{create-BBBs_d_m.mjs → create-Djts97KN.mjs} +134 -102
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/astro/README.md.hbs +1 -1
- package/templates/create/elysia/README.md.hbs +1 -1
- package/templates/create/hono/README.md.hbs +1 -1
- package/templates/create/minimal/README.md.hbs +1 -1
- package/templates/create/nest/README.md.hbs +1 -1
- package/templates/create/next/README.md.hbs +1 -1
- package/templates/create/nuxt/README.md.hbs +1 -1
- package/templates/create/svelte/README.md.hbs +1 -1
- package/templates/create/tanstack-start/README.md.hbs +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -40,7 +40,7 @@ async function getAnonymousId() {
|
|
|
40
40
|
}
|
|
41
41
|
function getCommonProperties() {
|
|
42
42
|
return {
|
|
43
|
-
"cli-version": "0.4.2-pr.38.
|
|
43
|
+
"cli-version": "0.4.2-pr.38.96.1",
|
|
44
44
|
"node-version": process.version,
|
|
45
45
|
platform: process.platform,
|
|
46
46
|
arch: process.arch
|
|
@@ -128,60 +128,6 @@ async function trackCreateFailed(params) {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/utils/runtime.ts
|
|
133
|
-
function usesNodeStyleRuntime(packageManager) {
|
|
134
|
-
return packageManager !== void 0 && packageManager !== "bun" && packageManager !== "deno";
|
|
135
|
-
}
|
|
136
|
-
function requiresDotenvConfigImport(packageManager) {
|
|
137
|
-
return usesNodeStyleRuntime(packageManager);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/constants/dependencies.ts
|
|
142
|
-
const dependencyVersionMap = {
|
|
143
|
-
"@elysiajs/node": "^1.4.5",
|
|
144
|
-
"@types/node": "^25.6.2",
|
|
145
|
-
dotenv: "^17.4.2",
|
|
146
|
-
tsx: "^4.21.0"
|
|
147
|
-
};
|
|
148
|
-
const PRISMA_NEXT_PACKAGE_VERSION = "latest";
|
|
149
|
-
function isPrismaNextPackage(packageName) {
|
|
150
|
-
return packageName === "prisma-next" || packageName.startsWith("@prisma-next/");
|
|
151
|
-
}
|
|
152
|
-
function getPrismaNextPackageSpecifier(packageName) {
|
|
153
|
-
return `${packageName}@${PRISMA_NEXT_PACKAGE_VERSION}`;
|
|
154
|
-
}
|
|
155
|
-
function getDependencyVersion(packageName) {
|
|
156
|
-
if (isPrismaNextPackage(packageName)) return PRISMA_NEXT_PACKAGE_VERSION;
|
|
157
|
-
return dependencyVersionMap[packageName];
|
|
158
|
-
}
|
|
159
|
-
function usesViteDevServer(template) {
|
|
160
|
-
return template === "astro" || template === "nuxt" || template === "svelte" || template === "tanstack-start";
|
|
161
|
-
}
|
|
162
|
-
function getCreateTemplateDependencies(template, packageManager) {
|
|
163
|
-
const targets = [];
|
|
164
|
-
if (usesViteDevServer(template)) targets.push({
|
|
165
|
-
packageJsonPath: "package.json",
|
|
166
|
-
dependencies: [],
|
|
167
|
-
devDependencies: ["@prisma-next/vite-plugin-contract-emit"]
|
|
168
|
-
});
|
|
169
|
-
if (template === "minimal" || template === "hono" || template === "elysia" || template === "nest") {
|
|
170
|
-
const runtimeDevDependencies = usesNodeStyleRuntime(packageManager) ? ["tsx"] : [];
|
|
171
|
-
if (template === "elysia" && packageManager !== "deno") targets.push({
|
|
172
|
-
packageJsonPath: "package.json",
|
|
173
|
-
dependencies: ["@elysiajs/node"],
|
|
174
|
-
devDependencies: ["@types/node", ...runtimeDevDependencies]
|
|
175
|
-
});
|
|
176
|
-
else if (runtimeDevDependencies.length > 0) targets.push({
|
|
177
|
-
packageJsonPath: "package.json",
|
|
178
|
-
dependencies: [],
|
|
179
|
-
devDependencies: runtimeDevDependencies
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
return targets;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
131
|
//#endregion
|
|
186
132
|
//#region src/types.ts
|
|
187
133
|
const databaseProviderInputs = [
|
|
@@ -319,11 +265,18 @@ function getPackageManagerManifestValue(packageManager) {
|
|
|
319
265
|
if (!packageManager || packageManager === "deno") return;
|
|
320
266
|
return packageManagerManifestValues[packageManager];
|
|
321
267
|
}
|
|
268
|
+
function getDenoPrismaSpecifier() {
|
|
269
|
+
return "npm:prisma-next";
|
|
270
|
+
}
|
|
271
|
+
function getDenoNpmSpecifier(packageSpecifier) {
|
|
272
|
+
return `npm:${packageSpecifier.replace(/@latest$/, "")}`;
|
|
273
|
+
}
|
|
322
274
|
function getDenoAllowedScriptSpecifiers() {
|
|
323
275
|
return [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
276
|
+
"npm:prisma-next",
|
|
277
|
+
"npm:@prisma-next/postgres",
|
|
278
|
+
"npm:@prisma-next/mongo",
|
|
279
|
+
"npm:mongodb-memory-server"
|
|
327
280
|
].join(",");
|
|
328
281
|
}
|
|
329
282
|
function getInstallCommand(packageManager) {
|
|
@@ -407,7 +360,7 @@ function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
|
407
360
|
args: [
|
|
408
361
|
"run",
|
|
409
362
|
"-A",
|
|
410
|
-
|
|
363
|
+
getDenoNpmSpecifier(packageName),
|
|
411
364
|
...args
|
|
412
365
|
]
|
|
413
366
|
};
|
|
@@ -465,6 +418,15 @@ function getLocalPackageBinaryCommand(packageManager, binaryName, binaryArgs) {
|
|
|
465
418
|
return [execution.command, ...execution.args].join(" ");
|
|
466
419
|
}
|
|
467
420
|
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/utils/runtime.ts
|
|
423
|
+
function usesNodeStyleRuntime(packageManager) {
|
|
424
|
+
return packageManager !== void 0 && packageManager !== "bun" && packageManager !== "deno";
|
|
425
|
+
}
|
|
426
|
+
function requiresDotenvConfigImport(packageManager) {
|
|
427
|
+
return usesNodeStyleRuntime(packageManager);
|
|
428
|
+
}
|
|
429
|
+
|
|
468
430
|
//#endregion
|
|
469
431
|
//#region src/templates/shared.ts
|
|
470
432
|
function getOptionalHashString(hash, key) {
|
|
@@ -576,6 +538,52 @@ async function scaffoldCreateTemplate(opts) {
|
|
|
576
538
|
});
|
|
577
539
|
}
|
|
578
540
|
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/constants/dependencies.ts
|
|
543
|
+
const dependencyVersionMap = {
|
|
544
|
+
"@elysiajs/node": "^1.4.5",
|
|
545
|
+
"@types/node": "^25.6.2",
|
|
546
|
+
dotenv: "^17.4.2",
|
|
547
|
+
"mongodb-memory-server": "^11.1.0",
|
|
548
|
+
tsx: "^4.21.0"
|
|
549
|
+
};
|
|
550
|
+
const PRISMA_NEXT_PACKAGE_VERSION = "latest";
|
|
551
|
+
function isPrismaNextPackage(packageName) {
|
|
552
|
+
return packageName === "prisma-next" || packageName.startsWith("@prisma-next/");
|
|
553
|
+
}
|
|
554
|
+
function getPrismaNextPackageSpecifier(packageName) {
|
|
555
|
+
return `${packageName}@${PRISMA_NEXT_PACKAGE_VERSION}`;
|
|
556
|
+
}
|
|
557
|
+
function getDependencyVersion(packageName) {
|
|
558
|
+
if (isPrismaNextPackage(packageName)) return PRISMA_NEXT_PACKAGE_VERSION;
|
|
559
|
+
return dependencyVersionMap[packageName];
|
|
560
|
+
}
|
|
561
|
+
function usesViteDevServer(template) {
|
|
562
|
+
return template === "astro" || template === "nuxt" || template === "svelte" || template === "tanstack-start";
|
|
563
|
+
}
|
|
564
|
+
function getCreateTemplateDependencies(template, packageManager) {
|
|
565
|
+
const targets = [];
|
|
566
|
+
if (usesViteDevServer(template)) targets.push({
|
|
567
|
+
packageJsonPath: "package.json",
|
|
568
|
+
dependencies: [],
|
|
569
|
+
devDependencies: ["@prisma-next/vite-plugin-contract-emit"]
|
|
570
|
+
});
|
|
571
|
+
if (template === "minimal" || template === "hono" || template === "elysia" || template === "nest") {
|
|
572
|
+
const runtimeDevDependencies = usesNodeStyleRuntime(packageManager) ? ["tsx"] : [];
|
|
573
|
+
if (template === "elysia" && packageManager !== "deno") targets.push({
|
|
574
|
+
packageJsonPath: "package.json",
|
|
575
|
+
dependencies: ["@elysiajs/node"],
|
|
576
|
+
devDependencies: ["@types/node", ...runtimeDevDependencies]
|
|
577
|
+
});
|
|
578
|
+
else if (runtimeDevDependencies.length > 0) targets.push({
|
|
579
|
+
packageJsonPath: "package.json",
|
|
580
|
+
dependencies: [],
|
|
581
|
+
devDependencies: runtimeDevDependencies
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
return targets;
|
|
585
|
+
}
|
|
586
|
+
|
|
579
587
|
//#endregion
|
|
580
588
|
//#region src/constants/db-packages.ts
|
|
581
589
|
function getDbPackages(provider, _packageManager) {
|
|
@@ -593,7 +601,7 @@ function getDbPackages(provider, _packageManager) {
|
|
|
593
601
|
//#region src/tasks/install.ts
|
|
594
602
|
function getPrismaNextScriptMap(packageManager) {
|
|
595
603
|
if (packageManager === "deno") {
|
|
596
|
-
const prismaNextCli = `deno run -A --env-file=.env
|
|
604
|
+
const prismaNextCli = `deno run -A --env-file=.env ${getDenoPrismaSpecifier()}`;
|
|
597
605
|
return {
|
|
598
606
|
"contract:emit": `${prismaNextCli} contract emit`,
|
|
599
607
|
"db:init": `${prismaNextCli} db init`,
|
|
@@ -807,26 +815,43 @@ const DEFAULT_INSTALL = true;
|
|
|
807
815
|
const DEFAULT_EMIT = true;
|
|
808
816
|
const DEFAULT_INTERACTIVE_PRISMA_POSTGRES = true;
|
|
809
817
|
const DEFAULT_AUTOMATED_PRISMA_POSTGRES = false;
|
|
810
|
-
const MONGO_MEMORY_SERVER_VERSION = "^11.1.0";
|
|
811
818
|
const MONGO_MEMORY_SERVER_SCRIPT = `import { spawn } from "node:child_process";
|
|
812
|
-
import { existsSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
819
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
813
820
|
import path from "node:path";
|
|
814
821
|
|
|
822
|
+
const defaultDatabaseUrl = "mongodb://localhost:27017/mydb?replicaSet=rs0&directConnection=true";
|
|
815
823
|
const dbPath = path.resolve(process.env.MONGO_DB_PATH ?? ".mongo-data");
|
|
816
824
|
const pidFile = path.join(dbPath, "mongo.pid");
|
|
817
825
|
const logFile = path.join(dbPath, "mongo.log");
|
|
818
|
-
const port = Number(process.env.MONGO_PORT ?? 27017);
|
|
819
|
-
const replSetName = process.env.MONGO_REPLSET ?? "rs0";
|
|
820
826
|
const readyTimeoutMs = Number(process.env.MONGO_READY_TIMEOUT_MS ?? 60_000);
|
|
821
827
|
|
|
822
|
-
function
|
|
828
|
+
function getMongoConfig() {
|
|
829
|
+
const databaseUrl = process.env.DATABASE_URL ?? defaultDatabaseUrl;
|
|
830
|
+
const url = new URL(databaseUrl);
|
|
831
|
+
if (url.protocol !== "mongodb:") {
|
|
832
|
+
throw new Error("DATABASE_URL must use the mongodb:// protocol.");
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const port = Number(url.port || "27017");
|
|
836
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
837
|
+
throw new Error(\`DATABASE_URL has an invalid MongoDB port: \${url.port}\`);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
return {
|
|
841
|
+
databaseUrl,
|
|
842
|
+
port,
|
|
843
|
+
replSetName: url.searchParams.get("replicaSet") || "rs0",
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
function readPid() {
|
|
823
848
|
if (!existsSync(pidFile)) return null;
|
|
824
849
|
const raw = readFileSync(pidFile, "utf8").trim();
|
|
825
850
|
const pid = Number(raw);
|
|
826
851
|
return Number.isFinite(pid) && pid > 0 ? pid : null;
|
|
827
852
|
}
|
|
828
853
|
|
|
829
|
-
function isAlive(pid
|
|
854
|
+
function isAlive(pid) {
|
|
830
855
|
try {
|
|
831
856
|
process.kill(pid, 0);
|
|
832
857
|
return true;
|
|
@@ -835,22 +860,23 @@ function isAlive(pid: number): boolean {
|
|
|
835
860
|
}
|
|
836
861
|
}
|
|
837
862
|
|
|
838
|
-
function getChildCommand()
|
|
863
|
+
function getChildCommand() {
|
|
839
864
|
const scriptPath = path.resolve(process.argv[1] ?? "");
|
|
840
|
-
const versions = process.versions
|
|
841
|
-
if (versions.bun) return { command: process.execPath, args: [scriptPath, "_run"] };
|
|
865
|
+
const versions = process.versions;
|
|
842
866
|
if (versions.deno) return { command: process.execPath, args: ["run", "-A", scriptPath, "_run"] };
|
|
843
|
-
return { command:
|
|
867
|
+
return { command: process.execPath, args: [scriptPath, "_run"] };
|
|
844
868
|
}
|
|
845
869
|
|
|
846
|
-
async function runServer()
|
|
870
|
+
async function runServer() {
|
|
847
871
|
mkdirSync(dbPath, { recursive: true });
|
|
848
|
-
const
|
|
872
|
+
const config = getMongoConfig();
|
|
873
|
+
const memoryServer = await import("mongodb-memory-server");
|
|
874
|
+
const { MongoMemoryReplSet } = memoryServer.default ?? memoryServer;
|
|
849
875
|
const replSet = await MongoMemoryReplSet.create({
|
|
850
|
-
replSet: { name: replSetName, count: 1, storageEngine: "wiredTiger" },
|
|
851
|
-
instanceOpts: [{ port, storageEngine: "wiredTiger", dbPath }],
|
|
876
|
+
replSet: { name: config.replSetName, count: 1, storageEngine: "wiredTiger" },
|
|
877
|
+
instanceOpts: [{ port: config.port, storageEngine: "wiredTiger", dbPath }],
|
|
852
878
|
});
|
|
853
|
-
console.log(\`MongoDB
|
|
879
|
+
console.log(\`MongoDB server ready for \${config.databaseUrl}\`);
|
|
854
880
|
console.log(\`Data directory: \${dbPath}\`);
|
|
855
881
|
const shutdown = async () => {
|
|
856
882
|
await replSet.stop();
|
|
@@ -860,7 +886,7 @@ async function runServer(): Promise<void> {
|
|
|
860
886
|
process.on("SIGTERM", shutdown);
|
|
861
887
|
}
|
|
862
888
|
|
|
863
|
-
async function up()
|
|
889
|
+
async function up() {
|
|
864
890
|
mkdirSync(dbPath, { recursive: true });
|
|
865
891
|
const existing = readPid();
|
|
866
892
|
if (existing !== null && isAlive(existing)) {
|
|
@@ -872,11 +898,16 @@ async function up(): Promise<void> {
|
|
|
872
898
|
writeFileSync(logFile, "");
|
|
873
899
|
const logFd = openSync(logFile, "a");
|
|
874
900
|
const { command, args } = getChildCommand();
|
|
875
|
-
const child = spawn(
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
901
|
+
const child = spawn(
|
|
902
|
+
command,
|
|
903
|
+
args,
|
|
904
|
+
{
|
|
905
|
+
detached: true,
|
|
906
|
+
stdio: ["ignore", logFd, logFd],
|
|
907
|
+
env: process.env,
|
|
908
|
+
},
|
|
909
|
+
);
|
|
910
|
+
closeSync(logFd);
|
|
880
911
|
if (typeof child.pid !== "number") throw new Error("Failed to spawn MongoDB child process.");
|
|
881
912
|
writeFileSync(pidFile, String(child.pid));
|
|
882
913
|
child.unref();
|
|
@@ -890,7 +921,7 @@ async function up(): Promise<void> {
|
|
|
890
921
|
process.exit(1);
|
|
891
922
|
}
|
|
892
923
|
const log = readFileSync(logFile, "utf8");
|
|
893
|
-
if (log.includes("MongoDB
|
|
924
|
+
if (log.includes("MongoDB server ready")) {
|
|
894
925
|
for (const line of log.split("\\n")) {
|
|
895
926
|
if (line.trim().length > 0) console.log(line);
|
|
896
927
|
}
|
|
@@ -911,7 +942,7 @@ async function up(): Promise<void> {
|
|
|
911
942
|
process.exit(1);
|
|
912
943
|
}
|
|
913
944
|
|
|
914
|
-
async function down(wipe
|
|
945
|
+
async function down(wipe) {
|
|
915
946
|
const pid = readPid();
|
|
916
947
|
if (pid !== null && isAlive(pid)) {
|
|
917
948
|
process.kill(pid, "SIGTERM");
|
|
@@ -962,19 +993,19 @@ switch (cmd) {
|
|
|
962
993
|
function getMongoMemoryScripts(packageManager) {
|
|
963
994
|
switch (packageManager) {
|
|
964
995
|
case "bun": return {
|
|
965
|
-
"db:up": "bun scripts/mongo.
|
|
966
|
-
"db:down": "bun scripts/mongo.
|
|
967
|
-
"db:reset": "bun scripts/mongo.
|
|
996
|
+
"db:up": "bun --env-file=.env scripts/mongo.mjs up",
|
|
997
|
+
"db:down": "bun --env-file=.env scripts/mongo.mjs down",
|
|
998
|
+
"db:reset": "bun --env-file=.env scripts/mongo.mjs reset"
|
|
968
999
|
};
|
|
969
1000
|
case "deno": return {
|
|
970
|
-
"db:up": "deno run -A scripts/mongo.
|
|
971
|
-
"db:down": "deno run -A scripts/mongo.
|
|
972
|
-
"db:reset": "deno run -A scripts/mongo.
|
|
1001
|
+
"db:up": "deno run -A --env-file=.env scripts/mongo.mjs up",
|
|
1002
|
+
"db:down": "deno run -A --env-file=.env scripts/mongo.mjs down",
|
|
1003
|
+
"db:reset": "deno run -A --env-file=.env scripts/mongo.mjs reset"
|
|
973
1004
|
};
|
|
974
1005
|
default: return {
|
|
975
|
-
"db:up": "
|
|
976
|
-
"db:down": "
|
|
977
|
-
"db:reset": "
|
|
1006
|
+
"db:up": "node --env-file=.env scripts/mongo.mjs up",
|
|
1007
|
+
"db:down": "node --env-file=.env scripts/mongo.mjs down",
|
|
1008
|
+
"db:reset": "node --env-file=.env scripts/mongo.mjs reset"
|
|
978
1009
|
};
|
|
979
1010
|
}
|
|
980
1011
|
}
|
|
@@ -1238,7 +1269,7 @@ async function ensurePackageScripts(projectDir, scripts) {
|
|
|
1238
1269
|
if (didChange) await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1239
1270
|
}
|
|
1240
1271
|
async function ensureMongoMemoryServerScript(projectDir) {
|
|
1241
|
-
const scriptPath = path.join(projectDir, "scripts", "mongo.
|
|
1272
|
+
const scriptPath = path.join(projectDir, "scripts", "mongo.mjs");
|
|
1242
1273
|
if (await fs.pathExists(scriptPath)) return;
|
|
1243
1274
|
await fs.ensureDir(path.dirname(scriptPath));
|
|
1244
1275
|
await fs.writeFile(scriptPath, MONGO_MEMORY_SERVER_SCRIPT, "utf8");
|
|
@@ -1248,8 +1279,9 @@ async function ensureMongoMemoryServerDevDependency(projectDir) {
|
|
|
1248
1279
|
if (!await fs.pathExists(packageJsonPath)) return;
|
|
1249
1280
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
1250
1281
|
if (!packageJson.devDependencies) packageJson.devDependencies = {};
|
|
1251
|
-
|
|
1252
|
-
packageJson.devDependencies["mongodb-memory-server"]
|
|
1282
|
+
const memoryServerVersion = getDependencyVersion("mongodb-memory-server");
|
|
1283
|
+
if (packageJson.devDependencies["mongodb-memory-server"] === memoryServerVersion) return;
|
|
1284
|
+
packageJson.devDependencies["mongodb-memory-server"] = memoryServerVersion;
|
|
1253
1285
|
packageJson.devDependencies = Object.fromEntries(Object.entries(packageJson.devDependencies).sort(([a], [b]) => a.localeCompare(b)));
|
|
1254
1286
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1255
1287
|
}
|
|
@@ -1412,7 +1444,7 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
|
|
|
1412
1444
|
}
|
|
1413
1445
|
}
|
|
1414
1446
|
function getPrismaNextCliCommand(packageManager, prismaNextArgs) {
|
|
1415
|
-
if (packageManager === "deno") return `deno run -A --env-file=.env
|
|
1447
|
+
if (packageManager === "deno") return `deno run -A --env-file=.env ${getDenoPrismaSpecifier()} ${prismaNextArgs.join(" ")}`;
|
|
1416
1448
|
return getLocalPackageBinaryCommand(packageManager, "prisma-next", prismaNextArgs);
|
|
1417
1449
|
}
|
|
1418
1450
|
function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
@@ -1422,7 +1454,7 @@ function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
|
1422
1454
|
"run",
|
|
1423
1455
|
"-A",
|
|
1424
1456
|
"--env-file=.env",
|
|
1425
|
-
|
|
1457
|
+
getDenoPrismaSpecifier(),
|
|
1426
1458
|
...prismaNextArgs
|
|
1427
1459
|
]
|
|
1428
1460
|
};
|
|
@@ -1475,7 +1507,7 @@ function buildNextStepsForContext(opts) {
|
|
|
1475
1507
|
});
|
|
1476
1508
|
if (context.databaseProvider === "mongo" && !context.databaseUrl) nextSteps.push({
|
|
1477
1509
|
command: getRunScriptCommand(context.packageManager, "db:up"),
|
|
1478
|
-
description: "Start the local
|
|
1510
|
+
description: "Start the local MongoDB replica set with mongodb-memory-server. Stop with `db:down`, wipe with `db:reset`."
|
|
1479
1511
|
});
|
|
1480
1512
|
nextSteps.push({
|
|
1481
1513
|
command: getRunScriptCommand(context.packageManager, "migration:plan"),
|
|
@@ -1530,6 +1562,10 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1530
1562
|
stopProgressOnFailure();
|
|
1531
1563
|
return false;
|
|
1532
1564
|
}
|
|
1565
|
+
if (!await writeMongoLocalHelpersForContext(context, projectDir)) {
|
|
1566
|
+
stopProgressOnFailure();
|
|
1567
|
+
return false;
|
|
1568
|
+
}
|
|
1533
1569
|
if (context.shouldInstall) progressSpinner?.message("Installing dependencies...");
|
|
1534
1570
|
if (!await installDependenciesForContext(context, projectDir)) {
|
|
1535
1571
|
stopProgressOnFailure();
|
|
@@ -1540,10 +1576,6 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1540
1576
|
stopProgressOnFailure();
|
|
1541
1577
|
return false;
|
|
1542
1578
|
}
|
|
1543
|
-
if (!await writeMongoLocalHelpersForContext(context, projectDir)) {
|
|
1544
|
-
stopProgressOnFailure();
|
|
1545
|
-
return false;
|
|
1546
|
-
}
|
|
1547
1579
|
if (context.shouldEmit && context.shouldInstall) progressSpinner?.message("Emitting Prisma Next contract artifacts...");
|
|
1548
1580
|
const emitResult = await emitPrismaNextContractForContext(context, projectDir);
|
|
1549
1581
|
const warningLines = buildWarningLines(provisionResult.warning, emitResult.warning);
|
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-Djts97KN.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-pr.38.
|
|
7
|
+
const CLI_VERSION = "0.4.2-pr.38.96.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,7 +22,7 @@ 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
|
|
25
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
26
26
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
27
27
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
28
28
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -20,7 +20,7 @@ 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
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
24
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
25
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -20,7 +20,7 @@ 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
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
24
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
25
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -19,7 +19,7 @@ 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
|
|
22
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
23
23
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
24
24
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
25
25
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -21,7 +21,7 @@ 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
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
25
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
26
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
27
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -20,7 +20,7 @@ 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
|
|
23
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
24
24
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
25
25
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
26
26
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -22,7 +22,7 @@ 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
|
|
25
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
26
26
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
27
27
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
28
28
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -21,7 +21,7 @@ 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
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
25
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
26
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
27
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|
|
@@ -21,7 +21,7 @@ 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
|
|
24
|
+
- `{{runScriptCommand packageManager "db:up"}}` - start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
|
|
25
25
|
- `{{runScriptCommand packageManager "db:down"}}` - stop the local MongoDB process (data preserved)
|
|
26
26
|
- `{{runScriptCommand packageManager "db:reset"}}` - stop and wipe `.mongo-data/` for a clean slate
|
|
27
27
|
- `{{runScriptCommand packageManager "migration:plan"}}` - create a MongoDB migration plan
|