create-prisma 0.4.2-pr.34.116.1 → 0.4.2-pr.34.117.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-DRZe4NlG.mjs";
2
+ import "./create-yihruvVK.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -819,7 +819,7 @@ function getCommandErrorMessage(error) {
819
819
  }
820
820
  return error instanceof Error ? error.message : String(error);
821
821
  }
822
- async function collectPrismaSetupContext(input, options = {}) {
822
+ async function collectPrismaSetupInitialContext(input, options = {}) {
823
823
  const projectDir = path.resolve(options.projectDir ?? process.cwd());
824
824
  const useDefaults = input.yes === true;
825
825
  const verbose = input.verbose === true;
@@ -828,20 +828,11 @@ async function collectPrismaSetupContext(input, options = {}) {
828
828
  if (!databaseProvider) return;
829
829
  const schemaPreset = input.schemaPreset ?? options.defaultSchemaPreset ?? DEFAULT_SCHEMA_PRESET$1;
830
830
  const databaseUrl = input.databaseUrl;
831
- let shouldUsePrismaPostgres = false;
832
- const shouldUseComputePostgres = databaseProvider === "postgresql" && !databaseUrl && options.skipPrismaPostgresProvisioning === true;
833
- if (databaseProvider === "postgresql" && !databaseUrl && !shouldUseComputePostgres) {
834
- const prismaPostgresChoice = input.prismaPostgres ?? (useDefaults ? DEFAULT_PRISMA_POSTGRES : await promptForPrismaPostgres());
835
- if (prismaPostgresChoice === void 0) return;
836
- shouldUsePrismaPostgres = prismaPostgresChoice;
837
- }
838
831
  const detectedPackageManager = await detectPackageManager(projectDir);
839
832
  const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
840
833
  if (!packageManager) return;
841
834
  const shouldInstall = input.install ?? (useDefaults ? DEFAULT_INSTALL : await promptForDependencyInstall(packageManager));
842
835
  if (shouldInstall === void 0) return;
843
- const shouldMigrateAndSeed = !(shouldInstall && shouldGenerate && !(shouldUseComputePostgres && options.skipMigrateAndSeedPrompt)) ? false : input.migrateAndSeed ?? (useDefaults ? DEFAULT_MIGRATE_AND_SEED : await promptForMigrateAndSeed());
844
- if (shouldMigrateAndSeed === void 0) return;
845
836
  return {
846
837
  projectDir,
847
838
  verbose,
@@ -849,9 +840,24 @@ async function collectPrismaSetupContext(input, options = {}) {
849
840
  databaseProvider,
850
841
  schemaPreset,
851
842
  databaseUrl,
852
- shouldUsePrismaPostgres,
853
843
  packageManager,
854
- shouldInstall,
844
+ shouldInstall
845
+ };
846
+ }
847
+ async function completePrismaSetupContext(input, context, options = {}) {
848
+ const useDefaults = input.yes === true;
849
+ let shouldUsePrismaPostgres = false;
850
+ const shouldUseComputePostgres = context.databaseProvider === "postgresql" && !context.databaseUrl && options.useComputePostgres === true;
851
+ if (context.databaseProvider === "postgresql" && !context.databaseUrl && !shouldUseComputePostgres) {
852
+ const prismaPostgresChoice = input.prismaPostgres ?? (useDefaults ? DEFAULT_PRISMA_POSTGRES : await promptForPrismaPostgres());
853
+ if (prismaPostgresChoice === void 0) return;
854
+ shouldUsePrismaPostgres = prismaPostgresChoice;
855
+ }
856
+ const shouldMigrateAndSeed = !(context.shouldInstall && context.shouldGenerate && !(shouldUseComputePostgres && options.skipMigrateAndSeedPrompt)) ? false : input.migrateAndSeed ?? (useDefaults ? DEFAULT_MIGRATE_AND_SEED : await promptForMigrateAndSeed());
857
+ if (shouldMigrateAndSeed === void 0) return;
858
+ return {
859
+ ...context,
860
+ shouldUsePrismaPostgres,
855
861
  shouldMigrateAndSeed
856
862
  };
857
863
  }
@@ -1772,26 +1778,11 @@ async function ensurePrismaCliAvailable(packageManager) {
1772
1778
  return false;
1773
1779
  }
1774
1780
  }
1775
- async function collectComputeDeployIntent(input, options) {
1776
- if (!isComputeDeployableTemplate(options.template)) return null;
1777
- if (input.deploy === false) return null;
1778
- if (input.deploy === true) return true;
1779
- if (options.useDefaults) return null;
1780
- const confirmed = await confirm({
1781
- message: "Deploy to Prisma Compute now?",
1782
- initialValue: true
1783
- });
1784
- if (isCancel(confirmed)) {
1785
- cancel("Operation cancelled.");
1786
- return;
1787
- }
1788
- return confirmed;
1789
- }
1790
1781
  async function collectComputeDeployContext(input, options) {
1791
1782
  if (!isComputeDeployableTemplate(options.template)) return null;
1792
- if (options.wantsDeploy === false || options.wantsDeploy === null || input.deploy === false) return null;
1783
+ if (input.deploy === false) return null;
1793
1784
  let wantsDeploy;
1794
- if (options.wantsDeploy === true || input.deploy === true) wantsDeploy = true;
1785
+ if (input.deploy === true) wantsDeploy = true;
1795
1786
  else if (options.useDefaults) return null;
1796
1787
  else {
1797
1788
  const confirmed = await confirm({
@@ -1973,7 +1964,7 @@ async function getAnonymousId() {
1973
1964
  }
1974
1965
  function getCommonProperties() {
1975
1966
  return {
1976
- "cli-version": "0.4.2-pr.34.116.1",
1967
+ "cli-version": "0.4.2-pr.34.117.1",
1977
1968
  "node-version": process.version,
1978
1969
  platform: process.platform,
1979
1970
  arch: process.arch
@@ -2249,16 +2240,23 @@ async function collectCreateContext(input) {
2249
2240
  cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
2250
2241
  return;
2251
2242
  }
2252
- const computeDeployIntent = await collectComputeDeployIntent(input, {
2243
+ const prismaSetupInitialContext = await collectPrismaSetupInitialContext(input, {
2244
+ projectDir: targetDirectory,
2245
+ defaultSchemaPreset: DEFAULT_SCHEMA_PRESET
2246
+ });
2247
+ if (!prismaSetupInitialContext) return;
2248
+ const projectPackageName = toPackageName(path.basename(targetDirectory));
2249
+ const computeDeployContext = await collectComputeDeployContext(input, {
2253
2250
  template,
2254
- useDefaults
2251
+ packageManager: prismaSetupInitialContext.packageManager,
2252
+ useDefaults,
2253
+ defaultServiceName: projectPackageName
2255
2254
  });
2256
- if (computeDeployIntent === void 0) return;
2257
- const prismaSetupContext = await collectPrismaSetupContext(input, {
2258
- projectDir: targetDirectory,
2259
- defaultSchemaPreset: DEFAULT_SCHEMA_PRESET,
2260
- skipPrismaPostgresProvisioning: computeDeployIntent === true && input.prismaPostgres !== false,
2261
- skipMigrateAndSeedPrompt: computeDeployIntent === true && input.prismaPostgres !== false
2255
+ if (computeDeployContext === void 0) return;
2256
+ const useComputeDatabase = Boolean(computeDeployContext && prismaSetupInitialContext.databaseProvider === "postgresql" && !prismaSetupInitialContext.databaseUrl && input.prismaPostgres !== false);
2257
+ const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext, {
2258
+ useComputePostgres: useComputeDatabase,
2259
+ skipMigrateAndSeedPrompt: useComputeDatabase
2262
2260
  });
2263
2261
  if (!prismaSetupContext) return;
2264
2262
  const addonSetupContext = await collectCreateAddonSetupContext(input, {
@@ -2267,16 +2265,6 @@ async function collectCreateContext(input) {
2267
2265
  shouldUsePrismaPostgres: prismaSetupContext.shouldUsePrismaPostgres
2268
2266
  });
2269
2267
  if (addonSetupContext === void 0) return;
2270
- const projectPackageName = toPackageName(path.basename(targetDirectory));
2271
- const computeDeployContext = await collectComputeDeployContext(input, {
2272
- template,
2273
- packageManager: prismaSetupContext.packageManager,
2274
- useDefaults,
2275
- defaultServiceName: projectPackageName,
2276
- wantsDeploy: computeDeployIntent
2277
- });
2278
- if (computeDeployContext === void 0) return;
2279
- const useComputeDatabase = Boolean(computeDeployContext && prismaSetupContext.databaseProvider === "postgresql" && !prismaSetupContext.databaseUrl && input.prismaPostgres !== false);
2280
2268
  return {
2281
2269
  targetDirectory,
2282
2270
  targetPathState,
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-DRZe4NlG.mjs";
2
+ import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-yihruvVK.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.34.116.1";
7
+ const CLI_VERSION = "0.4.2-pr.34.117.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2-pr.34.116.1",
3
+ "version": "0.4.2-pr.34.117.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma 7 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",