@prisma/cli-init 0.0.0-dev.202506171842 → 0.0.0-dev.202506172001
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.
|
@@ -344,7 +344,7 @@ import internals5 from "@prisma/internals";
|
|
|
344
344
|
import * as Checkpoint from "checkpoint-client";
|
|
345
345
|
|
|
346
346
|
// package.json
|
|
347
|
-
var version = "0.0.0-dev.
|
|
347
|
+
var version = "0.0.0-dev.202506172001";
|
|
348
348
|
|
|
349
349
|
// src/platform/_lib/userAgent.ts
|
|
350
350
|
var debug = Debug("prisma:cli:platform:_lib:userAgent");
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
credentialsFile,
|
|
4
|
-
poll,
|
|
5
|
-
printPpgInitOutput,
|
|
6
|
-
requestOrThrow,
|
|
7
|
-
successMessage
|
|
8
|
-
} from "./chunk-3NINNG6I.js";
|
|
9
2
|
import {
|
|
10
3
|
Engine,
|
|
11
4
|
encodeAPIKey,
|
|
@@ -29,6 +22,13 @@ import {
|
|
|
29
22
|
withResolvers,
|
|
30
23
|
y
|
|
31
24
|
} from "./chunk-ASMCGOOW.js";
|
|
25
|
+
import {
|
|
26
|
+
credentialsFile,
|
|
27
|
+
poll,
|
|
28
|
+
printPpgInitOutput,
|
|
29
|
+
requestOrThrow,
|
|
30
|
+
successMessage
|
|
31
|
+
} from "./chunk-IMR2VP2D.js";
|
|
32
32
|
import {
|
|
33
33
|
__commonJS,
|
|
34
34
|
__require,
|
|
@@ -1653,85 +1653,6 @@ var require_proper_lockfile = __commonJS({
|
|
|
1653
1653
|
|
|
1654
1654
|
// src/Init.ts
|
|
1655
1655
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
1656
|
-
import internals from "@prisma/internals";
|
|
1657
|
-
import dotenv from "dotenv";
|
|
1658
|
-
import { Schema as Shape } from "effect";
|
|
1659
|
-
import fs2 from "fs";
|
|
1660
|
-
import { bold as bold2, dim, green, red as red2, yellow } from "kleur/colors";
|
|
1661
|
-
import ora from "ora";
|
|
1662
|
-
import path2 from "path";
|
|
1663
|
-
import { match, P } from "ts-pattern";
|
|
1664
|
-
|
|
1665
|
-
// src/utils/client-output-path.ts
|
|
1666
|
-
import fs from "fs";
|
|
1667
|
-
import path from "path";
|
|
1668
|
-
import { getTsconfig } from "get-tsconfig";
|
|
1669
|
-
function determineClientOutputPath(schemaDir) {
|
|
1670
|
-
const sourceDir = getSourceDir();
|
|
1671
|
-
const outputPath = path.join(sourceDir, "generated", "prisma");
|
|
1672
|
-
const relativeOutputPath = path.relative(schemaDir, outputPath);
|
|
1673
|
-
return relativeOutputPath.replaceAll(path.sep, "/");
|
|
1674
|
-
}
|
|
1675
|
-
function getSourceDir() {
|
|
1676
|
-
const projectDir = process.cwd();
|
|
1677
|
-
const sourceRootFromTsConfig = getSourceDirFromTypeScriptConfig();
|
|
1678
|
-
if (sourceRootFromTsConfig) {
|
|
1679
|
-
return path.join(projectDir, sourceRootFromTsConfig);
|
|
1680
|
-
}
|
|
1681
|
-
for (const dir of ["src", "lib", "app"]) {
|
|
1682
|
-
const absoluteSourceDir = path.join(projectDir, dir);
|
|
1683
|
-
if (fs.existsSync(absoluteSourceDir)) {
|
|
1684
|
-
return absoluteSourceDir;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
return projectDir;
|
|
1688
|
-
}
|
|
1689
|
-
function getSourceDirFromTypeScriptConfig() {
|
|
1690
|
-
const tsconfig = getTsconfig();
|
|
1691
|
-
if (!tsconfig) {
|
|
1692
|
-
return void 0;
|
|
1693
|
-
}
|
|
1694
|
-
const { config } = tsconfig;
|
|
1695
|
-
return config.compilerOptions?.rootDir ?? config.compilerOptions?.baseUrl ?? config.compilerOptions?.rootDirs?.[0];
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
// src/platform/accelerate/regions.ts
|
|
1699
|
-
var getRegionsOrThrow = async (input2) => {
|
|
1700
|
-
const { token } = input2;
|
|
1701
|
-
const { system } = await requestOrThrow({
|
|
1702
|
-
token,
|
|
1703
|
-
body: {
|
|
1704
|
-
query: (
|
|
1705
|
-
/* GraphQL */
|
|
1706
|
-
`
|
|
1707
|
-
query {
|
|
1708
|
-
system {
|
|
1709
|
-
accelerate {
|
|
1710
|
-
regions {
|
|
1711
|
-
id
|
|
1712
|
-
displayName
|
|
1713
|
-
ppgStatus
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
`
|
|
1719
|
-
)
|
|
1720
|
-
}
|
|
1721
|
-
});
|
|
1722
|
-
return system.accelerate.regions;
|
|
1723
|
-
};
|
|
1724
|
-
var getPrismaPostgresRegionsOrThrow = async (input2) => {
|
|
1725
|
-
const regions = await getRegionsOrThrow(input2);
|
|
1726
|
-
const ppgRegions = regions.filter((_) => _.ppgStatus !== "unsupported").sort((a2, b) => b.displayName.localeCompare(a2.displayName));
|
|
1727
|
-
return ppgRegions;
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
// src/utils/print.ts
|
|
1731
|
-
import { bgRed, bold, red } from "kleur/colors";
|
|
1732
|
-
function printError(text) {
|
|
1733
|
-
return bold(bgRed(" ERROR ")) + " " + red(text);
|
|
1734
|
-
}
|
|
1735
1656
|
|
|
1736
1657
|
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
1737
1658
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
@@ -3142,6 +3063,87 @@ async function unstable_startServer(options) {
|
|
|
3142
3063
|
}
|
|
3143
3064
|
}
|
|
3144
3065
|
|
|
3066
|
+
// src/Init.ts
|
|
3067
|
+
import internals from "@prisma/internals";
|
|
3068
|
+
import dotenv from "dotenv";
|
|
3069
|
+
import { Schema as Shape } from "effect";
|
|
3070
|
+
import fs2 from "fs";
|
|
3071
|
+
import { bold as bold2, dim, green, red as red2, yellow } from "kleur/colors";
|
|
3072
|
+
import ora from "ora";
|
|
3073
|
+
import path2 from "path";
|
|
3074
|
+
import { match, P } from "ts-pattern";
|
|
3075
|
+
|
|
3076
|
+
// src/utils/client-output-path.ts
|
|
3077
|
+
import fs from "fs";
|
|
3078
|
+
import path from "path";
|
|
3079
|
+
import { getTsconfig } from "get-tsconfig";
|
|
3080
|
+
function determineClientOutputPath(schemaDir) {
|
|
3081
|
+
const sourceDir = getSourceDir();
|
|
3082
|
+
const outputPath = path.join(sourceDir, "generated", "prisma");
|
|
3083
|
+
const relativeOutputPath = path.relative(schemaDir, outputPath);
|
|
3084
|
+
return relativeOutputPath.replaceAll(path.sep, "/");
|
|
3085
|
+
}
|
|
3086
|
+
function getSourceDir() {
|
|
3087
|
+
const projectDir = process.cwd();
|
|
3088
|
+
const sourceRootFromTsConfig = getSourceDirFromTypeScriptConfig();
|
|
3089
|
+
if (sourceRootFromTsConfig) {
|
|
3090
|
+
return path.join(projectDir, sourceRootFromTsConfig);
|
|
3091
|
+
}
|
|
3092
|
+
for (const dir of ["src", "lib", "app"]) {
|
|
3093
|
+
const absoluteSourceDir = path.join(projectDir, dir);
|
|
3094
|
+
if (fs.existsSync(absoluteSourceDir)) {
|
|
3095
|
+
return absoluteSourceDir;
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
return projectDir;
|
|
3099
|
+
}
|
|
3100
|
+
function getSourceDirFromTypeScriptConfig() {
|
|
3101
|
+
const tsconfig = getTsconfig();
|
|
3102
|
+
if (!tsconfig) {
|
|
3103
|
+
return void 0;
|
|
3104
|
+
}
|
|
3105
|
+
const { config } = tsconfig;
|
|
3106
|
+
return config.compilerOptions?.rootDir ?? config.compilerOptions?.baseUrl ?? config.compilerOptions?.rootDirs?.[0];
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
// src/platform/accelerate/regions.ts
|
|
3110
|
+
var getRegionsOrThrow = async (input2) => {
|
|
3111
|
+
const { token } = input2;
|
|
3112
|
+
const { system } = await requestOrThrow({
|
|
3113
|
+
token,
|
|
3114
|
+
body: {
|
|
3115
|
+
query: (
|
|
3116
|
+
/* GraphQL */
|
|
3117
|
+
`
|
|
3118
|
+
query {
|
|
3119
|
+
system {
|
|
3120
|
+
accelerate {
|
|
3121
|
+
regions {
|
|
3122
|
+
id
|
|
3123
|
+
displayName
|
|
3124
|
+
ppgStatus
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
`
|
|
3130
|
+
)
|
|
3131
|
+
}
|
|
3132
|
+
});
|
|
3133
|
+
return system.accelerate.regions;
|
|
3134
|
+
};
|
|
3135
|
+
var getPrismaPostgresRegionsOrThrow = async (input2) => {
|
|
3136
|
+
const regions = await getRegionsOrThrow(input2);
|
|
3137
|
+
const ppgRegions = regions.filter((_) => _.ppgStatus !== "unsupported").sort((a2, b) => b.displayName.localeCompare(a2.displayName));
|
|
3138
|
+
return ppgRegions;
|
|
3139
|
+
};
|
|
3140
|
+
|
|
3141
|
+
// src/utils/print.ts
|
|
3142
|
+
import { bgRed, bold, red } from "kleur/colors";
|
|
3143
|
+
function printError(text) {
|
|
3144
|
+
return bold(bgRed(" ERROR ")) + " " + red(text);
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3145
3147
|
// src/Init.ts
|
|
3146
3148
|
var defaultSchema = (props) => {
|
|
3147
3149
|
const {
|
|
@@ -3203,8 +3205,11 @@ model User {
|
|
|
3203
3205
|
};
|
|
3204
3206
|
var defaultEnv = async (url2, comments = true) => {
|
|
3205
3207
|
if (url2 === void 0) {
|
|
3206
|
-
|
|
3207
|
-
await
|
|
3208
|
+
let created = false;
|
|
3209
|
+
const state = await ServerState.fromServerDump() || (created = true, await ServerState.createExclusively({ persistenceMode: "stateful" }));
|
|
3210
|
+
if (created) {
|
|
3211
|
+
await state.close();
|
|
3212
|
+
}
|
|
3208
3213
|
const server = await unstable_startServer({
|
|
3209
3214
|
databasePort: state.databasePort,
|
|
3210
3215
|
dryRun: true,
|
|
@@ -3213,19 +3218,18 @@ var defaultEnv = async (url2, comments = true) => {
|
|
|
3213
3218
|
});
|
|
3214
3219
|
url2 = server.ppg.url;
|
|
3215
3220
|
}
|
|
3216
|
-
url2 = new URL(url2);
|
|
3217
3221
|
let env = comments ? `# Environment variables declared in this file are automatically made available to Prisma.
|
|
3218
3222
|
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
|
3219
3223
|
|
|
3220
3224
|
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
3221
3225
|
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
3222
3226
|
|
|
3223
|
-
${url2.
|
|
3227
|
+
${url2.startsWith("prisma+postgres:") && url2.includes("localhost") ? `# The following \`prisma+postgres\` URL is similar to the URL produced by running a local Prisma Postgres
|
|
3224
3228
|
# server with the \`prisma dev\` CLI command, when not choosing any non-default ports or settings. The API key, unlike the
|
|
3225
3229
|
# one found in a remote Prisma Postgres URL, does not contain any sensitive information.
|
|
3226
3230
|
|
|
3227
3231
|
` : ""}` : "";
|
|
3228
|
-
env += `DATABASE_URL="${url2
|
|
3232
|
+
env += `DATABASE_URL="${url2}"`;
|
|
3229
3233
|
return env;
|
|
3230
3234
|
};
|
|
3231
3235
|
var defaultPort = (datasourceProvider) => {
|
|
@@ -3395,7 +3399,7 @@ var Init = class _Init {
|
|
|
3395
3399
|
let generatedSchema;
|
|
3396
3400
|
let generatedName;
|
|
3397
3401
|
if (isPpgCommand) {
|
|
3398
|
-
const PlatformCommands = await import("./_-
|
|
3402
|
+
const PlatformCommands = await import("./_-APV4DZD5.js");
|
|
3399
3403
|
const credentials = await credentialsFile.load();
|
|
3400
3404
|
if (internals.isError(credentials))
|
|
3401
3405
|
throw credentials;
|