@prisma/compute-sdk 0.28.0 → 0.30.0
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/api-client.d.ts +38 -38
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +44 -43
- package/dist/api-client.js.map +1 -1
- package/dist/astro-build.d.ts +2 -0
- package/dist/astro-build.d.ts.map +1 -1
- package/dist/astro-build.js +31 -39
- package/dist/astro-build.js.map +1 -1
- package/dist/build-settings.d.ts +3 -0
- package/dist/build-settings.d.ts.map +1 -1
- package/dist/build-settings.js +13 -0
- package/dist/build-settings.js.map +1 -1
- package/dist/build-strategy.d.ts +20 -0
- package/dist/build-strategy.d.ts.map +1 -1
- package/dist/build-strategy.js +33 -1
- package/dist/build-strategy.js.map +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +16 -4
- package/dist/build.js.map +1 -1
- package/dist/bun-build.d.ts +1 -1
- package/dist/bun-build.d.ts.map +1 -1
- package/dist/bun-build.js +25 -9
- package/dist/bun-build.js.map +1 -1
- package/dist/callbacks.d.ts +33 -33
- package/dist/callbacks.d.ts.map +1 -1
- package/dist/compute-client.d.ts +66 -66
- package/dist/compute-client.d.ts.map +1 -1
- package/dist/compute-client.js +274 -272
- package/dist/compute-client.js.map +1 -1
- package/dist/config/frameworks.d.ts +4 -8
- package/dist/config/frameworks.d.ts.map +1 -1
- package/dist/config/frameworks.js +17 -5
- package/dist/config/frameworks.js.map +1 -1
- package/dist/config/normalize.d.ts +6 -0
- package/dist/config/normalize.d.ts.map +1 -1
- package/dist/config/normalize.js +53 -12
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/types.d.ts +3 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +1 -0
- package/dist/config/types.js.map +1 -1
- package/dist/configured-artifact.d.ts +20 -0
- package/dist/configured-artifact.d.ts.map +1 -0
- package/dist/configured-artifact.js +104 -0
- package/dist/configured-artifact.js.map +1 -0
- package/dist/custom-build.d.ts +20 -0
- package/dist/custom-build.d.ts.map +1 -0
- package/dist/custom-build.js +53 -0
- package/dist/custom-build.js.map +1 -0
- package/dist/errors.d.ts +28 -28
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -12
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/log-stream.d.ts +1 -1
- package/dist/log-stream.d.ts.map +1 -1
- package/dist/log-stream.js +1 -1
- package/dist/log-stream.js.map +1 -1
- package/dist/nestjs-build.d.ts.map +1 -1
- package/dist/nestjs-build.js +28 -29
- package/dist/nestjs-build.js.map +1 -1
- package/dist/nextjs-build.d.ts +1 -1
- package/dist/nextjs-build.d.ts.map +1 -1
- package/dist/nextjs-build.js +25 -14
- package/dist/nextjs-build.js.map +1 -1
- package/dist/nuxt-build.d.ts +2 -0
- package/dist/nuxt-build.d.ts.map +1 -1
- package/dist/nuxt-build.js +31 -39
- package/dist/nuxt-build.js.map +1 -1
- package/dist/polling.d.ts +4 -4
- package/dist/polling.d.ts.map +1 -1
- package/dist/polling.js +15 -15
- package/dist/polling.js.map +1 -1
- package/dist/tanstack-start-build.d.ts +1 -1
- package/dist/tanstack-start-build.d.ts.map +1 -1
- package/dist/tanstack-start-build.js +26 -47
- package/dist/tanstack-start-build.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api-client.ts +57 -63
- package/src/astro-build.ts +39 -46
- package/src/build-settings.ts +16 -0
- package/src/build-strategy.ts +56 -1
- package/src/build.ts +16 -4
- package/src/bun-build.ts +39 -10
- package/src/callbacks.ts +34 -34
- package/src/compute-client.ts +433 -413
- package/src/config/frameworks.ts +18 -5
- package/src/config/normalize.ts +74 -13
- package/src/config/types.ts +3 -0
- package/src/configured-artifact.ts +169 -0
- package/src/custom-build.ts +73 -0
- package/src/errors.ts +42 -38
- package/src/index.ts +27 -26
- package/src/log-stream.ts +2 -2
- package/src/nestjs-build.ts +36 -33
- package/src/nextjs-build.ts +31 -14
- package/src/nuxt-build.ts +39 -46
- package/src/polling.ts +19 -18
- package/src/tanstack-start-build.ts +31 -53
- package/src/types.ts +8 -8
package/src/index.ts
CHANGED
|
@@ -40,36 +40,37 @@ export { BunBuild } from "./bun-build.ts";
|
|
|
40
40
|
export type {
|
|
41
41
|
DeployInteraction,
|
|
42
42
|
DeployProgress,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
DestroyAppProgress,
|
|
44
|
+
DestroyDeploymentInteraction,
|
|
45
|
+
DestroyDeploymentProgress,
|
|
46
46
|
PromoteProgress,
|
|
47
47
|
UpdateEnvProgress,
|
|
48
48
|
} from "./callbacks.ts";
|
|
49
49
|
export type {
|
|
50
|
+
CreateAppOptions,
|
|
50
51
|
CreateProjectOptions,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
DeleteVersionOptions,
|
|
52
|
+
DeleteAppOptions,
|
|
53
|
+
DeleteDeploymentOptions,
|
|
54
54
|
DeployOptions,
|
|
55
55
|
DeployResult,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
DestroyAppOptions,
|
|
57
|
+
DestroyAppResult,
|
|
58
|
+
DestroyDeploymentOptions,
|
|
59
|
+
DestroyDeploymentResult,
|
|
60
|
+
ListAppsOptions,
|
|
61
|
+
ListDeploymentsOptions,
|
|
60
62
|
ListProjectsOptions,
|
|
61
|
-
ListServicesOptions,
|
|
62
|
-
ListVersionsOptions,
|
|
63
63
|
PromoteOptions,
|
|
64
64
|
PromoteResult,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
ShowAppOptions,
|
|
66
|
+
ShowDeploymentOptions,
|
|
67
|
+
StartDeploymentOptions,
|
|
68
|
+
StopDeploymentOptions,
|
|
69
69
|
UpdateEnvOptions,
|
|
70
70
|
UpdateEnvResult,
|
|
71
71
|
} from "./compute-client.ts";
|
|
72
72
|
export { ComputeClient } from "./compute-client.ts";
|
|
73
|
+
export { CustomBuild } from "./custom-build.ts";
|
|
73
74
|
export type {
|
|
74
75
|
DetectedSchema,
|
|
75
76
|
MigrationCommand,
|
|
@@ -82,11 +83,11 @@ export { detectAppSchema } from "./detect-schema.ts";
|
|
|
82
83
|
export type {
|
|
83
84
|
ApiRequestError,
|
|
84
85
|
DeployError,
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
DeploymentOperationError,
|
|
87
|
+
DestroyAppError,
|
|
88
|
+
DestroyDeploymentError,
|
|
87
89
|
PromoteError,
|
|
88
90
|
UpdateEnvError,
|
|
89
|
-
VersionOperationError,
|
|
90
91
|
} from "./errors.ts";
|
|
91
92
|
export {
|
|
92
93
|
ApiError,
|
|
@@ -94,14 +95,14 @@ export {
|
|
|
94
95
|
AuthenticationError,
|
|
95
96
|
BuildError,
|
|
96
97
|
CancelledError,
|
|
98
|
+
DeploymentFailedError,
|
|
97
99
|
DestroyAggregateError,
|
|
98
100
|
InvalidOptionsError,
|
|
99
101
|
LogStreamError,
|
|
100
102
|
MissingArgumentError,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
NoDeploymentsFoundError,
|
|
104
|
+
NoExistingDeploymentError,
|
|
103
105
|
TimeoutError,
|
|
104
|
-
VersionFailedError,
|
|
105
106
|
} from "./errors.ts";
|
|
106
107
|
export type {
|
|
107
108
|
LogRecord,
|
|
@@ -117,16 +118,16 @@ export { NextjsBuild } from "./nextjs-build.ts";
|
|
|
117
118
|
export { NuxtBuild } from "./nuxt-build.ts";
|
|
118
119
|
export { TanstackStartBuild } from "./tanstack-start-build.ts";
|
|
119
120
|
export type {
|
|
121
|
+
AppDetail,
|
|
122
|
+
AppInfo,
|
|
120
123
|
CreateProjectResult,
|
|
121
124
|
DatabaseInfo,
|
|
125
|
+
DeploymentDetail,
|
|
126
|
+
DeploymentInfo,
|
|
122
127
|
PortMapping,
|
|
123
128
|
ProjectInfo,
|
|
124
129
|
RegionInfo,
|
|
125
130
|
ResolvedConfig,
|
|
126
|
-
ServiceDetail,
|
|
127
|
-
ServiceInfo,
|
|
128
|
-
VersionDetail,
|
|
129
|
-
VersionInfo,
|
|
130
131
|
} from "./types.ts";
|
|
131
132
|
export { KNOWN_REGION_IDS, REGIONS } from "./types.ts";
|
|
132
133
|
export { uploadArtifact } from "./upload-artifact.ts";
|
package/src/log-stream.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type StreamRecord = LogRecord | TerminalRecord;
|
|
|
27
27
|
export type LogStreamOptions = {
|
|
28
28
|
baseUrl: string;
|
|
29
29
|
token: string;
|
|
30
|
-
|
|
30
|
+
deploymentId: string;
|
|
31
31
|
tail?: number;
|
|
32
32
|
fromStart?: boolean;
|
|
33
33
|
cursor?: string;
|
|
@@ -71,7 +71,7 @@ function toError(value: unknown): Error {
|
|
|
71
71
|
|
|
72
72
|
function buildWebSocketUrl(options: LogStreamOptions): string {
|
|
73
73
|
const httpUrl = new URL(
|
|
74
|
-
`/v1/
|
|
74
|
+
`/v1/deployments/${encodeURIComponent(options.deploymentId)}/logs`,
|
|
75
75
|
options.baseUrl,
|
|
76
76
|
);
|
|
77
77
|
httpUrl.protocol = httpUrl.protocol === "https:" ? "wss:" : "ws:";
|
package/src/nestjs-build.ts
CHANGED
|
@@ -24,15 +24,11 @@ import type { BuildArtifact, BuildStrategy } from "./build-strategy.ts";
|
|
|
24
24
|
import {
|
|
25
25
|
hasPackageDependency,
|
|
26
26
|
hasRootFile,
|
|
27
|
-
|
|
27
|
+
runBuildSettingsCommand,
|
|
28
28
|
} from "./build-strategy.ts";
|
|
29
29
|
import { defaultHttpPortForBuildType } from "./config/frameworks.ts";
|
|
30
30
|
import { resolveSourceRoot } from "./config/source-root.ts";
|
|
31
|
-
import {
|
|
32
|
-
type BuildCommandIo,
|
|
33
|
-
readPackageManifest,
|
|
34
|
-
runBuildCommand,
|
|
35
|
-
} from "./workspace.ts";
|
|
31
|
+
import { type BuildCommandIo, readPackageManifest } from "./workspace.ts";
|
|
36
32
|
|
|
37
33
|
const NEST_CLI_FILENAME = "nest-cli.json";
|
|
38
34
|
|
|
@@ -81,37 +77,26 @@ export class NestjsBuild implements BuildStrategy {
|
|
|
81
77
|
signal,
|
|
82
78
|
}));
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!usingFrameworkDefault && settings.buildCommand) {
|
|
91
|
-
await runBuildCommand({
|
|
92
|
-
appPath: this.#appPath,
|
|
93
|
-
command: settings.buildCommand,
|
|
94
|
-
failurePrefix: "NestJS",
|
|
95
|
-
env: this.#io?.env,
|
|
96
|
-
onOutput: this.#io?.onOutput,
|
|
97
|
-
signal,
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
await runPackageCli({
|
|
101
|
-
appPath: this.#appPath,
|
|
80
|
+
await runBuildSettingsCommand({
|
|
81
|
+
appPath: this.#appPath,
|
|
82
|
+
settings,
|
|
83
|
+
failurePrefix: "NestJS",
|
|
84
|
+
defaultCli: {
|
|
85
|
+
source: "NestJS default",
|
|
102
86
|
cliName: "nest",
|
|
103
87
|
args: ["build"],
|
|
104
|
-
failurePrefix: "NestJS",
|
|
105
88
|
missingMessage:
|
|
106
89
|
"Could not find the Nest CLI. Add a `build` script to package.json, install @nestjs/cli, or ensure npx/bunx is available.",
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
90
|
+
},
|
|
91
|
+
io: this.#io,
|
|
92
|
+
signal,
|
|
93
|
+
});
|
|
112
94
|
|
|
113
95
|
signal?.throwIfAborted();
|
|
114
|
-
const compiledEntry = await this.#resolveCompiledEntrypoint(
|
|
96
|
+
const compiledEntry = await this.#resolveCompiledEntrypoint(
|
|
97
|
+
settings,
|
|
98
|
+
signal,
|
|
99
|
+
);
|
|
115
100
|
|
|
116
101
|
const outDir = await mkdtemp(path.join(os.tmpdir(), "compute-build-"));
|
|
117
102
|
try {
|
|
@@ -140,9 +125,16 @@ export class NestjsBuild implements BuildStrategy {
|
|
|
140
125
|
* separators. Prefers `package.json` `main`, then the path computed from
|
|
141
126
|
* `nest-cli.json` and the tsconfig `outDir`, then the common defaults.
|
|
142
127
|
*/
|
|
143
|
-
async #resolveCompiledEntrypoint(
|
|
128
|
+
async #resolveCompiledEntrypoint(
|
|
129
|
+
settings: BuildSettings,
|
|
130
|
+
signal?: AbortSignal,
|
|
131
|
+
): Promise<string> {
|
|
144
132
|
const candidates: string[] = [];
|
|
145
133
|
|
|
134
|
+
if (settings.entrypoint) {
|
|
135
|
+
candidates.push(joinPosix(settings.outputDirectory, settings.entrypoint));
|
|
136
|
+
}
|
|
137
|
+
|
|
146
138
|
const fromMain = await this.#mainFieldEntrypoint(signal);
|
|
147
139
|
if (fromMain) {
|
|
148
140
|
candidates.push(fromMain);
|
|
@@ -153,7 +145,7 @@ export class NestjsBuild implements BuildStrategy {
|
|
|
153
145
|
candidates.push(fromConfig);
|
|
154
146
|
}
|
|
155
147
|
|
|
156
|
-
candidates.push(...
|
|
148
|
+
candidates.push(...compiledEntrypointDefaults(settings.outputDirectory));
|
|
157
149
|
|
|
158
150
|
for (const candidate of candidates) {
|
|
159
151
|
signal?.throwIfAborted();
|
|
@@ -195,6 +187,17 @@ export class NestjsBuild implements BuildStrategy {
|
|
|
195
187
|
}
|
|
196
188
|
}
|
|
197
189
|
|
|
190
|
+
function compiledEntrypointDefaults(outputDirectory: string): string[] {
|
|
191
|
+
if (outputDirectory === "dist") {
|
|
192
|
+
return DEFAULT_COMPILED_ENTRYPOINTS;
|
|
193
|
+
}
|
|
194
|
+
return [
|
|
195
|
+
joinPosix(outputDirectory, "src/main.js"),
|
|
196
|
+
joinPosix(outputDirectory, "main.js"),
|
|
197
|
+
...DEFAULT_COMPILED_ENTRYPOINTS,
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
|
|
198
201
|
interface NestCliConfig {
|
|
199
202
|
sourceRoot?: string;
|
|
200
203
|
entryFile?: string;
|
package/src/nextjs-build.ts
CHANGED
|
@@ -9,9 +9,14 @@ import {
|
|
|
9
9
|
resolveBuildSettings,
|
|
10
10
|
} from "./build-settings.ts";
|
|
11
11
|
import type { BuildArtifact, BuildStrategy } from "./build-strategy.ts";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
hasPackageDependency,
|
|
14
|
+
hasRootFile,
|
|
15
|
+
runBuildSettingsCommand,
|
|
16
|
+
} from "./build-strategy.ts";
|
|
13
17
|
import { defaultHttpPortForBuildType } from "./config/frameworks.ts";
|
|
14
|
-
import {
|
|
18
|
+
import { resolveConfiguredArtifactEntrypoint } from "./configured-artifact.ts";
|
|
19
|
+
import type { BuildCommandIo } from "./workspace.ts";
|
|
15
20
|
|
|
16
21
|
const NEXT_CONFIG_FILENAMES = [
|
|
17
22
|
"next.config.js",
|
|
@@ -63,20 +68,24 @@ export class NextjsBuild implements BuildStrategy {
|
|
|
63
68
|
buildType: "nextjs",
|
|
64
69
|
signal,
|
|
65
70
|
}));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
await runBuildSettingsCommand({
|
|
72
|
+
appPath: this.#appPath,
|
|
73
|
+
settings,
|
|
74
|
+
failurePrefix: "Next.js",
|
|
75
|
+
defaultCli: {
|
|
76
|
+
source: "Next.js default",
|
|
77
|
+
cliName: "next",
|
|
78
|
+
args: ["build"],
|
|
79
|
+
missingMessage:
|
|
80
|
+
"Could not find the Next.js CLI. Install it with `npm install next` or ensure npx/bunx is available.",
|
|
81
|
+
},
|
|
82
|
+
io: this.#io,
|
|
83
|
+
signal,
|
|
84
|
+
});
|
|
76
85
|
|
|
77
86
|
const standaloneDir = path.join(this.#appPath, settings.outputDirectory);
|
|
78
87
|
if (!(await directoryExists(standaloneDir))) {
|
|
79
|
-
if (this.#requireStandalone) {
|
|
88
|
+
if (this.#requireStandalone || settings.entrypoint) {
|
|
80
89
|
throw new Error(
|
|
81
90
|
`Next.js build did not produce standalone output at ${settings.outputDirectory}. ` +
|
|
82
91
|
'Set output: "standalone" in your next.config; this deploy target requires it.',
|
|
@@ -97,7 +106,15 @@ export class NextjsBuild implements BuildStrategy {
|
|
|
97
106
|
appPath: this.#appPath,
|
|
98
107
|
signal,
|
|
99
108
|
});
|
|
100
|
-
const entrypoint =
|
|
109
|
+
const entrypoint = settings.entrypoint
|
|
110
|
+
? await resolveConfiguredArtifactEntrypoint({
|
|
111
|
+
directory: artifactDir,
|
|
112
|
+
entrypoint: settings.entrypoint,
|
|
113
|
+
label: "Next.js",
|
|
114
|
+
displayDirectory: settings.outputDirectory,
|
|
115
|
+
missingEntrypointMessage: `Next.js standalone output did not contain configured entrypoint ${settings.outputDirectory}/${settings.entrypoint}.`,
|
|
116
|
+
})
|
|
117
|
+
: await findStandaloneEntrypoint(artifactDir);
|
|
101
118
|
await copyStaticAssets({
|
|
102
119
|
appPath: this.#appPath,
|
|
103
120
|
artifactDir,
|
package/src/nuxt-build.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
import { normalizeArtifactSymlinks } from "./artifact-postprocess.ts";
|
|
1
|
+
import { type BuildSettings, resolveBuildSettings } from "./build-settings.ts";
|
|
6
2
|
import type { BuildArtifact, BuildStrategy } from "./build-strategy.ts";
|
|
7
3
|
import {
|
|
8
4
|
hasPackageDependency,
|
|
9
5
|
hasRootFile,
|
|
10
|
-
|
|
6
|
+
runBuildSettingsCommand,
|
|
11
7
|
} from "./build-strategy.ts";
|
|
12
|
-
import {
|
|
8
|
+
import { stageConfiguredArtifact } from "./configured-artifact.ts";
|
|
13
9
|
import type { BuildCommandIo } from "./workspace.ts";
|
|
14
10
|
|
|
15
11
|
const NUXT_CONFIG_FILENAMES = [
|
|
@@ -26,10 +22,16 @@ const NUXT_CONFIG_FILENAMES = [
|
|
|
26
22
|
*/
|
|
27
23
|
export class NuxtBuild implements BuildStrategy {
|
|
28
24
|
readonly #appPath: string;
|
|
25
|
+
readonly #buildSettings?: BuildSettings;
|
|
29
26
|
readonly #io?: BuildCommandIo;
|
|
30
27
|
|
|
31
|
-
constructor(options: {
|
|
28
|
+
constructor(options: {
|
|
29
|
+
appPath: string;
|
|
30
|
+
buildSettings?: BuildSettings;
|
|
31
|
+
io?: BuildCommandIo;
|
|
32
|
+
}) {
|
|
32
33
|
this.#appPath = options.appPath;
|
|
34
|
+
this.#buildSettings = options.buildSettings;
|
|
33
35
|
this.#io = options.io;
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -42,48 +44,39 @@ export class NuxtBuild implements BuildStrategy {
|
|
|
42
44
|
|
|
43
45
|
async execute(signal?: AbortSignal): Promise<BuildArtifact> {
|
|
44
46
|
signal?.throwIfAborted();
|
|
45
|
-
|
|
47
|
+
const settings =
|
|
48
|
+
this.#buildSettings ??
|
|
49
|
+
(await resolveBuildSettings({
|
|
50
|
+
appPath: this.#appPath,
|
|
51
|
+
buildType: "nuxt",
|
|
52
|
+
signal,
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
await runBuildSettingsCommand({
|
|
46
56
|
appPath: this.#appPath,
|
|
47
|
-
|
|
48
|
-
args: ["build"],
|
|
57
|
+
settings,
|
|
49
58
|
failurePrefix: "Nuxt",
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
defaultCli: {
|
|
60
|
+
source: "Nuxt default",
|
|
61
|
+
cliName: "nuxt",
|
|
62
|
+
args: ["build"],
|
|
63
|
+
missingMessage:
|
|
64
|
+
"Could not find the Nuxt CLI. Install it with `npm install nuxt` or ensure npx/bunx is available.",
|
|
65
|
+
},
|
|
66
|
+
io: this.#io,
|
|
54
67
|
signal,
|
|
55
68
|
});
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
const artifactDir = path.join(outDir, "app");
|
|
70
|
-
await cp(outputDir, artifactDir, {
|
|
71
|
-
recursive: true,
|
|
72
|
-
verbatimSymlinks: true,
|
|
73
|
-
});
|
|
74
|
-
// Materialize any symlinks into the app/workspace node_modules so the
|
|
75
|
-
// artifact is self-contained once unpacked elsewhere.
|
|
76
|
-
await normalizeArtifactSymlinks(artifactDir, this.#appPath, signal);
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
directory: artifactDir,
|
|
80
|
-
entrypoint: "server/index.mjs",
|
|
81
|
-
defaultPortMapping: { http: defaultHttpPortForBuildType("nuxt") },
|
|
82
|
-
cleanup: () => rm(outDir, { recursive: true, force: true }),
|
|
83
|
-
};
|
|
84
|
-
} catch (error) {
|
|
85
|
-
await rm(outDir, { recursive: true, force: true });
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
70
|
+
return stageConfiguredArtifact({
|
|
71
|
+
appPath: this.#appPath,
|
|
72
|
+
outputDirectory: settings.outputDirectory,
|
|
73
|
+
entrypoint: settings.entrypoint ?? "server/index.mjs",
|
|
74
|
+
buildType: "nuxt",
|
|
75
|
+
label: "Nuxt",
|
|
76
|
+
missingEntrypointMessage: settings.entrypoint
|
|
77
|
+
? undefined
|
|
78
|
+
: `Nuxt build did not produce a Nitro node server entrypoint at ${settings.outputDirectory}/server/index.mjs. Ensure nitro.preset is 'node-server' (the default) - set NITRO_PRESET=node-server or remove any custom preset from nuxt.config.`,
|
|
79
|
+
signal,
|
|
80
|
+
});
|
|
88
81
|
}
|
|
89
82
|
}
|
package/src/polling.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { ApiClientError, InternalApiClient } from "./api-client.ts";
|
|
|
3
3
|
import {
|
|
4
4
|
ApiError,
|
|
5
5
|
CancelledError,
|
|
6
|
+
DeploymentFailedError,
|
|
6
7
|
TimeoutError,
|
|
7
|
-
VersionFailedError,
|
|
8
8
|
} from "./errors.ts";
|
|
9
9
|
|
|
10
10
|
export type PollOptions = {
|
|
@@ -23,17 +23,17 @@ export type PollResult = {
|
|
|
23
23
|
export type PollError =
|
|
24
24
|
| CancelledError
|
|
25
25
|
| TimeoutError
|
|
26
|
-
|
|
|
26
|
+
| DeploymentFailedError
|
|
27
27
|
| ApiClientError;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Polls a
|
|
30
|
+
* Polls a deployment until it reaches the target status, fails, or times out.
|
|
31
31
|
*
|
|
32
32
|
* Returns a Result with the preview domain on success or a typed error.
|
|
33
33
|
*/
|
|
34
|
-
export async function
|
|
34
|
+
export async function pollDeploymentStatus(
|
|
35
35
|
api: InternalApiClient,
|
|
36
|
-
|
|
36
|
+
deploymentId: string,
|
|
37
37
|
options: PollOptions,
|
|
38
38
|
): Promise<Result<PollResult, PollError>> {
|
|
39
39
|
return Result.gen(async function* () {
|
|
@@ -45,34 +45,35 @@ export async function pollVersionStatus(
|
|
|
45
45
|
return Result.err(new CancelledError());
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
api.
|
|
48
|
+
const deployment = yield* Result.await(
|
|
49
|
+
api.getDeployment(deploymentId, options.signal),
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
-
if (
|
|
53
|
-
lastStatus =
|
|
54
|
-
options.onStatusChange?.(
|
|
52
|
+
if (deployment.status !== lastStatus) {
|
|
53
|
+
lastStatus = deployment.status;
|
|
54
|
+
options.onStatusChange?.(deployment.status);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (
|
|
58
|
-
if (options.targetStatus === "running" && !
|
|
57
|
+
if (deployment.status === options.targetStatus) {
|
|
58
|
+
if (options.targetStatus === "running" && !deployment.previewDomain) {
|
|
59
59
|
return Result.err(
|
|
60
60
|
new ApiError({
|
|
61
61
|
statusCode: 0,
|
|
62
62
|
statusText: "",
|
|
63
|
-
message:
|
|
63
|
+
message:
|
|
64
|
+
"Deployment reached running state without a previewDomain",
|
|
64
65
|
traceHeaders: {},
|
|
65
66
|
}),
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
69
|
return Result.ok({
|
|
69
|
-
previewDomain:
|
|
70
|
-
lastStatus:
|
|
70
|
+
previewDomain: deployment.previewDomain ?? "",
|
|
71
|
+
lastStatus: deployment.status,
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
if (
|
|
75
|
-
return Result.err(new
|
|
75
|
+
if (deployment.status === "failed") {
|
|
76
|
+
return Result.err(new DeploymentFailedError({ deploymentId }));
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
await sleep(options.pollIntervalMs, options.signal);
|
|
@@ -80,7 +81,7 @@ export async function pollVersionStatus(
|
|
|
80
81
|
|
|
81
82
|
return Result.err(
|
|
82
83
|
new TimeoutError({
|
|
83
|
-
|
|
84
|
+
deploymentId,
|
|
84
85
|
elapsedMs: Date.now() - (deadline - options.timeoutSeconds * 1_000),
|
|
85
86
|
lastStatus,
|
|
86
87
|
}),
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { cp, mkdtemp, rm, stat } from "node:fs/promises";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
import { normalizeArtifactSymlinks } from "./artifact-postprocess.ts";
|
|
6
1
|
import { type BuildSettings, resolveBuildSettings } from "./build-settings.ts";
|
|
7
2
|
import type { BuildArtifact, BuildStrategy } from "./build-strategy.ts";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import {
|
|
4
|
+
hasPackageDependency,
|
|
5
|
+
runBuildSettingsCommand,
|
|
6
|
+
} from "./build-strategy.ts";
|
|
7
|
+
import { stageConfiguredArtifact } from "./configured-artifact.ts";
|
|
8
|
+
import type { BuildCommandIo } from "./workspace.ts";
|
|
11
9
|
|
|
12
10
|
const TANSTACK_START_PACKAGES = [
|
|
13
11
|
"@tanstack/react-start",
|
|
@@ -47,51 +45,31 @@ export class TanstackStartBuild implements BuildStrategy {
|
|
|
47
45
|
buildType: "tanstack-start",
|
|
48
46
|
signal,
|
|
49
47
|
}));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
() => null,
|
|
65
|
-
);
|
|
66
|
-
if (!entryStat?.isFile()) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
`TanStack Start build did not produce a Nitro node server entrypoint at ${settings.outputDirectory}/${entrypoint}. ` +
|
|
69
|
-
"Ensure your vite.config includes the tanstackStart() and nitro() plugins with the default node preset.",
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const outDir = await mkdtemp(path.join(os.tmpdir(), "compute-build-"));
|
|
74
|
-
try {
|
|
75
|
-
const artifactDir = path.join(outDir, "app");
|
|
76
|
-
await cp(outputDir, artifactDir, {
|
|
77
|
-
recursive: true,
|
|
78
|
-
verbatimSymlinks: true,
|
|
79
|
-
});
|
|
80
|
-
// Materialize any symlinks into the app/workspace node_modules so the
|
|
81
|
-
// artifact is self-contained once unpacked elsewhere.
|
|
82
|
-
await normalizeArtifactSymlinks(artifactDir, this.#appPath, signal);
|
|
48
|
+
await runBuildSettingsCommand({
|
|
49
|
+
appPath: this.#appPath,
|
|
50
|
+
settings,
|
|
51
|
+
failurePrefix: "TanStack Start",
|
|
52
|
+
defaultCli: {
|
|
53
|
+
source: "TanStack Start default",
|
|
54
|
+
cliName: "vite",
|
|
55
|
+
args: ["build"],
|
|
56
|
+
missingMessage:
|
|
57
|
+
"Could not find the Vite CLI. Install it with `npm install vite` or ensure npx/bunx is available.",
|
|
58
|
+
},
|
|
59
|
+
io: this.#io,
|
|
60
|
+
signal,
|
|
61
|
+
});
|
|
83
62
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
63
|
+
return stageConfiguredArtifact({
|
|
64
|
+
appPath: this.#appPath,
|
|
65
|
+
outputDirectory: settings.outputDirectory,
|
|
66
|
+
entrypoint: settings.entrypoint ?? "server/index.mjs",
|
|
67
|
+
buildType: "tanstack-start",
|
|
68
|
+
label: "TanStack Start",
|
|
69
|
+
missingEntrypointMessage: settings.entrypoint
|
|
70
|
+
? undefined
|
|
71
|
+
: `TanStack Start build did not produce a Nitro node server entrypoint at ${settings.outputDirectory}/server/index.mjs. Ensure your vite.config includes the tanstackStart() and nitro() plugins with the default node preset.`,
|
|
72
|
+
signal,
|
|
73
|
+
});
|
|
96
74
|
}
|
|
97
75
|
}
|
package/src/types.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface CreateProjectResult extends ProjectInfo {
|
|
|
23
23
|
database?: DatabaseInfo;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export interface
|
|
26
|
+
export interface AppInfo {
|
|
27
27
|
id: string;
|
|
28
28
|
name: string;
|
|
29
29
|
region: string;
|
|
@@ -31,19 +31,19 @@ export interface ServiceInfo {
|
|
|
31
31
|
createdAt?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
export interface AppDetail extends AppInfo {
|
|
35
|
+
latestDeploymentId?: string | null;
|
|
36
|
+
appEndpointDomain?: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export interface
|
|
39
|
+
export interface DeploymentInfo {
|
|
40
40
|
id: string;
|
|
41
41
|
status: string;
|
|
42
42
|
createdAt: string;
|
|
43
43
|
previewDomain?: string | null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export interface
|
|
46
|
+
export interface DeploymentDetail extends DeploymentInfo {
|
|
47
47
|
envVars?: Record<string, string | null>;
|
|
48
48
|
foundryVersionId?: string;
|
|
49
49
|
}
|
|
@@ -55,8 +55,8 @@ export interface RegionInfo {
|
|
|
55
55
|
|
|
56
56
|
export interface ResolvedConfig {
|
|
57
57
|
projectId: string;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
appId: string;
|
|
59
|
+
appName: string;
|
|
60
60
|
region: string;
|
|
61
61
|
portMapping?: PortMapping;
|
|
62
62
|
}
|