create-prisma 0.4.2-pr.38.95.1 → 0.4.2-pr.38.97.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-CaLi2yDi.mjs} +141 -108
- 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.97.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,44 @@ 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
|
|
|
815
|
-
const
|
|
816
|
-
const
|
|
817
|
-
const
|
|
818
|
-
const
|
|
819
|
-
const
|
|
822
|
+
const defaultDatabaseUrl = "mongodb://localhost:27017/mydb?replicaSet=rs0&directConnection=true";
|
|
823
|
+
const dataRoot = path.resolve(process.env.MONGO_DB_PATH ?? ".mongo-data");
|
|
824
|
+
const dbPath = path.join(dataRoot, "db");
|
|
825
|
+
const pidFile = path.join(dataRoot, "mongo.pid");
|
|
826
|
+
const logFile = path.join(dataRoot, "mongo.log");
|
|
820
827
|
const readyTimeoutMs = Number(process.env.MONGO_READY_TIMEOUT_MS ?? 60_000);
|
|
821
828
|
|
|
822
|
-
function
|
|
829
|
+
function getMongoConfig() {
|
|
830
|
+
const databaseUrl = process.env.DATABASE_URL ?? defaultDatabaseUrl;
|
|
831
|
+
const url = new URL(databaseUrl);
|
|
832
|
+
if (url.protocol !== "mongodb:") {
|
|
833
|
+
throw new Error("DATABASE_URL must use the mongodb:// protocol.");
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
const port = Number(url.port || "27017");
|
|
837
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
838
|
+
throw new Error(\`DATABASE_URL has an invalid MongoDB port: \${url.port}\`);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return {
|
|
842
|
+
databaseUrl,
|
|
843
|
+
port,
|
|
844
|
+
replSetName: url.searchParams.get("replicaSet") || "rs0",
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function readPid() {
|
|
823
849
|
if (!existsSync(pidFile)) return null;
|
|
824
850
|
const raw = readFileSync(pidFile, "utf8").trim();
|
|
825
851
|
const pid = Number(raw);
|
|
826
852
|
return Number.isFinite(pid) && pid > 0 ? pid : null;
|
|
827
853
|
}
|
|
828
854
|
|
|
829
|
-
function isAlive(pid
|
|
855
|
+
function isAlive(pid) {
|
|
830
856
|
try {
|
|
831
857
|
process.kill(pid, 0);
|
|
832
858
|
return true;
|
|
@@ -835,22 +861,23 @@ function isAlive(pid: number): boolean {
|
|
|
835
861
|
}
|
|
836
862
|
}
|
|
837
863
|
|
|
838
|
-
function getChildCommand()
|
|
864
|
+
function getChildCommand() {
|
|
839
865
|
const scriptPath = path.resolve(process.argv[1] ?? "");
|
|
840
|
-
const versions = process.versions
|
|
841
|
-
if (versions.bun) return { command: process.execPath, args: [scriptPath, "_run"] };
|
|
866
|
+
const versions = process.versions;
|
|
842
867
|
if (versions.deno) return { command: process.execPath, args: ["run", "-A", scriptPath, "_run"] };
|
|
843
|
-
return { command:
|
|
868
|
+
return { command: process.execPath, args: [scriptPath, "_run"] };
|
|
844
869
|
}
|
|
845
870
|
|
|
846
|
-
async function runServer()
|
|
871
|
+
async function runServer() {
|
|
847
872
|
mkdirSync(dbPath, { recursive: true });
|
|
848
|
-
const
|
|
873
|
+
const config = getMongoConfig();
|
|
874
|
+
const memoryServer = await import("mongodb-memory-server");
|
|
875
|
+
const { MongoMemoryReplSet } = memoryServer.default ?? memoryServer;
|
|
849
876
|
const replSet = await MongoMemoryReplSet.create({
|
|
850
|
-
replSet: { name: replSetName, count: 1
|
|
851
|
-
instanceOpts: [{ port, storageEngine: "wiredTiger", dbPath }],
|
|
877
|
+
replSet: { name: config.replSetName, count: 1 },
|
|
878
|
+
instanceOpts: [{ port: config.port, storageEngine: "wiredTiger", dbPath }],
|
|
852
879
|
});
|
|
853
|
-
console.log(\`MongoDB
|
|
880
|
+
console.log(\`MongoDB server ready for \${config.databaseUrl}\`);
|
|
854
881
|
console.log(\`Data directory: \${dbPath}\`);
|
|
855
882
|
const shutdown = async () => {
|
|
856
883
|
await replSet.stop();
|
|
@@ -860,8 +887,8 @@ async function runServer(): Promise<void> {
|
|
|
860
887
|
process.on("SIGTERM", shutdown);
|
|
861
888
|
}
|
|
862
889
|
|
|
863
|
-
async function up()
|
|
864
|
-
mkdirSync(
|
|
890
|
+
async function up() {
|
|
891
|
+
mkdirSync(dataRoot, { recursive: true });
|
|
865
892
|
const existing = readPid();
|
|
866
893
|
if (existing !== null && isAlive(existing)) {
|
|
867
894
|
console.log(\`MongoDB is already running (PID \${existing}). Use \\\`db:down\\\` to stop.\`);
|
|
@@ -872,11 +899,16 @@ async function up(): Promise<void> {
|
|
|
872
899
|
writeFileSync(logFile, "");
|
|
873
900
|
const logFd = openSync(logFile, "a");
|
|
874
901
|
const { command, args } = getChildCommand();
|
|
875
|
-
const child = spawn(
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
902
|
+
const child = spawn(
|
|
903
|
+
command,
|
|
904
|
+
args,
|
|
905
|
+
{
|
|
906
|
+
detached: true,
|
|
907
|
+
stdio: ["ignore", logFd, logFd],
|
|
908
|
+
env: process.env,
|
|
909
|
+
},
|
|
910
|
+
);
|
|
911
|
+
closeSync(logFd);
|
|
880
912
|
if (typeof child.pid !== "number") throw new Error("Failed to spawn MongoDB child process.");
|
|
881
913
|
writeFileSync(pidFile, String(child.pid));
|
|
882
914
|
child.unref();
|
|
@@ -890,7 +922,7 @@ async function up(): Promise<void> {
|
|
|
890
922
|
process.exit(1);
|
|
891
923
|
}
|
|
892
924
|
const log = readFileSync(logFile, "utf8");
|
|
893
|
-
if (log.includes("MongoDB
|
|
925
|
+
if (log.includes("MongoDB server ready")) {
|
|
894
926
|
for (const line of log.split("\\n")) {
|
|
895
927
|
if (line.trim().length > 0) console.log(line);
|
|
896
928
|
}
|
|
@@ -911,7 +943,7 @@ async function up(): Promise<void> {
|
|
|
911
943
|
process.exit(1);
|
|
912
944
|
}
|
|
913
945
|
|
|
914
|
-
async function down(wipe
|
|
946
|
+
async function down(wipe) {
|
|
915
947
|
const pid = readPid();
|
|
916
948
|
if (pid !== null && isAlive(pid)) {
|
|
917
949
|
process.kill(pid, "SIGTERM");
|
|
@@ -935,8 +967,8 @@ async function down(wipe: boolean): Promise<void> {
|
|
|
935
967
|
}
|
|
936
968
|
rmSync(pidFile, { force: true });
|
|
937
969
|
if (wipe) {
|
|
938
|
-
rmSync(
|
|
939
|
-
console.log(\`Removed \${
|
|
970
|
+
rmSync(dataRoot, { recursive: true, force: true });
|
|
971
|
+
console.log(\`Removed \${dataRoot}.\`);
|
|
940
972
|
}
|
|
941
973
|
}
|
|
942
974
|
|
|
@@ -962,19 +994,19 @@ switch (cmd) {
|
|
|
962
994
|
function getMongoMemoryScripts(packageManager) {
|
|
963
995
|
switch (packageManager) {
|
|
964
996
|
case "bun": return {
|
|
965
|
-
"db:up": "bun scripts/mongo.
|
|
966
|
-
"db:down": "bun scripts/mongo.
|
|
967
|
-
"db:reset": "bun scripts/mongo.
|
|
997
|
+
"db:up": "bun --env-file=.env scripts/mongo.mjs up",
|
|
998
|
+
"db:down": "bun --env-file=.env scripts/mongo.mjs down",
|
|
999
|
+
"db:reset": "bun --env-file=.env scripts/mongo.mjs reset"
|
|
968
1000
|
};
|
|
969
1001
|
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.
|
|
1002
|
+
"db:up": "deno run -A --env-file=.env scripts/mongo.mjs up",
|
|
1003
|
+
"db:down": "deno run -A --env-file=.env scripts/mongo.mjs down",
|
|
1004
|
+
"db:reset": "deno run -A --env-file=.env scripts/mongo.mjs reset"
|
|
973
1005
|
};
|
|
974
1006
|
default: return {
|
|
975
|
-
"db:up": "
|
|
976
|
-
"db:down": "
|
|
977
|
-
"db:reset": "
|
|
1007
|
+
"db:up": "node --env-file=.env scripts/mongo.mjs up",
|
|
1008
|
+
"db:down": "node --env-file=.env scripts/mongo.mjs down",
|
|
1009
|
+
"db:reset": "node --env-file=.env scripts/mongo.mjs reset"
|
|
978
1010
|
};
|
|
979
1011
|
}
|
|
980
1012
|
}
|
|
@@ -1238,7 +1270,7 @@ async function ensurePackageScripts(projectDir, scripts) {
|
|
|
1238
1270
|
if (didChange) await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1239
1271
|
}
|
|
1240
1272
|
async function ensureMongoMemoryServerScript(projectDir) {
|
|
1241
|
-
const scriptPath = path.join(projectDir, "scripts", "mongo.
|
|
1273
|
+
const scriptPath = path.join(projectDir, "scripts", "mongo.mjs");
|
|
1242
1274
|
if (await fs.pathExists(scriptPath)) return;
|
|
1243
1275
|
await fs.ensureDir(path.dirname(scriptPath));
|
|
1244
1276
|
await fs.writeFile(scriptPath, MONGO_MEMORY_SERVER_SCRIPT, "utf8");
|
|
@@ -1248,8 +1280,9 @@ async function ensureMongoMemoryServerDevDependency(projectDir) {
|
|
|
1248
1280
|
if (!await fs.pathExists(packageJsonPath)) return;
|
|
1249
1281
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
1250
1282
|
if (!packageJson.devDependencies) packageJson.devDependencies = {};
|
|
1251
|
-
|
|
1252
|
-
packageJson.devDependencies["mongodb-memory-server"]
|
|
1283
|
+
const memoryServerVersion = getDependencyVersion("mongodb-memory-server");
|
|
1284
|
+
if (packageJson.devDependencies["mongodb-memory-server"] === memoryServerVersion) return;
|
|
1285
|
+
packageJson.devDependencies["mongodb-memory-server"] = memoryServerVersion;
|
|
1253
1286
|
packageJson.devDependencies = Object.fromEntries(Object.entries(packageJson.devDependencies).sort(([a], [b]) => a.localeCompare(b)));
|
|
1254
1287
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
1255
1288
|
}
|
|
@@ -1412,7 +1445,7 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
|
|
|
1412
1445
|
}
|
|
1413
1446
|
}
|
|
1414
1447
|
function getPrismaNextCliCommand(packageManager, prismaNextArgs) {
|
|
1415
|
-
if (packageManager === "deno") return `deno run -A --env-file=.env
|
|
1448
|
+
if (packageManager === "deno") return `deno run -A --env-file=.env ${getDenoPrismaSpecifier()} ${prismaNextArgs.join(" ")}`;
|
|
1416
1449
|
return getLocalPackageBinaryCommand(packageManager, "prisma-next", prismaNextArgs);
|
|
1417
1450
|
}
|
|
1418
1451
|
function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
@@ -1422,7 +1455,7 @@ function getPrismaNextCliArgs(packageManager, prismaNextArgs) {
|
|
|
1422
1455
|
"run",
|
|
1423
1456
|
"-A",
|
|
1424
1457
|
"--env-file=.env",
|
|
1425
|
-
|
|
1458
|
+
getDenoPrismaSpecifier(),
|
|
1426
1459
|
...prismaNextArgs
|
|
1427
1460
|
]
|
|
1428
1461
|
};
|
|
@@ -1475,7 +1508,7 @@ function buildNextStepsForContext(opts) {
|
|
|
1475
1508
|
});
|
|
1476
1509
|
if (context.databaseProvider === "mongo" && !context.databaseUrl) nextSteps.push({
|
|
1477
1510
|
command: getRunScriptCommand(context.packageManager, "db:up"),
|
|
1478
|
-
description: "Start the local
|
|
1511
|
+
description: "Start the local MongoDB replica set with mongodb-memory-server. Stop with `db:down`, wipe with `db:reset`."
|
|
1479
1512
|
});
|
|
1480
1513
|
nextSteps.push({
|
|
1481
1514
|
command: getRunScriptCommand(context.packageManager, "migration:plan"),
|
|
@@ -1530,6 +1563,10 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1530
1563
|
stopProgressOnFailure();
|
|
1531
1564
|
return false;
|
|
1532
1565
|
}
|
|
1566
|
+
if (!await writeMongoLocalHelpersForContext(context, projectDir)) {
|
|
1567
|
+
stopProgressOnFailure();
|
|
1568
|
+
return false;
|
|
1569
|
+
}
|
|
1533
1570
|
if (context.shouldInstall) progressSpinner?.message("Installing dependencies...");
|
|
1534
1571
|
if (!await installDependenciesForContext(context, projectDir)) {
|
|
1535
1572
|
stopProgressOnFailure();
|
|
@@ -1540,10 +1577,6 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1540
1577
|
stopProgressOnFailure();
|
|
1541
1578
|
return false;
|
|
1542
1579
|
}
|
|
1543
|
-
if (!await writeMongoLocalHelpersForContext(context, projectDir)) {
|
|
1544
|
-
stopProgressOnFailure();
|
|
1545
|
-
return false;
|
|
1546
|
-
}
|
|
1547
1580
|
if (context.shouldEmit && context.shouldInstall) progressSpinner?.message("Emitting Prisma Next contract artifacts...");
|
|
1548
1581
|
const emitResult = await emitPrismaNextContractForContext(context, projectDir);
|
|
1549
1582
|
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-CaLi2yDi.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.97.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
|