create-prisma 0.8.0-pr.57.218.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -13
- package/dist/cli.mjs +1 -1
- package/dist/{create-BHt4J1kk.mjs → create-BeQ3QH6g.mjs} +27 -98
- package/dist/index.d.mts +0 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/_shared/README.md.hbs +0 -33
- package/templates/create/_shared/module.ts.hbs +0 -2
- package/templates/create/_shared/prisma-composer.config.ts.hbs +0 -2
- package/templates/create/_shared/prisma.config.ts.hbs +0 -2
- package/templates/create/_shared/service.ts.hbs +0 -2
- package/templates/create/_shared/src/prisma/composer.ts.hbs +0 -2
- package/templates/create/_shared/src/prisma/db.ts.hbs +0 -12
- package/templates/create/minimal/package.json.hbs +0 -6
- package/templates/create/minimal/src/index.ts.hbs +2 -2
- package/templates/create/_shared/deno.json.hbs +0 -5
package/README.md
CHANGED
|
@@ -7,10 +7,10 @@ Create a Prisma 8 app with Prisma Composer built in.
|
|
|
7
7
|
Use your package manager:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx create-prisma@
|
|
11
|
-
pnpm dlx create-prisma@
|
|
12
|
-
yarn dlx create-prisma@
|
|
13
|
-
bunx create-prisma@
|
|
10
|
+
npx create-prisma@next my-app
|
|
11
|
+
pnpm dlx create-prisma@next my-app
|
|
12
|
+
yarn dlx create-prisma@next my-app
|
|
13
|
+
bunx create-prisma@next my-app
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The CLI initializes Prisma 8 with `prisma@next`, installs dependencies, emits the contract, and generates a deployable Composer app. PostgreSQL projects use Composer's native Prisma Postgres provider, including migrations and a typed runtime client.
|
|
@@ -41,21 +41,13 @@ workspace. Choosing another workspace also updates the Prisma CLI's active works
|
|
|
41
41
|
|
|
42
42
|
PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring. npm, pnpm, Yarn, and Bun are supported.
|
|
43
43
|
|
|
44
|
-
Deno is supported for local minimal PostgreSQL apps:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
deno run -A npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Prisma Compute does not support Deno deployments yet.
|
|
51
|
-
|
|
52
44
|
## Options
|
|
53
45
|
|
|
54
46
|
- positional project name or `--name`
|
|
55
47
|
- `--template`
|
|
56
48
|
- `--provider postgres|postgresql|mongo|mongodb`
|
|
57
49
|
- `--authoring psl|typescript`
|
|
58
|
-
- `--package-manager npm|pnpm|yarn|bun
|
|
50
|
+
- `--package-manager npm|pnpm|yarn|bun`
|
|
59
51
|
- `--deploy` / `--no-deploy`
|
|
60
52
|
- `--workspace <id-or-name>`
|
|
61
53
|
- `--yes`
|
package/dist/cli.mjs
CHANGED
|
@@ -13,12 +13,21 @@ import { execa } from "execa";
|
|
|
13
13
|
import { styleText } from "node:util";
|
|
14
14
|
|
|
15
15
|
//#region src/telemetry/client.ts
|
|
16
|
-
const TELEMETRY_API_KEY = "";
|
|
16
|
+
const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
|
|
17
17
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
18
18
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
19
19
|
const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
20
|
+
function isTruthyEnvValue(value) {
|
|
21
|
+
return [
|
|
22
|
+
"1",
|
|
23
|
+
"true",
|
|
24
|
+
"yes",
|
|
25
|
+
"on"
|
|
26
|
+
].includes(String(value ?? "").trim().toLowerCase());
|
|
27
|
+
}
|
|
20
28
|
function shouldDisableTelemetry() {
|
|
21
|
-
return true;
|
|
29
|
+
if (isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS)) return true;
|
|
30
|
+
return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
|
|
22
31
|
}
|
|
23
32
|
function getTelemetryConfigDir() {
|
|
24
33
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -40,7 +49,7 @@ async function getAnonymousId() {
|
|
|
40
49
|
}
|
|
41
50
|
function getCommonProperties() {
|
|
42
51
|
return {
|
|
43
|
-
"cli-version": "0.8.0
|
|
52
|
+
"cli-version": "0.8.0",
|
|
44
53
|
"node-version": process.version,
|
|
45
54
|
platform: process.platform,
|
|
46
55
|
arch: process.arch
|
|
@@ -138,8 +147,7 @@ const packageManagers = [
|
|
|
138
147
|
"npm",
|
|
139
148
|
"pnpm",
|
|
140
149
|
"yarn",
|
|
141
|
-
"bun"
|
|
142
|
-
"deno"
|
|
150
|
+
"bun"
|
|
143
151
|
];
|
|
144
152
|
const authoringStyles = ["psl", "typescript"];
|
|
145
153
|
const createTemplates = [
|
|
@@ -193,7 +201,6 @@ function parseUserAgent(userAgent) {
|
|
|
193
201
|
if (userAgent?.startsWith("pnpm")) return "pnpm";
|
|
194
202
|
if (userAgent?.startsWith("yarn")) return "yarn";
|
|
195
203
|
if (userAgent?.startsWith("bun")) return "bun";
|
|
196
|
-
if (userAgent?.startsWith("deno")) return "deno";
|
|
197
204
|
if (userAgent?.startsWith("npm")) return "npm";
|
|
198
205
|
return null;
|
|
199
206
|
}
|
|
@@ -208,10 +215,6 @@ async function detectFromPackageJson(projectDir) {
|
|
|
208
215
|
if (!await fs.pathExists(packageJsonPath)) return null;
|
|
209
216
|
return parsePackageManagerField((await fs.readJson(packageJsonPath)).packageManager);
|
|
210
217
|
}
|
|
211
|
-
async function detectFromDenoConfig(projectDir) {
|
|
212
|
-
for (const configFile of ["deno.json", "deno.jsonc"]) if (await fs.pathExists(path.join(projectDir, configFile))) return "deno";
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
218
|
async function detectFromLockfile(projectDir) {
|
|
216
219
|
for (const check of [
|
|
217
220
|
{
|
|
@@ -237,10 +240,6 @@ async function detectFromLockfile(projectDir) {
|
|
|
237
240
|
{
|
|
238
241
|
manager: "npm",
|
|
239
242
|
lockfile: "npm-shrinkwrap.json"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
manager: "deno",
|
|
243
|
-
lockfile: "deno.lock"
|
|
244
243
|
}
|
|
245
244
|
]) if (await fs.pathExists(path.join(projectDir, check.lockfile))) return check.manager;
|
|
246
245
|
return null;
|
|
@@ -250,24 +249,19 @@ async function detectPackageManager(projectDir = process.cwd()) {
|
|
|
250
249
|
if (fromPackageJson) return fromPackageJson;
|
|
251
250
|
const fromLockfile = await detectFromLockfile(projectDir);
|
|
252
251
|
if (fromLockfile) return fromLockfile;
|
|
253
|
-
const fromDenoConfig = await detectFromDenoConfig(projectDir);
|
|
254
|
-
if (fromDenoConfig) return fromDenoConfig;
|
|
255
252
|
const fromUserAgent = parseUserAgent(process.env.npm_config_user_agent);
|
|
256
253
|
if (fromUserAgent) return fromUserAgent;
|
|
257
254
|
return "npm";
|
|
258
255
|
}
|
|
259
256
|
function getPackageManagerManifestValue(packageManager) {
|
|
260
257
|
if (!packageManager) return;
|
|
261
|
-
if (packageManager === "deno") return;
|
|
262
258
|
return packageManagerManifestValues[packageManager];
|
|
263
259
|
}
|
|
264
260
|
function getInstallCommand(packageManager) {
|
|
265
|
-
if (packageManager === "deno") return "deno install --allow-scripts";
|
|
266
261
|
return `${packageManager} install`;
|
|
267
262
|
}
|
|
268
263
|
function getRunScriptCommand(packageManager, scriptName) {
|
|
269
264
|
switch (packageManager) {
|
|
270
|
-
case "deno": return `deno task ${scriptName}`;
|
|
271
265
|
case "bun": return `bun run ${scriptName}`;
|
|
272
266
|
case "pnpm": return `pnpm run ${scriptName}`;
|
|
273
267
|
case "yarn": return `yarn run ${scriptName}`;
|
|
@@ -276,11 +270,6 @@ function getRunScriptCommand(packageManager, scriptName) {
|
|
|
276
270
|
}
|
|
277
271
|
function getRuntimeScriptCommand(packageManager, kind, options) {
|
|
278
272
|
const { sourceEntrypoint, builtEntrypoint } = options;
|
|
279
|
-
if (packageManager === "deno") switch (kind) {
|
|
280
|
-
case "dev": return `deno run -A --env-file=.env --watch ${sourceEntrypoint}`;
|
|
281
|
-
case "build": return `deno check ${sourceEntrypoint}`;
|
|
282
|
-
case "start": return `deno run -A --env-file=.env ${sourceEntrypoint}`;
|
|
283
|
-
}
|
|
284
273
|
if (packageManager === "bun") switch (kind) {
|
|
285
274
|
case "dev": return `bun --watch ${sourceEntrypoint}`;
|
|
286
275
|
case "build": return "tsc --noEmit";
|
|
@@ -293,10 +282,6 @@ function getRuntimeScriptCommand(packageManager, kind, options) {
|
|
|
293
282
|
}
|
|
294
283
|
}
|
|
295
284
|
function getInstallArgs(packageManager) {
|
|
296
|
-
if (packageManager === "deno") return {
|
|
297
|
-
command: "deno",
|
|
298
|
-
args: ["install", "--allow-scripts"]
|
|
299
|
-
};
|
|
300
285
|
return {
|
|
301
286
|
command: packageManager,
|
|
302
287
|
args: ["install"]
|
|
@@ -304,19 +289,6 @@ function getInstallArgs(packageManager) {
|
|
|
304
289
|
}
|
|
305
290
|
function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
306
291
|
switch (packageManager) {
|
|
307
|
-
case "deno": {
|
|
308
|
-
const [packageName, ...args] = commandArgs;
|
|
309
|
-
if (!packageName) throw new Error("Package execution requires a package name.");
|
|
310
|
-
return {
|
|
311
|
-
command: "deno",
|
|
312
|
-
args: [
|
|
313
|
-
"run",
|
|
314
|
-
"-A",
|
|
315
|
-
`npm:${packageName}`,
|
|
316
|
-
...args
|
|
317
|
-
]
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
292
|
case "pnpm": return {
|
|
321
293
|
command: "pnpm",
|
|
322
294
|
args: ["dlx", ...commandArgs]
|
|
@@ -341,10 +313,6 @@ function getPackageExecutionCommand(packageManager, commandArgs) {
|
|
|
341
313
|
}
|
|
342
314
|
function getRunScriptArgs(packageManager, scriptName) {
|
|
343
315
|
switch (packageManager) {
|
|
344
|
-
case "deno": return {
|
|
345
|
-
command: "deno",
|
|
346
|
-
args: ["task", scriptName]
|
|
347
|
-
};
|
|
348
316
|
case "bun": return {
|
|
349
317
|
command: "bun",
|
|
350
318
|
args: ["run", scriptName]
|
|
@@ -479,7 +447,6 @@ const dependencyVersionMap = {
|
|
|
479
447
|
"@types/node": "^25.6.2",
|
|
480
448
|
alchemy: "2.0.0-beta.67",
|
|
481
449
|
arktype: "^2.2.3",
|
|
482
|
-
dotenv: "^17.4.2",
|
|
483
450
|
esbuild: "^0.28.1",
|
|
484
451
|
effect: "4.0.0-beta.103",
|
|
485
452
|
mongodb: "^7.1.0",
|
|
@@ -489,7 +456,6 @@ const dependencyVersionMap = {
|
|
|
489
456
|
typescript: "^5.9.3"
|
|
490
457
|
};
|
|
491
458
|
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@next";
|
|
492
|
-
const PRISMA_DENO_CLI_PACKAGE = "prisma-next";
|
|
493
459
|
function getDependencyVersion(packageName) {
|
|
494
460
|
return dependencyVersionMap[packageName];
|
|
495
461
|
}
|
|
@@ -532,24 +498,6 @@ function getDbPackages(provider) {
|
|
|
532
498
|
//#endregion
|
|
533
499
|
//#region src/tasks/install.ts
|
|
534
500
|
function getPrismaScriptMap(packageManager) {
|
|
535
|
-
if (packageManager === "deno") {
|
|
536
|
-
const prismaCommand = (needsDatabase, ...args) => [
|
|
537
|
-
"deno run -A",
|
|
538
|
-
...needsDatabase ? ["--env-file=.env"] : [],
|
|
539
|
-
`npm:${PRISMA_DENO_CLI_PACKAGE}`,
|
|
540
|
-
...args
|
|
541
|
-
].join(" ");
|
|
542
|
-
return {
|
|
543
|
-
"contract:emit": prismaCommand(false, "contract", "emit"),
|
|
544
|
-
"db:init": prismaCommand(true, "db", "init"),
|
|
545
|
-
"db:update": prismaCommand(true, "db", "update"),
|
|
546
|
-
"db:verify": prismaCommand(true, "db", "verify"),
|
|
547
|
-
"migration:plan": prismaCommand(true, "migration", "plan"),
|
|
548
|
-
migrate: prismaCommand(true, "migrate"),
|
|
549
|
-
"migration:status": prismaCommand(true, "migration", "status"),
|
|
550
|
-
"migration:show": prismaCommand(true, "migration", "show")
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
501
|
const prismaCommand = (...args) => getPackageExecutionCommand(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
|
|
554
502
|
return {
|
|
555
503
|
"contract:emit": prismaCommand("contract", "emit"),
|
|
@@ -563,7 +511,6 @@ function getPrismaScriptMap(packageManager) {
|
|
|
563
511
|
};
|
|
564
512
|
}
|
|
565
513
|
function getComposerScriptMap(packageManager) {
|
|
566
|
-
if (packageManager === "deno") return {};
|
|
567
514
|
const composerCommand = (subcommand, extraArgs = []) => getPackageExecutionCommand(packageManager, [
|
|
568
515
|
PRISMA_PLATFORM_CLI_PACKAGE,
|
|
569
516
|
"composer",
|
|
@@ -616,17 +563,15 @@ async function addPackageDependency(opts) {
|
|
|
616
563
|
async function writePrismaDependencies(provider, packageManager, _authoring, projectDir = process.cwd()) {
|
|
617
564
|
const dependencies = [getDbPackages(provider)];
|
|
618
565
|
if (provider === "mongo") dependencies.push("arktype", "mongodb");
|
|
619
|
-
if (packageManager === "deno") dependencies.push("dotenv");
|
|
620
566
|
await addPackageDependency({
|
|
621
567
|
dependencies,
|
|
622
|
-
devDependencies:
|
|
568
|
+
devDependencies: ["@prisma/cli-engine", "@types/node"],
|
|
623
569
|
scripts: getPrismaScriptMap(packageManager),
|
|
624
570
|
projectDir
|
|
625
571
|
});
|
|
626
572
|
}
|
|
627
573
|
async function writeCreateTemplateDependencies(opts) {
|
|
628
574
|
const { template, packageManager, projectDir = process.cwd() } = opts;
|
|
629
|
-
if (packageManager === "deno") return;
|
|
630
575
|
for (const target of getCreateTemplateDependencies(template, packageManager)) await addPackageDependency({
|
|
631
576
|
dependencies: target.dependencies,
|
|
632
577
|
devDependencies: target.devDependencies,
|
|
@@ -963,8 +908,7 @@ function getPackageManagerHint(option, detected) {
|
|
|
963
908
|
npm: "Node.js default",
|
|
964
909
|
pnpm: "Fast, disk-efficient package manager",
|
|
965
910
|
yarn: "Yarn package manager",
|
|
966
|
-
bun: "Fast runtime and package manager"
|
|
967
|
-
deno: "Deno runtime (minimal PostgreSQL apps)"
|
|
911
|
+
bun: "Fast runtime and package manager"
|
|
968
912
|
};
|
|
969
913
|
return option === detected ? `Detected; ${hints[option]}` : hints[option];
|
|
970
914
|
}
|
|
@@ -972,7 +916,12 @@ async function promptForPackageManager(detected) {
|
|
|
972
916
|
const packageManager = await select({
|
|
973
917
|
message: "Choose package manager",
|
|
974
918
|
initialValue: detected,
|
|
975
|
-
options:
|
|
919
|
+
options: [
|
|
920
|
+
"npm",
|
|
921
|
+
"pnpm",
|
|
922
|
+
"yarn",
|
|
923
|
+
"bun"
|
|
924
|
+
].map((value) => ({
|
|
976
925
|
value,
|
|
977
926
|
label: value,
|
|
978
927
|
hint: getPackageManagerHint(value, detected)
|
|
@@ -1005,10 +954,7 @@ async function collectPrismaSetupContext(input, options = {}) {
|
|
|
1005
954
|
const detectedPackageManager = await detectPackageManager(projectDir);
|
|
1006
955
|
const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
|
|
1007
956
|
if (!packageManager) return;
|
|
1008
|
-
|
|
1009
|
-
if (packageManager === "deno" && options.template && options.template !== "minimal") throw new Error("Deno support currently requires the minimal template.");
|
|
1010
|
-
if (packageManager === "deno" && input.deploy === true) throw new Error("Prisma Compute does not support Deno deployments yet. Use --no-deploy.");
|
|
1011
|
-
const shouldDeploy = packageManager === "deno" ? false : input.deploy ?? (useDefaults ? false : await promptForDeployment());
|
|
957
|
+
const shouldDeploy = input.deploy ?? (useDefaults ? false : await promptForDeployment());
|
|
1012
958
|
if (shouldDeploy === void 0) return;
|
|
1013
959
|
return {
|
|
1014
960
|
projectDir,
|
|
@@ -1035,22 +981,10 @@ function getInitTarget(provider) {
|
|
|
1035
981
|
return provider === "mongo" ? "mongodb" : "postgres";
|
|
1036
982
|
}
|
|
1037
983
|
function getPrismaCliInvocation(packageManager, args) {
|
|
1038
|
-
return getPackageExecutionArgs(packageManager, [
|
|
984
|
+
return getPackageExecutionArgs(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
|
|
1039
985
|
}
|
|
1040
986
|
async function runPrismaInit(context, projectDir) {
|
|
1041
|
-
const args =
|
|
1042
|
-
"init",
|
|
1043
|
-
"--yes",
|
|
1044
|
-
"--no-interactive",
|
|
1045
|
-
"--target",
|
|
1046
|
-
getInitTarget(context.databaseProvider),
|
|
1047
|
-
"--authoring",
|
|
1048
|
-
context.authoring,
|
|
1049
|
-
"--schema-path",
|
|
1050
|
-
getContractPath(context.authoring),
|
|
1051
|
-
"--no-install",
|
|
1052
|
-
"--no-skill"
|
|
1053
|
-
] : [
|
|
987
|
+
const args = [
|
|
1054
988
|
"orm",
|
|
1055
989
|
"init",
|
|
1056
990
|
"--yes",
|
|
@@ -1074,7 +1008,6 @@ async function runPrismaInit(context, projectDir) {
|
|
|
1074
1008
|
CI: "1"
|
|
1075
1009
|
}
|
|
1076
1010
|
});
|
|
1077
|
-
if (context.packageManager === "deno") await fs.remove(path.join(projectDir, "prisma-next.md"));
|
|
1078
1011
|
}
|
|
1079
1012
|
async function ensureGitignoreEntry(projectDir, entry) {
|
|
1080
1013
|
const gitignorePath = path.join(projectDir, ".gitignore");
|
|
@@ -1132,10 +1065,9 @@ function buildNextSteps(context, options) {
|
|
|
1132
1065
|
description: "Composer uses this secret when deploying the MongoDB template."
|
|
1133
1066
|
});
|
|
1134
1067
|
if (options.includeDevNextStep) nextSteps.push({
|
|
1135
|
-
command: getRunScriptCommand(context.packageManager,
|
|
1136
|
-
description:
|
|
1068
|
+
command: getRunScriptCommand(context.packageManager, "dev:composer"),
|
|
1069
|
+
description: "Build and start the app with Prisma Composer locally."
|
|
1137
1070
|
});
|
|
1138
|
-
if (context.packageManager === "deno") return nextSteps;
|
|
1139
1071
|
nextSteps.push({
|
|
1140
1072
|
command: getRunScriptCommand(context.packageManager, "deploy"),
|
|
1141
1073
|
description: "Build and deploy the app with Prisma Composer."
|
|
@@ -1406,10 +1338,7 @@ async function collectCreateContext(input) {
|
|
|
1406
1338
|
cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
|
|
1407
1339
|
return;
|
|
1408
1340
|
}
|
|
1409
|
-
const prismaSetupContext = await collectPrismaSetupContext(input, {
|
|
1410
|
-
projectDir: targetDirectory,
|
|
1411
|
-
template
|
|
1412
|
-
});
|
|
1341
|
+
const prismaSetupContext = await collectPrismaSetupContext(input, { projectDir: targetDirectory });
|
|
1413
1342
|
if (!prismaSetupContext) return;
|
|
1414
1343
|
return {
|
|
1415
1344
|
targetDirectory,
|
package/dist/index.d.mts
CHANGED
|
@@ -186,7 +186,6 @@ declare const PackageManagerSchema: z.ZodEnum<{
|
|
|
186
186
|
pnpm: "pnpm";
|
|
187
187
|
yarn: "yarn";
|
|
188
188
|
bun: "bun";
|
|
189
|
-
deno: "deno";
|
|
190
189
|
}>;
|
|
191
190
|
declare const AuthoringStyleSchema: z.ZodEnum<{
|
|
192
191
|
psl: "psl";
|
|
@@ -221,7 +220,6 @@ declare const CreateCommandInputSchema: z.ZodObject<{
|
|
|
221
220
|
pnpm: "pnpm";
|
|
222
221
|
yarn: "yarn";
|
|
223
222
|
bun: "bun";
|
|
224
|
-
deno: "deno";
|
|
225
223
|
}>>;
|
|
226
224
|
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
227
225
|
workspace: z.ZodOptional<z.ZodString>;
|
|
@@ -261,7 +259,6 @@ declare const router: {
|
|
|
261
259
|
pnpm: "pnpm";
|
|
262
260
|
yarn: "yarn";
|
|
263
261
|
bun: "bun";
|
|
264
|
-
deno: "deno";
|
|
265
262
|
}>>;
|
|
266
263
|
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
267
264
|
workspace: z.ZodOptional<z.ZodString>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-BeQ3QH6g.mjs";
|
|
3
3
|
import { os } from "@orpc/server";
|
|
4
4
|
import { createCli } from "trpc-cli";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/index.ts
|
|
8
|
-
const CLI_VERSION = "0.8.0
|
|
8
|
+
const CLI_VERSION = "0.8.0";
|
|
9
9
|
const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
|
|
10
10
|
function normalizeCreateCliInput(input) {
|
|
11
11
|
const [projectName, options] = input;
|
package/package.json
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
1
|
# {{projectName}}
|
|
2
2
|
|
|
3
|
-
{{#if (eq packageManager "deno")}}
|
|
4
|
-
A minimal Prisma 8 app for Deno and PostgreSQL.
|
|
5
|
-
|
|
6
|
-
## Run locally
|
|
7
|
-
|
|
8
|
-
Copy `.env.example` to `.env`, set `DATABASE_URL`, then initialize the database:
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
deno task db:init
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Start the app:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
deno task dev
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
The starter users are inserted idempotently from `src/prisma/seed.ts` on the first database query.
|
|
21
|
-
|
|
22
|
-
## Prisma
|
|
23
|
-
|
|
24
|
-
- Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
25
|
-
- Prisma config: `prisma-next.config.ts`
|
|
26
|
-
|
|
27
|
-
After changing the contract, run:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
deno task contract:emit
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Prisma Compute does not support Deno deployments yet.
|
|
34
|
-
{{else}}
|
|
35
3
|
A minimal {{template}} app with Prisma 8 and Prisma Composer.
|
|
36
4
|
|
|
37
5
|
## Run locally
|
|
@@ -69,4 +37,3 @@ After changing the contract, run:
|
|
|
69
37
|
```
|
|
70
38
|
|
|
71
39
|
To use the framework's development server directly, run `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `DATABASE_URL`.
|
|
72
|
-
{{/if}}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
{{#unless (eq packageManager "deno")}}
|
|
2
1
|
import { module } from "@prisma/composer";
|
|
3
2
|
{{#if (eq provider "postgres")}}
|
|
4
3
|
import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
@@ -27,4 +26,3 @@ export default module("{{projectName}}", ({ provision }) => {
|
|
|
27
26
|
});
|
|
28
27
|
{{/if}}
|
|
29
28
|
});
|
|
30
|
-
{{/unless}}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
{{#unless (eq packageManager "deno")}}
|
|
2
1
|
import { defineConfig } from "@prisma/composer/config";
|
|
3
2
|
import { nodeBuild } from "@prisma/composer/node/control";
|
|
4
3
|
{{#if (eq template "next")}}
|
|
@@ -10,4 +9,3 @@ export default defineConfig({
|
|
|
10
9
|
extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
|
|
11
10
|
state: prismaState(),
|
|
12
11
|
});
|
|
13
|
-
{{/unless}}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
{{#unless (eq packageManager "deno")}}
|
|
2
1
|
import { definePrismaConfig } from "@prisma/cli-engine";
|
|
3
2
|
import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
|
|
4
3
|
|
|
@@ -16,4 +15,3 @@ export default definePrismaConfig({
|
|
|
16
15
|
configPath: "./prisma-composer.config.ts",
|
|
17
16
|
},
|
|
18
17
|
});
|
|
19
|
-
{{/unless}}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
{{#unless (eq packageManager "deno")}}
|
|
2
1
|
{{#if (eq template "next")}}
|
|
3
2
|
import nextjs from "@prisma/composer/nextjs";
|
|
4
3
|
{{else}}
|
|
@@ -41,4 +40,3 @@ export default compute({
|
|
|
41
40
|
build: node({ module: import.meta.url, entry: "./dist/server.mjs" }),
|
|
42
41
|
{{/if}}
|
|
43
42
|
});
|
|
44
|
-
{{/unless}}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
{{#unless (eq packageManager "deno")}}
|
|
2
1
|
{{#if (eq provider "postgres")}}
|
|
3
2
|
import { pnContract } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
4
3
|
|
|
@@ -7,4 +6,3 @@ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}
|
|
|
7
6
|
|
|
8
7
|
export const appContract = pnContract<Contract>(contractJson);
|
|
9
8
|
{{/if}}
|
|
10
|
-
{{/unless}}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
{{#if (eq provider "postgres")}}
|
|
2
2
|
import postgres from "@prisma/orm-postgres/runtime";
|
|
3
3
|
|
|
4
|
-
{{#if (eq packageManager "deno")}}
|
|
5
|
-
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
6
|
-
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
7
|
-
|
|
8
|
-
const databaseUrl = Deno.env.get("DATABASE_URL");
|
|
9
|
-
if (!databaseUrl) {
|
|
10
|
-
throw new Error("DATABASE_URL is not set. Add it to .env before starting the app.");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const db = postgres<Contract>({ contractJson, url: databaseUrl });
|
|
14
|
-
{{else}}
|
|
15
4
|
import service from "../../service.ts";
|
|
16
5
|
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
17
6
|
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
@@ -29,7 +18,6 @@ export const db =
|
|
|
29
18
|
(process.env.DATABASE_URL
|
|
30
19
|
? postgres<Contract>({ contractJson, url: process.env.DATABASE_URL })
|
|
31
20
|
: postgres<Contract>({ contractJson }));
|
|
32
|
-
{{/if}}
|
|
33
21
|
{{else}}
|
|
34
22
|
import mongo from "@prisma/orm-mongo/runtime";
|
|
35
23
|
|
|
@@ -6,15 +6,9 @@
|
|
|
6
6
|
{{/if}}
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
{{#if (eq packageManager "deno")}}
|
|
10
|
-
"dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/server.mjs"}}",
|
|
11
|
-
"build": "{{runtimeScript packageManager "build" "src/index.ts" "dist/server.mjs"}}",
|
|
12
|
-
"start": "{{runtimeScript packageManager "start" "src/index.ts" "dist/server.mjs"}}"
|
|
13
|
-
{{else}}
|
|
14
9
|
"dev": "tsx watch src/index.ts",
|
|
15
10
|
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs",
|
|
16
11
|
"start": "node dist/server.mjs"
|
|
17
|
-
{{/if}}
|
|
18
12
|
},
|
|
19
13
|
"dependencies": {},
|
|
20
14
|
"devDependencies": {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
|
|
3
|
-
import { listUsers } from "./prisma/users
|
|
3
|
+
import { listUsers } from "./prisma/users";
|
|
4
4
|
|
|
5
|
-
const port = Number(
|
|
5
|
+
const port = Number(process.env.PORT ?? 3000);
|
|
6
6
|
|
|
7
7
|
createServer(async (_request, response) => {
|
|
8
8
|
try {
|