@prisma/cli 3.0.0-alpha.0 → 3.0.0-alpha.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
2
2
|
import { addGlobalFlags } from "../../shell/global-flags.js";
|
|
3
3
|
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
4
|
+
import { PREVIEW_BUILD_TYPES } from "../../lib/app/preview-build.js";
|
|
4
5
|
import { runAppBuild, runAppDeploy, runAppListDeploys, runAppListEnv, runAppLogs, runAppOpen, runAppPromote, runAppRemove, runAppRollback, runAppRun, runAppShow, runAppShowDeploy, runAppUpdateEnv } from "../../controllers/app.js";
|
|
5
6
|
import { renderAppBuild, renderAppDeploy, renderAppListDeploys, renderAppListEnv, renderAppOpen, renderAppPromote, renderAppRemove, renderAppRollback, renderAppRun, renderAppShow, renderAppShowDeploy, renderAppUpdateEnv, serializeAppBuild, serializeAppDeploy, serializeAppListDeploys, serializeAppListEnv, serializeAppOpen, serializeAppPromote, serializeAppRemove, serializeAppRollback, serializeAppRun, serializeAppShow, serializeAppShowDeploy, serializeAppUpdateEnv } from "../../presenters/app.js";
|
|
6
7
|
import { runCommand } from "../../shell/command-runner.js";
|
|
@@ -25,11 +26,7 @@ function createAppCommand(runtime) {
|
|
|
25
26
|
}
|
|
26
27
|
function createBuildCommand(runtime) {
|
|
27
28
|
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("build"), runtime), "app.build");
|
|
28
|
-
command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([
|
|
29
|
-
"auto",
|
|
30
|
-
"bun",
|
|
31
|
-
"nextjs"
|
|
32
|
-
]).default("auto"));
|
|
29
|
+
command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([...PREVIEW_BUILD_TYPES]).default("auto"));
|
|
33
30
|
addGlobalFlags(command);
|
|
34
31
|
command.action(async (options) => {
|
|
35
32
|
const entry = options.entry;
|
|
@@ -62,11 +59,7 @@ function createRunCommand(runtime) {
|
|
|
62
59
|
}
|
|
63
60
|
function createDeployCommand(runtime) {
|
|
64
61
|
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
|
|
65
|
-
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto deploys")).addOption(new Option("--build-type <type>", "Deploy build type").choices([
|
|
66
|
-
"auto",
|
|
67
|
-
"bun",
|
|
68
|
-
"nextjs"
|
|
69
|
-
]).default("auto")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
|
|
62
|
+
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto deploys")).addOption(new Option("--build-type <type>", "Deploy build type").choices([...PREVIEW_BUILD_TYPES]).default("auto")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
|
|
70
63
|
addGlobalFlags(command);
|
|
71
64
|
command.action(async (options) => {
|
|
72
65
|
const appName = options.app;
|
package/dist/controllers/app.js
CHANGED
|
@@ -6,7 +6,7 @@ import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
|
6
6
|
import { parseEnvAssignments } from "../lib/app/env-vars.js";
|
|
7
7
|
import { DEFAULT_LOCAL_DEV_PORT, resolveLocalBuildType, runLocalApp } from "../lib/app/local-dev.js";
|
|
8
8
|
import { projectNotFoundError } from "../use-cases/project.js";
|
|
9
|
-
import { executePreviewBuild } from "../lib/app/preview-build.js";
|
|
9
|
+
import { PREVIEW_BUILD_TYPES, RESOLVED_PREVIEW_BUILD_TYPES, executePreviewBuild } from "../lib/app/preview-build.js";
|
|
10
10
|
import { PREVIEW_DEFAULT_REGION, createPreviewDeployInteraction } from "../lib/app/preview-interaction.js";
|
|
11
11
|
import { createPreviewDeployProgress, createPreviewPromoteProgress, createPreviewUpdateEnvProgress } from "../lib/app/preview-progress.js";
|
|
12
12
|
import { createPreviewAppProvider } from "../lib/app/preview-provider.js";
|
|
@@ -20,12 +20,11 @@ function isRealMode(context) {
|
|
|
20
20
|
async function runAppBuild(context, entrypoint, requestedBuildType) {
|
|
21
21
|
const buildType = normalizeBuildType(requestedBuildType);
|
|
22
22
|
assertSupportedEntrypoint(buildType, entrypoint, "build");
|
|
23
|
-
const resolvedBuildType = await requireLocalBuildType(context, buildType, "build");
|
|
24
23
|
try {
|
|
25
24
|
const { artifact, buildType: actualBuildType } = await executePreviewBuild({
|
|
26
25
|
appPath: context.runtime.cwd,
|
|
27
26
|
entrypoint,
|
|
28
|
-
buildType
|
|
27
|
+
buildType
|
|
29
28
|
});
|
|
30
29
|
return {
|
|
31
30
|
command: "app.build",
|
|
@@ -38,6 +37,7 @@ async function runAppBuild(context, entrypoint, requestedBuildType) {
|
|
|
38
37
|
nextSteps: ["prisma app deploy"]
|
|
39
38
|
};
|
|
40
39
|
} catch (error) {
|
|
40
|
+
if (buildType === "auto" && isAutoBuildDetectionError(error)) throw usageError("App build requires an explicit framework when detection is ambiguous", `This preview auto-detects clear project shapes for ${RESOLVED_PREVIEW_BUILD_TYPES.map(formatBuildTypeName).join(", ")}.`, "Pass a supported --build-type value, or pass --entry <path> for a Bun app.", getBuildTypeExamples("build"), "app");
|
|
41
41
|
throw buildFailedError("Local app build failed", error);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -699,16 +699,24 @@ async function assertProjectLinkWritableForDeploy(context) {
|
|
|
699
699
|
}
|
|
700
700
|
function normalizeBuildType(requestedBuildType) {
|
|
701
701
|
if (!requestedBuildType) return "auto";
|
|
702
|
-
if (requestedBuildType
|
|
703
|
-
throw usageError(`Unsupported build type "${requestedBuildType}"`,
|
|
702
|
+
if (isPreviewBuildType(requestedBuildType)) return requestedBuildType;
|
|
703
|
+
throw usageError(`Unsupported build type "${requestedBuildType}"`, `Only ${PREVIEW_BUILD_TYPES.join(", ")} are supported in the current preview.`, "Pass a supported --build-type value.", getBuildTypeExamples("build"), "app");
|
|
704
|
+
}
|
|
705
|
+
function isPreviewBuildType(value) {
|
|
706
|
+
return PREVIEW_BUILD_TYPES.includes(value);
|
|
707
|
+
}
|
|
708
|
+
function getBuildTypeExamples(commandName) {
|
|
709
|
+
return RESOLVED_PREVIEW_BUILD_TYPES.map((buildType) => {
|
|
710
|
+
return `prisma app ${commandName} --build-type ${buildType}${buildType === "bun" ? " --entry server.ts" : ""}`;
|
|
711
|
+
});
|
|
704
712
|
}
|
|
705
713
|
function assertSupportedEntrypoint(buildType, entrypoint, commandName) {
|
|
706
|
-
if (buildType
|
|
714
|
+
if (buildType !== "auto" && buildType !== "bun" && entrypoint) throw usageError(`App ${commandName} does not accept --entry with --build-type ${buildType}`, `${formatBuildTypeName(buildType)} apps do not use an entrypoint flag in the current preview.`, `Remove --entry, or rerun prisma app ${commandName} with --build-type bun when you want to target a Bun entrypoint directly.`, [`prisma app ${commandName} --build-type ${buildType}`, `prisma app ${commandName} --build-type bun --entry server.ts`], "app");
|
|
707
715
|
}
|
|
708
716
|
async function requireLocalBuildType(context, buildType, commandName) {
|
|
709
717
|
const resolvedBuildType = await resolveLocalBuildType(context.runtime.cwd, buildType);
|
|
710
718
|
if (resolvedBuildType) return resolvedBuildType;
|
|
711
|
-
throw usageError(`App ${commandName} requires an explicit framework when detection is ambiguous`, "This preview only
|
|
719
|
+
throw usageError(`App ${commandName} requires an explicit framework when detection is ambiguous`, "This preview only starts local dev servers for clear Next.js or Bun project shapes.", "Pass --build-type nextjs for a Next.js app, or pass --build-type bun with --entry <path> for a Bun app.", [`prisma app ${commandName} --build-type nextjs`, `prisma app ${commandName} --build-type bun --entry server.ts`], "app");
|
|
712
720
|
}
|
|
713
721
|
function parseLocalPort(requestedPort) {
|
|
714
722
|
if (!requestedPort) return DEFAULT_LOCAL_DEV_PORT;
|
|
@@ -778,6 +786,19 @@ function runFailedError(summary, error, exitCode = 1) {
|
|
|
778
786
|
function formatFrameworkName(framework) {
|
|
779
787
|
return framework === "nextjs" ? "Next.js" : "Bun";
|
|
780
788
|
}
|
|
789
|
+
function isAutoBuildDetectionError(error) {
|
|
790
|
+
return error instanceof Error && error.message.startsWith("Entrypoint is required.");
|
|
791
|
+
}
|
|
792
|
+
function formatBuildTypeName(buildType) {
|
|
793
|
+
switch (buildType) {
|
|
794
|
+
case "nextjs": return "Next.js";
|
|
795
|
+
case "nuxt": return "Nuxt";
|
|
796
|
+
case "astro": return "Astro";
|
|
797
|
+
case "tanstack-start": return "TanStack Start";
|
|
798
|
+
case "bun": return "Bun";
|
|
799
|
+
case "auto": return "Auto";
|
|
800
|
+
}
|
|
801
|
+
}
|
|
781
802
|
function removeFailedError(summary, error, nextSteps) {
|
|
782
803
|
return new CliError({
|
|
783
804
|
code: "REMOVE_FAILED",
|
|
@@ -12,6 +12,7 @@ const NEXT_CONFIG_FILENAMES = [
|
|
|
12
12
|
const DEFAULT_LOCAL_DEV_PORT = 3e3;
|
|
13
13
|
async function resolveLocalBuildType(appPath, buildType) {
|
|
14
14
|
if (buildType === "bun" || buildType === "nextjs") return buildType;
|
|
15
|
+
if (buildType !== "auto") return null;
|
|
15
16
|
return detectLocalBuildType(appPath);
|
|
16
17
|
}
|
|
17
18
|
async function detectLocalBuildType(appPath) {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { resolveBunEntrypoint } from "./bun-project.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { execFile } from "node:child_process";
|
|
6
|
-
import { BunBuild } from "@prisma/compute-sdk";
|
|
3
|
+
import { cp, readdir, readlink, rm, stat } from "node:fs/promises";
|
|
4
|
+
import { AstroBuild, BunBuild, NextjsBuild, NuxtBuild, TanstackStartBuild } from "@prisma/compute-sdk";
|
|
7
5
|
//#region src/lib/app/preview-build.ts
|
|
8
|
-
const
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
6
|
+
const PREVIEW_BUILD_TYPES = [
|
|
7
|
+
"auto",
|
|
8
|
+
"bun",
|
|
9
|
+
"nextjs",
|
|
10
|
+
"nuxt",
|
|
11
|
+
"astro",
|
|
12
|
+
"tanstack-start"
|
|
13
13
|
];
|
|
14
|
+
const RESOLVED_PREVIEW_BUILD_TYPES = PREVIEW_BUILD_TYPES.filter((buildType) => buildType !== "auto");
|
|
14
15
|
var PreviewBuildStrategy = class {
|
|
15
16
|
#appPath;
|
|
16
17
|
#entrypoint;
|
|
@@ -56,133 +57,52 @@ async function executePreviewBuild(options) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
async function resolvePreviewBuildStrategy(options) {
|
|
59
|
-
if (options.buildType
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
if (options.buildType !== "auto") {
|
|
61
|
+
const strategy = await createPreviewBuildStrategy({
|
|
62
|
+
appPath: options.appPath,
|
|
63
|
+
entrypoint: options.entrypoint,
|
|
64
|
+
buildType: options.buildType
|
|
65
|
+
});
|
|
65
66
|
return {
|
|
66
|
-
buildType:
|
|
67
|
-
strategy
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
buildType: options.buildType,
|
|
68
|
+
strategy
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
for (const buildType of RESOLVED_PREVIEW_BUILD_TYPES) {
|
|
72
|
+
if (buildType === "bun") continue;
|
|
73
|
+
const strategy = await createPreviewBuildStrategy({
|
|
74
|
+
appPath: options.appPath,
|
|
75
|
+
entrypoint: options.entrypoint,
|
|
76
|
+
buildType
|
|
77
|
+
});
|
|
78
|
+
if (await strategy.canBuild()) return {
|
|
79
|
+
buildType,
|
|
80
|
+
strategy
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
|
-
const nextjsStrategy = new PreviewNextjsBuild({ appPath: options.appPath });
|
|
74
|
-
if (await nextjsStrategy.canBuild()) return {
|
|
75
|
-
buildType: "nextjs",
|
|
76
|
-
strategy: nextjsStrategy
|
|
77
|
-
};
|
|
78
|
-
const entrypoint = await resolveBunEntrypoint(options.appPath, options.entrypoint);
|
|
79
83
|
return {
|
|
80
84
|
buildType: "bun",
|
|
81
|
-
strategy:
|
|
85
|
+
strategy: await createPreviewBuildStrategy({
|
|
82
86
|
appPath: options.appPath,
|
|
83
|
-
entrypoint
|
|
87
|
+
entrypoint: options.entrypoint,
|
|
88
|
+
buildType: "bun"
|
|
84
89
|
})
|
|
85
90
|
};
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (!(await stat(standaloneDir).catch(() => null))?.isDirectory()) throw new Error("Next.js build did not produce standalone output. Add output: \"standalone\" to your next.config file.");
|
|
99
|
-
const outDir = await mkdtemp(path.join(os.tmpdir(), "compute-build-"));
|
|
100
|
-
try {
|
|
101
|
-
const artifactDir = path.join(outDir, "app");
|
|
102
|
-
await stageNextjsStandaloneArtifact({
|
|
103
|
-
standaloneDir,
|
|
104
|
-
artifactDir,
|
|
105
|
-
appPath: this.#appPath
|
|
106
|
-
});
|
|
107
|
-
const publicDir = path.join(this.#appPath, "public");
|
|
108
|
-
if (await directoryExists(publicDir)) await cp(publicDir, path.join(artifactDir, "public"), { recursive: true });
|
|
109
|
-
const staticDir = path.join(this.#appPath, ".next", "static");
|
|
110
|
-
if (await directoryExists(staticDir)) await cp(staticDir, path.join(artifactDir, ".next", "static"), { recursive: true });
|
|
111
|
-
return {
|
|
112
|
-
directory: artifactDir,
|
|
113
|
-
entrypoint: "server.js",
|
|
114
|
-
defaultPortMapping: { http: 3e3 },
|
|
115
|
-
cleanup: () => rm(outDir, {
|
|
116
|
-
recursive: true,
|
|
117
|
-
force: true
|
|
118
|
-
})
|
|
119
|
-
};
|
|
120
|
-
} catch (error) {
|
|
121
|
-
await rm(outDir, {
|
|
122
|
-
recursive: true,
|
|
123
|
-
force: true
|
|
92
|
+
async function createPreviewBuildStrategy(options) {
|
|
93
|
+
switch (options.buildType) {
|
|
94
|
+
case "nextjs": return new NextjsBuild({ appPath: options.appPath });
|
|
95
|
+
case "nuxt": return new NuxtBuild({ appPath: options.appPath });
|
|
96
|
+
case "astro": return new AstroBuild({ appPath: options.appPath });
|
|
97
|
+
case "tanstack-start": return new TanstackStartBuild({ appPath: options.appPath });
|
|
98
|
+
case "bun": {
|
|
99
|
+
const entrypoint = await resolveBunEntrypoint(options.appPath, options.entrypoint);
|
|
100
|
+
return new BunBuild({
|
|
101
|
+
appPath: options.appPath,
|
|
102
|
+
entrypoint
|
|
124
103
|
});
|
|
125
|
-
throw error;
|
|
126
104
|
}
|
|
127
105
|
}
|
|
128
|
-
async #hasNextConfig() {
|
|
129
|
-
let entries;
|
|
130
|
-
try {
|
|
131
|
-
entries = await readdir(this.#appPath);
|
|
132
|
-
} catch {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
return entries.some((entry) => NEXT_CONFIG_FILENAMES.includes(entry));
|
|
136
|
-
}
|
|
137
|
-
async #hasNextDependency() {
|
|
138
|
-
const packageJsonPath = path.join(this.#appPath, "package.json");
|
|
139
|
-
let content;
|
|
140
|
-
try {
|
|
141
|
-
content = await readFile(packageJsonPath, "utf8");
|
|
142
|
-
} catch {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
let parsed;
|
|
146
|
-
try {
|
|
147
|
-
parsed = JSON.parse(content);
|
|
148
|
-
} catch {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
const deps = isRecord(parsed.dependencies) ? parsed.dependencies : {};
|
|
152
|
-
const devDeps = isRecord(parsed.devDependencies) ? parsed.devDependencies : {};
|
|
153
|
-
return "next" in deps || "next" in devDeps;
|
|
154
|
-
}
|
|
155
|
-
async #runBuild() {
|
|
156
|
-
const candidates = [
|
|
157
|
-
{
|
|
158
|
-
command: path.join(this.#appPath, "node_modules", ".bin", "next"),
|
|
159
|
-
args: ["build"]
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
command: "npx",
|
|
163
|
-
args: ["next", "build"]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
command: "bunx",
|
|
167
|
-
args: ["next", "build"]
|
|
168
|
-
}
|
|
169
|
-
];
|
|
170
|
-
for (const { command, args } of candidates) try {
|
|
171
|
-
await exec(command, args, this.#appPath);
|
|
172
|
-
return;
|
|
173
|
-
} catch (error) {
|
|
174
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
throw new Error("Could not find the Next.js CLI. Install it with `npm install next` or ensure npx/bunx is available.");
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
async function stageNextjsStandaloneArtifact(options) {
|
|
181
|
-
const standaloneRoot = path.resolve(options.standaloneDir);
|
|
182
|
-
await copyPathMaterializingSymlinks(standaloneRoot, path.resolve(options.artifactDir), {
|
|
183
|
-
standaloneRoot,
|
|
184
|
-
appRoot: path.resolve(options.appPath)
|
|
185
|
-
});
|
|
186
106
|
}
|
|
187
107
|
async function normalizeArtifactSymlinks(artifactDir, appPath) {
|
|
188
108
|
const normalizedArtifactDir = path.resolve(artifactDir);
|
|
@@ -218,66 +138,5 @@ function isPathWithin(rootPath, candidatePath) {
|
|
|
218
138
|
const relativePath = path.relative(rootPath, candidatePath);
|
|
219
139
|
return relativePath === "" || !relativePath.startsWith(`..${path.sep}`) && relativePath !== ".." && !path.isAbsolute(relativePath);
|
|
220
140
|
}
|
|
221
|
-
async function copyPathMaterializingSymlinks(sourcePath, destinationPath, options) {
|
|
222
|
-
const sourceStat = await lstat(sourcePath);
|
|
223
|
-
if (sourceStat.isSymbolicLink()) {
|
|
224
|
-
await copyPathMaterializingSymlinks(await resolveSymlinkTarget(sourcePath, options), destinationPath, options);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (sourceStat.isDirectory()) {
|
|
228
|
-
await mkdir(destinationPath, { recursive: true });
|
|
229
|
-
const entries = await readdir(sourcePath, { withFileTypes: true });
|
|
230
|
-
for (const entry of entries) await copyPathMaterializingSymlinks(path.join(sourcePath, entry.name), path.join(destinationPath, entry.name), options);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (sourceStat.isFile()) {
|
|
234
|
-
await mkdir(path.dirname(destinationPath), { recursive: true });
|
|
235
|
-
await copyFile(sourcePath, destinationPath);
|
|
236
|
-
await chmod(destinationPath, sourceStat.mode);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async function resolveSymlinkTarget(symlinkPath, options) {
|
|
240
|
-
const linkTarget = await readlink(symlinkPath);
|
|
241
|
-
const resolvedTarget = path.resolve(path.dirname(symlinkPath), linkTarget);
|
|
242
|
-
if (await pathExists(resolvedTarget)) {
|
|
243
|
-
if (!isPathWithin(options.appRoot, resolvedTarget)) throw new Error(`Build artifact symlink escapes the app directory: ${resolvedTarget}`);
|
|
244
|
-
return resolvedTarget;
|
|
245
|
-
}
|
|
246
|
-
if (isPathWithin(options.standaloneRoot, resolvedTarget)) {
|
|
247
|
-
const fallbackTarget = path.join(options.appRoot, path.relative(options.standaloneRoot, resolvedTarget));
|
|
248
|
-
if (await pathExists(fallbackTarget)) return fallbackTarget;
|
|
249
|
-
}
|
|
250
|
-
throw new Error(`Next.js standalone symlink target is missing: ${symlinkPath} -> ${linkTarget} (resolved to ${resolvedTarget})`);
|
|
251
|
-
}
|
|
252
|
-
async function directoryExists(dirPath) {
|
|
253
|
-
return (await stat(dirPath).catch(() => null))?.isDirectory() ?? false;
|
|
254
|
-
}
|
|
255
|
-
function exec(command, args, cwd) {
|
|
256
|
-
return new Promise((resolve, reject) => {
|
|
257
|
-
execFile(command, args, { cwd }, (error, _stdout, stderr) => {
|
|
258
|
-
if (error) {
|
|
259
|
-
if ("code" in error && error.code === "ENOENT") {
|
|
260
|
-
reject(Object.assign(/* @__PURE__ */ new Error(`${command} not found`), { code: "ENOENT" }));
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const message = stderr.trim() || error.message;
|
|
264
|
-
reject(/* @__PURE__ */ new Error(`Next.js build failed:\n${message}`));
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
resolve();
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function isRecord(value) {
|
|
272
|
-
return typeof value === "object" && value !== null;
|
|
273
|
-
}
|
|
274
|
-
async function pathExists(targetPath) {
|
|
275
|
-
try {
|
|
276
|
-
await stat(targetPath);
|
|
277
|
-
return true;
|
|
278
|
-
} catch {
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
141
|
//#endregion
|
|
283
|
-
export { PreviewBuildStrategy, executePreviewBuild };
|
|
142
|
+
export { PREVIEW_BUILD_TYPES, PreviewBuildStrategy, RESOLVED_PREVIEW_BUILD_TYPES, executePreviewBuild };
|
|
@@ -60,8 +60,12 @@ const DESCRIPTORS = [
|
|
|
60
60
|
id: "app",
|
|
61
61
|
path: ["prisma", "app"],
|
|
62
62
|
description: "App deployment and release commands.",
|
|
63
|
-
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-
|
|
64
|
-
examples: [
|
|
63
|
+
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-autobunnextjsnuxtastrotanstack-start---http-port-port---env-namevalue",
|
|
64
|
+
examples: [
|
|
65
|
+
"prisma app build --build-type nextjs",
|
|
66
|
+
"prisma app deploy --app hello-world --build-type nextjs --http-port 3000",
|
|
67
|
+
"prisma app deploy --app hello-world --build-type nuxt"
|
|
68
|
+
]
|
|
65
69
|
},
|
|
66
70
|
{
|
|
67
71
|
id: "branch",
|
|
@@ -144,8 +148,12 @@ const DESCRIPTORS = [
|
|
|
144
148
|
"build"
|
|
145
149
|
],
|
|
146
150
|
description: "Build the local app into a deployable artifact.",
|
|
147
|
-
docsPath: "docs/product/command-spec.md#prisma-app-build---entry-path---build-type-
|
|
148
|
-
examples: [
|
|
151
|
+
docsPath: "docs/product/command-spec.md#prisma-app-build---entry-path---build-type-autobunnextjsnuxtastrotanstack-start",
|
|
152
|
+
examples: [
|
|
153
|
+
"prisma app build --build-type nextjs",
|
|
154
|
+
"prisma app build --build-type nuxt",
|
|
155
|
+
"prisma app build --build-type bun --entry server.ts"
|
|
156
|
+
]
|
|
149
157
|
},
|
|
150
158
|
{
|
|
151
159
|
id: "app.run",
|
|
@@ -166,11 +174,12 @@ const DESCRIPTORS = [
|
|
|
166
174
|
"deploy"
|
|
167
175
|
],
|
|
168
176
|
description: "Build and release the selected app.",
|
|
169
|
-
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-
|
|
177
|
+
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-autobunnextjsnuxtastrotanstack-start---http-port-port---env-namevalue",
|
|
170
178
|
examples: [
|
|
171
179
|
"prisma app deploy",
|
|
172
180
|
"prisma app deploy --app hello-world --env DATABASE_URL=postgresql://example",
|
|
173
|
-
"prisma app deploy --app hello-world --build-type nextjs --http-port 3000"
|
|
181
|
+
"prisma app deploy --app hello-world --build-type nextjs --http-port 3000",
|
|
182
|
+
"prisma app deploy --app hello-world --build-type nuxt"
|
|
174
183
|
]
|
|
175
184
|
},
|
|
176
185
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"description": "Preview of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@clack/prompts": "^1.2.0",
|
|
39
|
-
"@prisma/compute-sdk": "^0.
|
|
39
|
+
"@prisma/compute-sdk": "^0.17.0",
|
|
40
40
|
"c12": "4.0.0-beta.4",
|
|
41
41
|
"@prisma/credentials-store": "^7.7.0",
|
|
42
42
|
"@prisma/management-api-sdk": "^1.24.0",
|