create-prisma 0.4.2-pr.34.112.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
|
@@ -1707,8 +1707,6 @@ async function executeCreateAddonSetupContext(params) {
|
|
|
1707
1707
|
//#endregion
|
|
1708
1708
|
//#region src/tasks/deploy-to-compute.ts
|
|
1709
1709
|
const PRISMA_CLI_PACKAGE = "@prisma/cli@latest";
|
|
1710
|
-
const COMPUTE_DEPLOY_BRANCH = "main";
|
|
1711
|
-
const COMPUTE_ENV_ROLE = "production";
|
|
1712
1710
|
const DEPLOY_OPTIONS_BY_TEMPLATE = {
|
|
1713
1711
|
hono: {
|
|
1714
1712
|
framework: "hono",
|
|
@@ -1806,15 +1804,6 @@ function redactSecrets(message) {
|
|
|
1806
1804
|
return message.replace(/(['"])([A-Z0-9_]*(?:DATABASE_URL|DIRECT_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*=)(.*?)\1/g, "$1$2<redacted>$1").replace(/\b([A-Z0-9_]*(?:DATABASE_URL|DIRECT_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*=)[^\s]+/g, "$1<redacted>");
|
|
1807
1805
|
}
|
|
1808
1806
|
function parseDeployJson(stdout) {
|
|
1809
|
-
return parsePrismaCliJson(stdout);
|
|
1810
|
-
}
|
|
1811
|
-
function parseProjectCreateJson(stdout) {
|
|
1812
|
-
return parsePrismaCliJson(stdout);
|
|
1813
|
-
}
|
|
1814
|
-
function parseProjectEnvJson(stdout) {
|
|
1815
|
-
return parsePrismaCliJson(stdout);
|
|
1816
|
-
}
|
|
1817
|
-
function parsePrismaCliJson(stdout) {
|
|
1818
1807
|
if (typeof stdout !== "string" || stdout.trim().length === 0) return null;
|
|
1819
1808
|
try {
|
|
1820
1809
|
return JSON.parse(stdout);
|
|
@@ -1846,70 +1835,9 @@ function toComputeDeployResult(data) {
|
|
|
1846
1835
|
branchName: data.result.branch.name
|
|
1847
1836
|
};
|
|
1848
1837
|
}
|
|
1849
|
-
async function createComputeProjectForDeploy(params) {
|
|
1850
|
-
const { stdout, exitCode } = await runPrismaCli(params.context.packageManager, [
|
|
1851
|
-
"project",
|
|
1852
|
-
"create",
|
|
1853
|
-
params.context.createProjectName,
|
|
1854
|
-
"--json",
|
|
1855
|
-
"--yes"
|
|
1856
|
-
], {
|
|
1857
|
-
cwd: params.projectDir,
|
|
1858
|
-
reject: false,
|
|
1859
|
-
stdio: [
|
|
1860
|
-
"ignore",
|
|
1861
|
-
"pipe",
|
|
1862
|
-
"pipe"
|
|
1863
|
-
]
|
|
1864
|
-
});
|
|
1865
|
-
const parsed = parseProjectCreateJson(stdout);
|
|
1866
|
-
if (!parsed) throw new Error("Could not parse prisma project create output.");
|
|
1867
|
-
if (exitCode !== 0 || !parsed.ok) throw createDeployError(parsed.ok ? "Prisma project create failed." : getJsonErrorMessage(parsed.error, "Prisma project create failed."));
|
|
1868
|
-
return parsed.result.project.id;
|
|
1869
|
-
}
|
|
1870
|
-
async function writeComputeEnvironmentVariables(params) {
|
|
1871
|
-
for (const [key, value] of Object.entries(params.envVars ?? {})) {
|
|
1872
|
-
const commonArgs = [
|
|
1873
|
-
`${key}=${value}`,
|
|
1874
|
-
"--project",
|
|
1875
|
-
params.projectRef,
|
|
1876
|
-
"--role",
|
|
1877
|
-
COMPUTE_ENV_ROLE,
|
|
1878
|
-
"--json",
|
|
1879
|
-
"--yes"
|
|
1880
|
-
];
|
|
1881
|
-
if ((await runProjectEnvCommand(params.context, params.projectDir, ["add", ...commonArgs])).ok) continue;
|
|
1882
|
-
const updateResult = await runProjectEnvCommand(params.context, params.projectDir, ["update", ...commonArgs]);
|
|
1883
|
-
if (!updateResult.ok) throw createDeployError(getJsonErrorMessage(updateResult.error, `Failed to configure ${key} for Prisma Compute.`));
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
async function runProjectEnvCommand(context, projectDir, args) {
|
|
1887
|
-
const { stdout, exitCode } = await runPrismaCli(context.packageManager, [
|
|
1888
|
-
"project",
|
|
1889
|
-
"env",
|
|
1890
|
-
...args
|
|
1891
|
-
], {
|
|
1892
|
-
cwd: projectDir,
|
|
1893
|
-
reject: false,
|
|
1894
|
-
stdio: [
|
|
1895
|
-
"ignore",
|
|
1896
|
-
"pipe",
|
|
1897
|
-
"pipe"
|
|
1898
|
-
]
|
|
1899
|
-
});
|
|
1900
|
-
const parsed = parseProjectEnvJson(stdout);
|
|
1901
|
-
if (!parsed) throw new Error("Could not parse prisma project env output.");
|
|
1902
|
-
if (exitCode !== 0 && parsed.ok) return {
|
|
1903
|
-
ok: false,
|
|
1904
|
-
error: { message: "Prisma project env command failed." }
|
|
1905
|
-
};
|
|
1906
|
-
return parsed;
|
|
1907
|
-
}
|
|
1908
1838
|
async function executeComputeDeployContext(params) {
|
|
1909
1839
|
const deploySpinner = spinner();
|
|
1910
1840
|
deploySpinner.start("Deploying to Prisma Compute...");
|
|
1911
|
-
const envVars = params.envVars ?? {};
|
|
1912
|
-
const shouldPreconfigureEnvVars = Object.keys(envVars).length > 0;
|
|
1913
1841
|
const args = [
|
|
1914
1842
|
"app",
|
|
1915
1843
|
"deploy",
|
|
@@ -1917,23 +1845,11 @@ async function executeComputeDeployContext(params) {
|
|
|
1917
1845
|
"--yes",
|
|
1918
1846
|
"--framework",
|
|
1919
1847
|
params.context.framework,
|
|
1920
|
-
"--
|
|
1921
|
-
|
|
1848
|
+
"--create-project",
|
|
1849
|
+
params.context.createProjectName
|
|
1922
1850
|
];
|
|
1923
1851
|
try {
|
|
1924
|
-
|
|
1925
|
-
const projectRef = await createComputeProjectForDeploy({
|
|
1926
|
-
context: params.context,
|
|
1927
|
-
projectDir: params.projectDir
|
|
1928
|
-
});
|
|
1929
|
-
await writeComputeEnvironmentVariables({
|
|
1930
|
-
context: params.context,
|
|
1931
|
-
projectDir: params.projectDir,
|
|
1932
|
-
projectRef,
|
|
1933
|
-
envVars
|
|
1934
|
-
});
|
|
1935
|
-
args.push("--project", projectRef);
|
|
1936
|
-
} else args.push("--create-project", params.context.createProjectName);
|
|
1852
|
+
for (const [key, value] of Object.entries(params.envVars ?? {})) args.push("--env", `${key}=${value}`);
|
|
1937
1853
|
if (params.context.httpPort) args.push("--http-port", String(params.context.httpPort));
|
|
1938
1854
|
const { stdout, exitCode } = await runPrismaCli(params.context.packageManager, args, {
|
|
1939
1855
|
cwd: params.projectDir,
|
|
@@ -2024,7 +1940,7 @@ async function getAnonymousId() {
|
|
|
2024
1940
|
}
|
|
2025
1941
|
function getCommonProperties() {
|
|
2026
1942
|
return {
|
|
2027
|
-
"cli-version": "0.4.2-pr.34.
|
|
1943
|
+
"cli-version": "0.4.2-pr.34.113.1",
|
|
2028
1944
|
"node-version": process.version,
|
|
2029
1945
|
platform: process.platform,
|
|
2030
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-
|
|
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.
|
|
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