create-prisma 0.4.2-pr.34.111.1 → 0.4.2-pr.34.113.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-Co1kBCus.mjs";
2
+ import "./create-BBykW9GC.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -1755,85 +1755,6 @@ async function ensurePrismaCliAvailable(packageManager) {
1755
1755
  return false;
1756
1756
  }
1757
1757
  }
1758
- async function fetchProjects(packageManager) {
1759
- const { stdout } = await runPrismaCli(packageManager, [
1760
- "project",
1761
- "list",
1762
- "--json"
1763
- ], { stdio: "pipe" });
1764
- const parsed = parseProjectListJson(stdout);
1765
- if (!parsed) throw new Error("Failed to list Prisma projects: invalid command output");
1766
- if (!parsed.ok) throw new Error(getJsonErrorMessage(parsed.error, "Failed to list Prisma projects"));
1767
- return parsed.result.items.map((project) => ({
1768
- id: project.id,
1769
- name: project.name
1770
- }));
1771
- }
1772
- function parseProjectListJson(stdout) {
1773
- if (typeof stdout !== "string" || stdout.trim().length === 0) return null;
1774
- try {
1775
- return JSON.parse(stdout);
1776
- } catch {
1777
- return null;
1778
- }
1779
- }
1780
- async function promptForNewProjectName(defaultProjectName) {
1781
- const projectNameInput = await text({
1782
- message: "Prisma project name",
1783
- placeholder: defaultProjectName,
1784
- initialValue: defaultProjectName,
1785
- validate: (value) => {
1786
- if (!value || value.trim().length === 0) return "Project name is required";
1787
- }
1788
- });
1789
- if (isCancel(projectNameInput)) {
1790
- cancel("Operation cancelled.");
1791
- return;
1792
- }
1793
- return projectNameInput.trim();
1794
- }
1795
- async function promptForNewProjectTarget(defaultProjectName) {
1796
- const projectName = await promptForNewProjectName(defaultProjectName);
1797
- return projectName ? { createProjectName: projectName } : void 0;
1798
- }
1799
- async function collectProjectTarget(options) {
1800
- const projects = await fetchProjects(options.packageManager);
1801
- if (projects.length === 1) {
1802
- const only = projects[0];
1803
- const shouldUseExistingProject = await confirm({
1804
- message: `Use Prisma project ${only.name}?`,
1805
- initialValue: true
1806
- });
1807
- if (isCancel(shouldUseExistingProject)) {
1808
- cancel("Operation cancelled.");
1809
- return;
1810
- }
1811
- return shouldUseExistingProject ? { projectRef: only.id } : promptForNewProjectTarget(options.defaultProjectName);
1812
- }
1813
- if (projects.length > 1) {
1814
- const selection = await select({
1815
- message: "Select Prisma project",
1816
- options: [{
1817
- value: { type: "create" },
1818
- label: "Create new project"
1819
- }, ...projects.slice().sort((a, b) => a.name.localeCompare(b.name)).map((project) => ({
1820
- value: {
1821
- type: "existing",
1822
- project
1823
- },
1824
- label: project.name,
1825
- hint: project.id
1826
- }))]
1827
- });
1828
- if (isCancel(selection)) {
1829
- cancel("Operation cancelled.");
1830
- return;
1831
- }
1832
- return selection.type === "create" ? promptForNewProjectTarget(options.defaultProjectName) : { projectRef: selection.project.id };
1833
- }
1834
- log.info("No Prisma projects found.");
1835
- return promptForNewProjectTarget(options.defaultProjectName);
1836
- }
1837
1758
  async function collectComputeDeployContext(input, options) {
1838
1759
  if (!isComputeDeployableTemplate(options.template)) return null;
1839
1760
  if (input.deploy === false) return null;
@@ -1866,43 +1787,15 @@ async function collectComputeDeployContext(input, options) {
1866
1787
  return null;
1867
1788
  }
1868
1789
  }
