create-prisma 0.4.2-pr.55.209.1 → 0.4.2-pr.55.210.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-D-eNQ-nG.mjs";
2
+ import "./create-B-_G4ZQ9.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -40,7 +40,7 @@ async function getAnonymousId() {
40
40
  }
41
41
  function getCommonProperties() {
42
42
  return {
43
- "cli-version": "0.4.2-pr.55.209.1",
43
+ "cli-version": "0.4.2-pr.55.210.1",
44
44
  "node-version": process.version,
45
45
  platform: process.platform,
46
46
  arch: process.arch
@@ -651,7 +651,7 @@ async function runPrismaJsonCommand(options) {
651
651
  }
652
652
  return envelope.result;
653
653
  }
654
- async function ensureAuthentication(packageManager, projectDir) {
654
+ async function ensureAuthentication(packageManager, projectDir, beforeInteractiveLogin) {
655
655
  const whoami = () => runPrismaJsonCommand({
656
656
  packageManager,
657
657
  projectDir,
@@ -665,6 +665,7 @@ async function ensureAuthentication(packageManager, projectDir) {
665
665
  "login"
666
666
  ]);
667
667
  if (process.stdin.isTTY !== true) throw new Error(`Sign in first with ${loginCommand}, then run ${getRunScriptCommand(packageManager, "deploy")}.`);
668
+ beforeInteractiveLogin?.();
668
669
  log.info("Sign in to Prisma to deploy.");
669
670
  const login = getPrismaCliArgs(packageManager, ["auth", "login"]);
670
671
  await execa(login.command, login.args, {
@@ -680,7 +681,7 @@ function workspaceLabel(workspace) {
680
681
  return workspace.name ?? workspace.id;
681
682
  }
682
683
  async function useWorkspace(options) {
683
- const result = await runPrismaJsonCommand({
684
+ return (await runPrismaJsonCommand({
684
685
  packageManager: options.packageManager,
685
686
  projectDir: options.projectDir,
686
687
  args: [
@@ -689,9 +690,7 @@ async function useWorkspace(options) {
689
690
  "use",
690
691
  options.workspace
691
692
  ]
692
- });
693
- if (result.workspace.id !== options.activeWorkspace.id) log.info(`Prisma CLI workspace switched to ${workspaceLabel(result.workspace)}.`);
694
- return result.workspace;
693
+ })).workspace;
695
694
  }
696
695
  async function selectDeploymentWorkspace(options) {
697
696
  const activeWorkspace = options.authState.workspace;
@@ -704,8 +703,7 @@ async function selectDeploymentWorkspace(options) {
704
703
  return useWorkspace({
705
704
  packageManager: options.packageManager,
706
705
  projectDir: options.projectDir,
707
- workspace: options.workspace,
708
- activeWorkspace
706
+ workspace: options.workspace
709
707
  });
710
708
  }
711
709
  if (!options.shouldPrompt || process.stdin.isTTY !== true) return activeWorkspace;
@@ -719,6 +717,7 @@ async function selectDeploymentWorkspace(options) {
719
717
  ]
720
718
  });
721
719
  if (available.items.length <= 1) return activeWorkspace;
720
+ options.beforePrompt?.();
722
721
  const selectedWorkspaceId = await select({
723
722
  message: "Select Prisma workspace for deployment",
724
723
  initialValue: activeWorkspace.id,
@@ -732,12 +731,12 @@ async function selectDeploymentWorkspace(options) {
732
731
  cancel("Operation cancelled.");
733
732
  return;
734
733
  }
734
+ options.afterPrompt?.();
735
735
  if (selectedWorkspaceId === activeWorkspace.id) return activeWorkspace;
736
736
  return useWorkspace({
737
737
  packageManager: options.packageManager,
738
738
  projectDir: options.projectDir,
739
- workspace: selectedWorkspaceId,
740
- activeWorkspace
739
+ workspace: selectedWorkspaceId
741
740
  });
742
741
  }
743
742
  function parseComposerDeployResult(result) {
@@ -776,17 +775,37 @@ async function getProjectDetails(options) {
776
775
  }
777
776
  async function deployWithComposer(options) {
778
777
  const progress = options.verbose ? void 0 : spinner();
778
+ let progressRunning = false;
779
+ const showProgress = (message) => {
780
+ if (!progress) return;
781
+ if (progressRunning) progress.message(message);
782
+ else {
783
+ progress.start(message);
784
+ progressRunning = true;
785
+ }
786
+ };
787
+ const clearProgress = () => {
788
+ if (!progress || !progressRunning) return;
789
+ progress.clear();
790
+ progressRunning = false;
791
+ };
779
792
  try {
780
- const authState = await ensureAuthentication(options.packageManager, options.projectDir);
793
+ showProgress("Checking Prisma account...");
794
+ if (options.verbose) log.step("Checking Prisma account.");
795
+ const authState = await ensureAuthentication(options.packageManager, options.projectDir, clearProgress);
796
+ showProgress("Checking Prisma workspace...");
797
+ if (options.verbose) log.step("Checking Prisma workspace.");
781
798
  const selectedWorkspace = await selectDeploymentWorkspace({
782
799
  packageManager: options.packageManager,
783
800
  projectDir: options.projectDir,
784
801
  shouldPrompt: options.shouldPromptForWorkspace,
785
802
  authState,
803
+ beforePrompt: clearProgress,
804
+ afterPrompt: () => showProgress("Selecting Prisma workspace..."),
786
805
  ...options.workspace ? { workspace: options.workspace } : {}
787
806
  });
788
807
  if (!selectedWorkspace) return;
789
- progress?.start("Building for deployment...");
808
+ showProgress("Building for deployment...");
790
809
  if (options.verbose) log.step("Building for deployment.");
791
810
  const build = getRunScriptArgs(options.packageManager, "build");
792
811
  await execa(build.command, build.args, {
@@ -794,7 +813,7 @@ async function deployWithComposer(options) {
794
813
  env: process.env,
795
814
  stdio: options.verbose ? "inherit" : "pipe"
796
815
  });
797
- progress?.message("Deploying to Prisma...");
816
+ showProgress("Deploying to Prisma...");
798
817
  if (options.verbose) log.step("Deploying to Prisma.");
799
818
  const deployment = parseComposerDeployResult(await runPrismaJsonCommand({
800
819
  packageManager: options.packageManager,
@@ -807,13 +826,14 @@ async function deployWithComposer(options) {
807
826
  forwardStderr: options.verbose
808
827
  }));
809
828
  const appName = deployment?.appName ?? options.appName;
810
- progress?.message("Loading deployment details...");
829
+ showProgress("Loading deployment details...");
811
830
  const details = await getProjectDetails({
812
831
  packageManager: options.packageManager,
813
832
  projectDir: options.projectDir,
814
833
  appName
815
834
  });
816
835
  progress?.stop("Deployed to Prisma.");
836
+ progressRunning = false;
817
837
  if (options.verbose) log.success("Deployed to Prisma.");
818
838
  const workspace = details?.workspace ?? selectedWorkspace;
819
839
  return {
@@ -824,6 +844,7 @@ async function deployWithComposer(options) {
824
844
  };
825
845
  } catch (error) {
826
846
  progress?.error("Deployment failed.");
847
+ progressRunning = false;
827
848
  log.error(`Deploy failed: ${getErrorMessage(error)}`);
828
849
  return;
829
850
  }
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-D-eNQ-nG.mjs";
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-B-_G4ZQ9.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.55.209.1";
8
+ const CLI_VERSION = "0.4.2-pr.55.210.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,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.4.2-pr.55.209.1",
3
+ "version": "0.4.2-pr.55.210.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",