create-prisma 0.10.0 → 0.11.0-pr.75.263.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-BoFbgXIm.mjs → create-D_O0wpEu.mjs} +11 -18
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/_shared/module.ts.hbs +2 -2
- package/templates/create/_shared/service.ts.hbs +2 -2
- package/templates/create/_shared/src/prisma/composer.ts.hbs +2 -2
- package/templates/create/_shared/src/prisma/db.ts.hbs +2 -0
package/dist/cli.mjs
CHANGED
|
@@ -30,21 +30,12 @@ function createCommandFailureResult(stage, message, project) {
|
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/telemetry/client.ts
|
|
33
|
-
const TELEMETRY_API_KEY = "
|
|
33
|
+
const TELEMETRY_API_KEY = "";
|
|
34
34
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
35
35
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
36
36
|
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;
|
|
37
|
-
function isTruthyEnvValue(value) {
|
|
38
|
-
return [
|
|
39
|
-
"1",
|
|
40
|
-
"true",
|
|
41
|
-
"yes",
|
|
42
|
-
"on"
|
|
43
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
44
|
-
}
|
|
45
37
|
function shouldDisableTelemetry() {
|
|
46
|
-
|
|
47
|
-
return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
|
|
38
|
+
return true;
|
|
48
39
|
}
|
|
49
40
|
function getTelemetryConfigDir() {
|
|
50
41
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -66,7 +57,7 @@ async function getAnonymousId() {
|
|
|
66
57
|
}
|
|
67
58
|
function getCommonProperties() {
|
|
68
59
|
return {
|
|
69
|
-
"cli-version": "0.
|
|
60
|
+
"cli-version": "0.11.0-pr.75.263.1",
|
|
70
61
|
"node-version": process.version,
|
|
71
62
|
platform: process.platform,
|
|
72
63
|
arch: process.arch
|
|
@@ -500,8 +491,8 @@ async function scaffoldCreateFrameworkTemplate(opts) {
|
|
|
500
491
|
const dependencyVersionMap = {
|
|
501
492
|
"@astrojs/node": "^10.0.2",
|
|
502
493
|
"@elysiajs/node": "^1.4.5",
|
|
503
|
-
"@prisma/composer": "0.
|
|
504
|
-
"@prisma/composer-prisma-cloud": "0.
|
|
494
|
+
"@prisma/composer": "0.16.0",
|
|
495
|
+
"@prisma/composer-prisma-cloud": "0.16.0",
|
|
505
496
|
"@prisma/orm-mongo": "8.0.0-rc.8",
|
|
506
497
|
"@prisma/orm-postgres": "8.0.0-rc.8",
|
|
507
498
|
"@sveltejs/adapter-node": "^5.3.2",
|
|
@@ -514,11 +505,12 @@ const dependencyVersionMap = {
|
|
|
514
505
|
mongodb: "^7.1.0",
|
|
515
506
|
"mongodb-memory-server": "^11.1.0",
|
|
516
507
|
nitro: "^3.0.260610-beta",
|
|
517
|
-
prisma: "8.0.0-rc.
|
|
508
|
+
prisma: "8.0.0-rc.12",
|
|
509
|
+
"temporal-polyfill": "^1.0.4",
|
|
518
510
|
tsx: "^4.21.0",
|
|
519
511
|
typescript: "^5.9.3"
|
|
520
512
|
};
|
|
521
|
-
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@8.0.0-rc.
|
|
513
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@8.0.0-rc.12";
|
|
522
514
|
const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
|
|
523
515
|
function getDependencyVersion(packageName) {
|
|
524
516
|
return dependencyVersionMap[packageName];
|
|
@@ -658,6 +650,7 @@ async function addPackageDependency(opts) {
|
|
|
658
650
|
}
|
|
659
651
|
async function writePrismaDependencies(provider, packageManager, _authoring, projectDir = process.cwd()) {
|
|
660
652
|
const dependencies = [getDbPackages(provider)];
|
|
653
|
+
if (provider === "postgres" && packageManager !== "deno") dependencies.push("temporal-polyfill");
|
|
661
654
|
if (provider === "mongo") dependencies.push("arktype", "mongodb");
|
|
662
655
|
if (packageManager === "deno") dependencies.push("dotenv");
|
|
663
656
|
await addPackageDependency({
|
|
@@ -1469,7 +1462,7 @@ function parseVersion(version) {
|
|
|
1469
1462
|
Number.parseInt(patch, 10)
|
|
1470
1463
|
];
|
|
1471
1464
|
}
|
|
1472
|
-
function
|
|
1465
|
+
function supportsPrisma(nodeVersion = process.versions.node) {
|
|
1473
1466
|
const current = parseVersion(nodeVersion);
|
|
1474
1467
|
for (let index = 0; index < MINIMUM_NODE_VERSION.length; index += 1) {
|
|
1475
1468
|
if (current[index] > MINIMUM_NODE_VERSION[index]) return true;
|
|
@@ -1610,7 +1603,7 @@ async function runCreateCommand(rawInput = {}) {
|
|
|
1610
1603
|
try {
|
|
1611
1604
|
input = CreateCommandInputSchema.parse(rawInput);
|
|
1612
1605
|
if (input.json && input.verbose) throw new Error("--verbose cannot be used with --json because JSON mode is output-only.");
|
|
1613
|
-
if (!
|
|
1606
|
+
if (!supportsPrisma()) {
|
|
1614
1607
|
const message = getUnsupportedNodeMessage();
|
|
1615
1608
|
cancel(message, { output });
|
|
1616
1609
|
process.exitCode = 1;
|
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, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-D_O0wpEu.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
|
+
const CLI_VERSION = "0.11.0-pr.75.263.1";
|
|
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,7 +1,7 @@
|
|
|
1
1
|
{{#unless (eq packageManager "deno")}}
|
|
2
2
|
import { module } from "@prisma/composer";
|
|
3
3
|
{{#if (eq provider "postgres")}}
|
|
4
|
-
import {
|
|
4
|
+
import { postgres } from "@prisma/composer-prisma-cloud/orm";
|
|
5
5
|
|
|
6
6
|
import { appContract } from "./src/prisma/composer.ts";
|
|
7
7
|
{{else}}
|
|
@@ -12,7 +12,7 @@ import app from "./service.ts";
|
|
|
12
12
|
export default module("{{projectName}}", ({ provision }) => {
|
|
13
13
|
{{#if (eq provider "postgres")}}
|
|
14
14
|
const database = provision(
|
|
15
|
-
|
|
15
|
+
postgres({
|
|
16
16
|
name: "database",
|
|
17
17
|
contract: appContract,
|
|
18
18
|
config: "./prisma.config.ts",
|
|
@@ -10,7 +10,7 @@ import { type } from "arktype";
|
|
|
10
10
|
{{/if}}
|
|
11
11
|
import { compute } from "@prisma/composer-prisma-cloud";
|
|
12
12
|
{{#if (eq provider "postgres")}}
|
|
13
|
-
import {
|
|
13
|
+
import { postgres } from "@prisma/composer-prisma-cloud/orm";
|
|
14
14
|
|
|
15
15
|
import { appContract } from "./src/prisma/composer.ts";
|
|
16
16
|
{{/if}}
|
|
@@ -19,7 +19,7 @@ export default compute({
|
|
|
19
19
|
name: "app",
|
|
20
20
|
deps: {
|
|
21
21
|
{{#if (eq provider "postgres")}}
|
|
22
|
-
database:
|
|
22
|
+
database: postgres(appContract),
|
|
23
23
|
{{/if}}
|
|
24
24
|
},
|
|
25
25
|
{{#if (eq provider "mongo")}}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{{#unless (eq packageManager "deno")}}
|
|
2
2
|
{{#if (eq provider "postgres")}}
|
|
3
|
-
import {
|
|
3
|
+
import { dataContract } from "@prisma/composer-prisma-cloud/orm";
|
|
4
4
|
|
|
5
5
|
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
6
6
|
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
7
7
|
|
|
8
|
-
export const appContract =
|
|
8
|
+
export const appContract = dataContract<Contract>(contractJson);
|
|
9
9
|
{{/if}}
|
|
10
10
|
{{/unless}}
|
|
@@ -12,6 +12,8 @@ if (!databaseUrl) {
|
|
|
12
12
|
|
|
13
13
|
export const db = postgres<Contract>({ contractJson, url: databaseUrl });
|
|
14
14
|
{{else}}
|
|
15
|
+
import "temporal-polyfill/global";
|
|
16
|
+
|
|
15
17
|
import service from "../../service.ts";
|
|
16
18
|
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
17
19
|
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|