1869
- let projectTarget;
1870
- try {
1871
- projectTarget = await collectProjectTarget({
1872
- packageManager: options.packageManager,
1873
- defaultProjectName: options.defaultServiceName
1874
- });
1875
- } catch (error) {
1876
- log.warn(`Could not list Prisma projects${error instanceof Error ? `: ${redactSecrets(error.message)}` : "."}`);
1877
- if (input.deploy === true) throw createExplicitDeployError("could not list Prisma projects", error);
1878
- return null;
1879
- }
1880
- if (!projectTarget) {
1881
- if (input.deploy === true) throw createExplicitDeployError("no Prisma project was selected or created");
1882
- return null;
1883
- }
1884
- const appNameInput = await text({
1885
- message: "App name",
1886
- placeholder: options.defaultServiceName,
1887
- initialValue: options.defaultServiceName,
1888
- validate: (value) => {
1889
- if (!value || value.trim().length === 0) return "App name is required";
1890
- }
1891
- });
1892
- if (isCancel(appNameInput)) {
1893
- cancel("Operation cancelled.");
1894
- return;
1895
- }
1896
1790
  const deployOptions = DEPLOY_OPTIONS_BY_TEMPLATE[options.template];
1897
1791
  if (!deployOptions) {
1898
1792
  if (input.deploy === true) throw createExplicitDeployError(`${options.template} is not supported by prisma app deploy yet`);
1899
1793
  return null;
1900
1794
  }
1901
1795
  return {
1902
- ...projectTarget,
1903
1796
  template: options.template,
1904
1797
  packageManager: options.packageManager,
1905
- appName: appNameInput.trim(),
1798
+ createProjectName: options.defaultServiceName,
1906
1799
  framework: deployOptions.framework,
1907
1800
  httpPort: deployOptions.httpPort
1908
1801
  };
@@ -1943,28 +1836,21 @@ function toComputeDeployResult(data) {
1943
1836
  };
1944
1837
  }
1945
1838
  async function executeComputeDeployContext(params) {
1839
+ const deploySpinner = spinner();
1840
+ deploySpinner.start("Deploying to Prisma Compute...");
1946
1841
  const args = [
1947
1842
  "app",
1948
1843
  "deploy",
1949
1844
  "--json",
1950
1845
  "--yes",
1951
- "--app",
1952
- params.context.appName,
1953
1846
  "--framework",
1954
- params.context.framework
1847
+ params.context.framework,
1848
+ "--create-project",
1849
+ params.context.createProjectName
1955
1850
  ];
1956
- if (params.context.projectRef) args.push("--project", params.context.projectRef);
1957
- else if (params.context.createProjectName) args.push("--create-project", params.context.createProjectName);
1958
- else return {
1959
- ok: false,
1960
- cancelled: false,
1961
- error: /* @__PURE__ */ new Error("Deploy target is missing a Prisma project.")
1962
- };
1963
- if (params.context.httpPort) args.push("--http-port", String(params.context.httpPort));
1964
- for (const [key, value] of Object.entries(params.envVars ?? {})) args.push("--env", `${key}=${value}`);
1965
- const deploySpinner = spinner();
1966
- deploySpinner.start("Deploying to Prisma Compute...");
1967
1851
  try {
1852
+ for (const [key, value] of Object.entries(params.envVars ?? {})) args.push("--env", `${key}=${value}`);
1853
+ if (params.context.httpPort) args.push("--http-port", String(params.context.httpPort));
1968
1854
  const { stdout, exitCode } = await runPrismaCli(params.context.packageManager, args, {
1969
1855
  cwd: params.projectDir,
1970
1856
  reject: false,
@@ -2054,7 +1940,7 @@ async function getAnonymousId() {
2054
1940
  }
2055
1941
  function getCommonProperties() {
2056
1942
  return {
2057
- "cli-version": "0.4.2-pr.34.111.1",
1943
+ "cli-version": "0.4.2-pr.34.113.1",
2058
1944
  "node-version": process.version,
2059
1945
  platform: process.platform,
2060
1946
  arch: process.arch
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-Co1kBCus.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-BBykW9GC.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.111.1";
7
+ const CLI_VERSION = "0.4.2-pr.34.113.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.111.1",
3
+ "version": "0.4.2-pr.34.113.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",