create-prisma 0.4.2-pr.53.183.1 → 0.4.2-pr.53.185.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{create-DIOWKea-.mjs → create-BDxyS_2J.mjs} +7 -8
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/_shared/.gitattributes.hbs +11 -0
- package/templates/create/_shared/prisma-next.config.ts.hbs +12 -0
- package/templates/create/_shared/src/prisma/composer.ts.hbs +2 -2
- package/templates/create/_shared/src/prisma/db.ts.hbs +4 -4
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ yarn dlx create-prisma@next my-app
|
|
|
13
13
|
bunx create-prisma@next my-app
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
The CLI initializes Prisma Next with `@prisma/cli
|
|
16
|
+
The CLI initializes Prisma Next with the aligned `@prisma/cli` prerelease, 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.
|
|
17
17
|
|
|
18
18
|
The only Composer prompt is:
|
|
19
19
|
|
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.53.
|
|
43
|
+
"cli-version": "0.4.2-pr.53.185.1",
|
|
44
44
|
"node-version": process.version,
|
|
45
45
|
platform: process.platform,
|
|
46
46
|
arch: process.arch
|
|
@@ -471,6 +471,7 @@ async function scaffoldCreateFrameworkTemplate(opts) {
|
|
|
471
471
|
const dependencyVersionMap = {
|
|
472
472
|
"@astrojs/node": "^10.0.2",
|
|
473
473
|
"@elysiajs/node": "^1.4.5",
|
|
474
|
+
"@prisma/cli": "8.0.0-rc.2",
|
|
474
475
|
"@prisma/cli-engine": "8.0.0-rc.2",
|
|
475
476
|
"@prisma/composer": "0.6.0-dev.18",
|
|
476
477
|
"@prisma/composer-prisma-cloud": "0.6.0-dev.18",
|
|
@@ -490,6 +491,7 @@ const dependencyVersionMap = {
|
|
|
490
491
|
tsx: "^4.21.0",
|
|
491
492
|
typescript: "^5.9.3"
|
|
492
493
|
};
|
|
494
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = `@prisma/cli@${dependencyVersionMap["@prisma/cli"]}`;
|
|
493
495
|
function getDependencyVersion(packageName) {
|
|
494
496
|
return dependencyVersionMap[packageName];
|
|
495
497
|
}
|
|
@@ -531,7 +533,6 @@ function getDbPackages(provider) {
|
|
|
531
533
|
|
|
532
534
|
//#endregion
|
|
533
535
|
//#region src/tasks/install.ts
|
|
534
|
-
const PRISMA_CLI_PACKAGE$2 = "@prisma/cli@next";
|
|
535
536
|
function getPrismaNextScriptMap(packageManager) {
|
|
536
537
|
return {
|
|
537
538
|
"contract:emit": "prisma-next contract emit",
|
|
@@ -547,7 +548,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
547
548
|
}
|
|
548
549
|
function getComposerScriptMap(packageManager) {
|
|
549
550
|
const composerCommand = (subcommand, extraArgs = []) => getPackageExecutionCommand(packageManager, [
|
|
550
|
-
|
|
551
|
+
PRISMA_PLATFORM_CLI_PACKAGE,
|
|
551
552
|
"composer",
|
|
552
553
|
subcommand,
|
|
553
554
|
"module.ts",
|
|
@@ -640,7 +641,6 @@ async function installProjectDependencies(packageManager, projectDir = process.c
|
|
|
640
641
|
|
|
641
642
|
//#endregion
|
|
642
643
|
//#region src/tasks/deploy-with-composer.ts
|
|
643
|
-
const PRISMA_CLI_PACKAGE$1 = "@prisma/cli@next";
|
|
644
644
|
function redactSecrets(message) {
|
|
645
645
|
return message.replace(/\b((?:prisma\+)?postgres(?:ql)?:\/\/)[^\s'"]+/gi, "$1<redacted>").replace(/\b([A-Z0-9_]*(?:DATABASE_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY)[A-Z0-9_]*=)[^\s]+/g, "$1<redacted>");
|
|
646
646
|
}
|
|
@@ -660,7 +660,7 @@ function parsePrismaCliEnvelope(output) {
|
|
|
660
660
|
throw new Error("Prisma CLI returned output that is not a valid result envelope.");
|
|
661
661
|
}
|
|
662
662
|
function getPrismaCliArgs(packageManager, args) {
|
|
663
|
-
return getPackageExecutionArgs(packageManager, [
|
|
663
|
+
return getPackageExecutionArgs(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
|
|
664
664
|
}
|
|
665
665
|
async function isAuthenticated(packageManager, projectDir) {
|
|
666
666
|
const invocation = getPrismaCliArgs(packageManager, [
|
|
@@ -682,7 +682,7 @@ async function isAuthenticated(packageManager, projectDir) {
|
|
|
682
682
|
async function ensureAuthentication(packageManager, projectDir) {
|
|
683
683
|
if (await isAuthenticated(packageManager, projectDir)) return;
|
|
684
684
|
const loginCommand = getPackageExecutionCommand(packageManager, [
|
|
685
|
-
|
|
685
|
+
PRISMA_PLATFORM_CLI_PACKAGE,
|
|
686
686
|
"auth",
|
|
687
687
|
"login"
|
|
688
688
|
]);
|
|
@@ -719,7 +719,6 @@ async function deployWithComposer(options) {
|
|
|
719
719
|
|
|
720
720
|
//#endregion
|
|
721
721
|
//#region src/tasks/setup-prisma.ts
|
|
722
|
-
const PRISMA_CLI_PACKAGE = "@prisma/cli@next";
|
|
723
722
|
const DEFAULT_DATABASE_PROVIDER = "postgres";
|
|
724
723
|
const DEFAULT_AUTHORING = "psl";
|
|
725
724
|
async function promptForDatabaseProvider() {
|
|
@@ -838,7 +837,7 @@ function getInitTarget(provider) {
|
|
|
838
837
|
return provider === "mongo" ? "mongodb" : "postgres";
|
|
839
838
|
}
|
|
840
839
|
function getPrismaCliInvocation(packageManager, args) {
|
|
841
|
-
return getPackageExecutionArgs(packageManager, [
|
|
840
|
+
return getPackageExecutionArgs(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
|
|
842
841
|
}
|
|
843
842
|
async function runPrismaInit(context, projectDir) {
|
|
844
843
|
const args = [
|
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-BDxyS_2J.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.4.2-pr.53.
|
|
8
|
+
const CLI_VERSION = "0.4.2-pr.53.185.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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{{#if (eq authoring "typescript")}}
|
|
2
|
+
src/prisma/generated/contract.json linguist-generated
|
|
3
|
+
src/prisma/generated/contract.d.ts linguist-generated
|
|
4
|
+
{{else}}
|
|
5
|
+
src/prisma/contract.json linguist-generated
|
|
6
|
+
src/prisma/contract.d.ts linguist-generated
|
|
7
|
+
{{/if}}
|
|
8
|
+
src/prisma/ops.json linguist-generated
|
|
9
|
+
src/prisma/migration.json linguist-generated
|
|
10
|
+
migrations/snapshots/**/contract.json linguist-generated
|
|
11
|
+
migrations/snapshots/**/contract.d.ts linguist-generated
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import { defineConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
|
|
6
|
+
{{#if (eq authoring "typescript")}}
|
|
7
|
+
output: "./src/prisma/generated",
|
|
8
|
+
{{/if}}
|
|
9
|
+
db: {
|
|
10
|
+
connection: process.env.DATABASE_URL!,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{{#if (eq provider "postgres")}}
|
|
2
2
|
import { pnContract } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
3
3
|
|
|
4
|
-
import type { Contract } from "./contract.d.ts";
|
|
5
|
-
import contractJson from "./contract.json" with { type: "json" };
|
|
4
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
5
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
6
6
|
|
|
7
7
|
export const appContract = pnContract<Contract>(contractJson);
|
|
8
8
|
{{/if}}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import postgres from "@prisma/orm-postgres/runtime";
|
|
3
3
|
|
|
4
4
|
import service from "../../service.ts";
|
|
5
|
-
import type { Contract } from "./contract.d.ts";
|
|
6
|
-
import contractJson from "./contract.json" with { type: "json" };
|
|
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
7
|
|
|
8
8
|
function loadComposerDatabase() {
|
|
9
9
|
try {
|
|
@@ -23,8 +23,8 @@ export const db =
|
|
|
23
23
|
import mongo from "@prisma/orm-mongo/runtime";
|
|
24
24
|
|
|
25
25
|
import service from "../../service.ts";
|
|
26
|
-
import type { Contract } from "./contract.d.ts";
|
|
27
|
-
import contractJson from "./contract.json" with { type: "json" };
|
|
26
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
27
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
28
28
|
|
|
29
29
|
function getDatabaseUrl(): string {
|
|
30
30
|
try {
|