@prisma/compute-sdk 0.35.0 → 0.37.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/README.md +228 -120
- package/dist/config/detect-app.d.ts +32 -0
- package/dist/config/detect-app.d.ts.map +1 -0
- package/dist/config/detect-app.js +160 -0
- package/dist/config/detect-app.js.map +1 -0
- package/dist/config/frameworks.js +1 -1
- package/dist/config/frameworks.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config/detect-app.ts +246 -0
- package/src/config/frameworks.ts +1 -1
- package/src/config/index.ts +6 -0
package/README.md
CHANGED
|
@@ -60,12 +60,12 @@ const result = await compute.deploy({
|
|
|
60
60
|
entrypoint: "index.js",
|
|
61
61
|
}),
|
|
62
62
|
projectId: "your-project-id",
|
|
63
|
-
|
|
63
|
+
appName: "my-app",
|
|
64
64
|
region: "us-east-1",
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
if (result.isOk()) {
|
|
68
|
-
console.log(`Deployed to ${result.value.
|
|
68
|
+
console.log(`Deployed to ${result.value.deploymentEndpointDomain}`);
|
|
69
69
|
} else {
|
|
70
70
|
console.error(`Deploy failed: ${result.error.message}`);
|
|
71
71
|
}
|
|
@@ -89,27 +89,29 @@ All methods return `Promise<Result<T, E>>` — a discriminated union that is eit
|
|
|
89
89
|
|
|
90
90
|
#### `deploy(options): Promise<Result<DeployResult, DeployError>>`
|
|
91
91
|
|
|
92
|
-
Builds, uploads, and deploys an application
|
|
92
|
+
Builds, uploads, and deploys an application, then promotes it to the app's live endpoint.
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
95
|
const result = await compute.deploy({
|
|
96
96
|
// Required: how to produce the deployable artifact
|
|
97
97
|
strategy: new PreBuilt({ appPath: "./dist", entrypoint: "index.js" }),
|
|
98
98
|
|
|
99
|
-
// Target (provide
|
|
99
|
+
// Target (provide appId OR projectId + appName + region)
|
|
100
100
|
projectId: "proj_abc",
|
|
101
|
-
|
|
101
|
+
appName: "my-app",
|
|
102
102
|
region: "us-east-1",
|
|
103
103
|
// OR:
|
|
104
|
-
|
|
104
|
+
appId: "app_xyz",
|
|
105
105
|
|
|
106
106
|
// Optional
|
|
107
|
-
// Stored through the environment-variable API before the
|
|
108
|
-
// Production
|
|
107
|
+
// Stored through the environment-variable API before the deployment is created.
|
|
108
|
+
// Production apps use project vars; preview-branch apps use branch overrides.
|
|
109
109
|
envVars: { DATABASE_URL: "postgresql://..." },
|
|
110
110
|
portMapping: { http: 3000 },
|
|
111
111
|
timeoutSeconds: 120, // max time to wait for "running" status
|
|
112
112
|
pollIntervalMs: 1000, // how often to check status
|
|
113
|
+
skipPromote: false, // deploy without promoting to the app's live endpoint
|
|
114
|
+
destroyOldDeployment: false, // destroy (rather than just stop) the previously promoted deployment
|
|
113
115
|
signal: abortController.signal,
|
|
114
116
|
progress: {
|
|
115
117
|
/* DeployProgress callbacks */
|
|
@@ -120,31 +122,38 @@ const result = await compute.deploy({
|
|
|
120
122
|
});
|
|
121
123
|
|
|
122
124
|
if (result.isOk()) {
|
|
123
|
-
const {
|
|
125
|
+
const { deploymentEndpointDomain, deploymentId, appId, resolvedConfig } =
|
|
126
|
+
result.value;
|
|
124
127
|
}
|
|
125
128
|
```
|
|
126
129
|
|
|
130
|
+
`skipPromote` and `destroyOldDeployment` are mutually exclusive — combining them returns an `InvalidOptionsError`, since there is no previously-active deployment to destroy when promotion is skipped.
|
|
131
|
+
|
|
127
132
|
**Returns** `DeployResult`:
|
|
128
133
|
|
|
129
|
-
| Field
|
|
130
|
-
|
|
|
131
|
-
| `projectId`
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `region`
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
134
|
+
| Field | Type | Description |
|
|
135
|
+
| -------------------------- | ---------------------------------------------------- | -------------------------------------------------------- |
|
|
136
|
+
| `projectId` | `string` | Project ID |
|
|
137
|
+
| `appId` | `string` | App ID |
|
|
138
|
+
| `appName` | `string` | App display name |
|
|
139
|
+
| `region` | `string` | Region identifier |
|
|
140
|
+
| `deploymentId` | `string` | Created deployment ID |
|
|
141
|
+
| `deploymentEndpointDomain` | `string` | Live URL of the new deployment |
|
|
142
|
+
| `appEndpointDomain` | `string \| null` | The app's live URL, or `null` when `skipPromote` was set |
|
|
143
|
+
| `promoted` | `boolean` | Whether the new deployment was promoted |
|
|
144
|
+
| `previousDeploymentId` | `string \| null` | The previously active deployment, if any |
|
|
145
|
+
| `previousDeploymentAction` | `"stopped" \| "destroyed" \| "still-active" \| null` | What happened to the previous deployment |
|
|
146
|
+
| `resolvedConfig` | `ResolvedConfig` | Final resolved configuration |
|
|
138
147
|
|
|
139
148
|
---
|
|
140
149
|
|
|
141
150
|
#### `updateEnv(options): Promise<Result<UpdateEnvResult, UpdateEnvError>>`
|
|
142
151
|
|
|
143
|
-
Updates project environment variables and/or port mapping, then creates a new
|
|
152
|
+
Updates project environment variables and/or port mapping, then creates a new deployment that reuses the code from the most recent deployment. Preview-branch apps update preview branch overrides.
|
|
144
153
|
|
|
145
154
|
```ts
|
|
146
155
|
const result = await compute.updateEnv({
|
|
147
|
-
|
|
156
|
+
appId: "app_xyz",
|
|
148
157
|
envVars: { DATABASE_URL: "postgresql://new-url..." },
|
|
149
158
|
portMapping: { http: 8080 },
|
|
150
159
|
});
|
|
@@ -154,7 +163,7 @@ To remove an environment variable, set its value to `null`:
|
|
|
154
163
|
|
|
155
164
|
```ts
|
|
156
165
|
const result = await compute.updateEnv({
|
|
157
|
-
|
|
166
|
+
appId: "app_xyz",
|
|
158
167
|
envVars: {
|
|
159
168
|
DATABASE_URL: "postgresql://new-url...", // set or update
|
|
160
169
|
OLD_SECRET: null, // remove
|
|
@@ -162,44 +171,97 @@ const result = await compute.updateEnv({
|
|
|
162
171
|
});
|
|
163
172
|
```
|
|
164
173
|
|
|
165
|
-
The
|
|
174
|
+
The app must have at least one existing deployment. If not, this returns a `NoExistingDeploymentError`.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
#### `destroyDeployment(options): Promise<Result<DestroyDeploymentResult, DestroyDeploymentError>>`
|
|
179
|
+
|
|
180
|
+
Stops (if running) and deletes a single deployment.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const result = await compute.destroyDeployment({
|
|
184
|
+
deploymentId: "dep_abc",
|
|
185
|
+
// OR provide appId + interaction.selectDeployment for interactive selection
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Returns** `DestroyDeploymentResult`:
|
|
190
|
+
|
|
191
|
+
| Field | Type | Description |
|
|
192
|
+
| ---------------- | --------- | ----------------------------- |
|
|
193
|
+
| `deploymentId` | `string` | The destroyed deployment ID |
|
|
194
|
+
| `previousStatus` | `string` | Status before destruction |
|
|
195
|
+
| `stopped` | `boolean` | Whether a stop was required |
|
|
196
|
+
| `deleted` | `boolean` | Whether deletion succeeded |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
#### `destroyApp(options): Promise<Result<DestroyAppResult, DestroyAppError>>`
|
|
201
|
+
|
|
202
|
+
Stops all running deployments, deletes all deployments, and optionally deletes the app itself.
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
const result = await compute.destroyApp({
|
|
206
|
+
appId: "app_xyz",
|
|
207
|
+
keepApp: false, // set to true to keep the app record
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
If some deployments fail to stop or delete, returns a `DestroyAggregateError` with details on which succeeded and which failed.
|
|
166
212
|
|
|
167
213
|
---
|
|
168
214
|
|
|
169
|
-
#### `
|
|
215
|
+
#### `promote(options): Promise<Result<PromoteResult, PromoteError>>`
|
|
170
216
|
|
|
171
|
-
|
|
217
|
+
Promotes an existing deployment to the app's live endpoint, starting it first if it isn't already running. Unlike `deploy`, this does not build, upload, or create a new deployment — it operates on one that already exists.
|
|
172
218
|
|
|
173
219
|
```ts
|
|
174
|
-
const result = await compute.
|
|
175
|
-
|
|
176
|
-
|
|
220
|
+
const result = await compute.promote({
|
|
221
|
+
appId: "app_xyz",
|
|
222
|
+
deploymentId: "dep_abc",
|
|
223
|
+
// OR provide interaction.selectDeployment for interactive selection
|
|
177
224
|
});
|
|
178
225
|
```
|
|
179
226
|
|
|
180
|
-
**Returns** `
|
|
227
|
+
**Returns** `PromoteResult`:
|
|
181
228
|
|
|
182
|
-
| Field
|
|
183
|
-
|
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
229
|
+
| Field | Type | Description |
|
|
230
|
+
| -------------------- | --------- | ------------------------------------------------ |
|
|
231
|
+
| `appId` | `string` | App ID |
|
|
232
|
+
| `deploymentId` | `string` | The promoted deployment ID |
|
|
233
|
+
| `appEndpointDomain` | `string` | The app's live URL after promotion |
|
|
234
|
+
| `deploymentStarted` | `boolean` | Whether the deployment had to be started first |
|
|
188
235
|
|
|
189
236
|
---
|
|
190
237
|
|
|
191
|
-
#### `
|
|
238
|
+
#### `createProject(options): Promise<Result<CreateProjectResult, ApiRequestError>>`
|
|
192
239
|
|
|
193
|
-
|
|
240
|
+
Creates a new project, optionally provisioning a database alongside it.
|
|
194
241
|
|
|
195
242
|
```ts
|
|
196
|
-
const result = await compute.
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
const result = await compute.createProject({
|
|
244
|
+
name: "my-project",
|
|
245
|
+
createDatabase: true,
|
|
246
|
+
region: "us-east-1",
|
|
199
247
|
});
|
|
248
|
+
|
|
249
|
+
if (result.isOk()) {
|
|
250
|
+
console.log(`Project: ${result.value.id}`);
|
|
251
|
+
if (result.value.database) {
|
|
252
|
+
console.log(`Database: ${result.value.database.connectionString}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
200
255
|
```
|
|
201
256
|
|
|
202
|
-
|
|
257
|
+
**Returns** `CreateProjectResult` (`ProjectInfo & { database?: DatabaseInfo }`):
|
|
258
|
+
|
|
259
|
+
| Field | Type | Description |
|
|
260
|
+
| --------------- | -------------- | ------------------------------------------------------ |
|
|
261
|
+
| `id` | `string` | Project ID |
|
|
262
|
+
| `name` | `string` | Project name |
|
|
263
|
+
| `defaultRegion` | `string \| undefined` | Default region, if set |
|
|
264
|
+
| `database` | `DatabaseInfo \| undefined` | Provisioned database, present when `createDatabase` is true |
|
|
203
265
|
|
|
204
266
|
---
|
|
205
267
|
|
|
@@ -216,59 +278,59 @@ if (result.isOk()) {
|
|
|
216
278
|
|
|
217
279
|
---
|
|
218
280
|
|
|
219
|
-
#### `
|
|
281
|
+
#### `listApps(options): Promise<Result<AppInfo[], ApiRequestError>>`
|
|
220
282
|
|
|
221
283
|
```ts
|
|
222
|
-
const result = await compute.
|
|
284
|
+
const result = await compute.listApps({ projectId: "proj_abc" });
|
|
223
285
|
```
|
|
224
286
|
|
|
225
287
|
---
|
|
226
288
|
|
|
227
|
-
#### `
|
|
289
|
+
#### `createApp(options): Promise<Result<AppInfo, ApiRequestError>>`
|
|
228
290
|
|
|
229
291
|
```ts
|
|
230
|
-
const result = await compute.
|
|
292
|
+
const result = await compute.createApp({
|
|
231
293
|
projectId: "proj_abc",
|
|
232
|
-
|
|
294
|
+
appName: "my-new-app",
|
|
233
295
|
region: "eu-west-3",
|
|
234
296
|
});
|
|
235
297
|
```
|
|
236
298
|
|
|
237
299
|
---
|
|
238
300
|
|
|
239
|
-
#### `
|
|
301
|
+
#### `showApp(options): Promise<Result<AppDetail, ApiRequestError>>`
|
|
240
302
|
|
|
241
303
|
```ts
|
|
242
|
-
const result = await compute.
|
|
304
|
+
const result = await compute.showApp({ appId: "app_xyz" });
|
|
243
305
|
if (result.isOk()) {
|
|
244
|
-
console.log(`Latest
|
|
306
|
+
console.log(`Latest deployment: ${result.value.latestDeploymentId}`);
|
|
245
307
|
}
|
|
246
308
|
```
|
|
247
309
|
|
|
248
310
|
---
|
|
249
311
|
|
|
250
|
-
#### `
|
|
312
|
+
#### `deleteApp(options): Promise<Result<void, ApiRequestError>>`
|
|
251
313
|
|
|
252
|
-
Deletes
|
|
314
|
+
Deletes an app record. The app should have no deployments (use `destroyApp` to clean up deployments first).
|
|
253
315
|
|
|
254
316
|
```ts
|
|
255
|
-
await compute.
|
|
317
|
+
await compute.deleteApp({ appId: "app_xyz" });
|
|
256
318
|
```
|
|
257
319
|
|
|
258
320
|
---
|
|
259
321
|
|
|
260
|
-
#### `
|
|
322
|
+
#### `listDeployments(options): Promise<Result<DeploymentInfo[], ApiRequestError>>`
|
|
261
323
|
|
|
262
324
|
```ts
|
|
263
|
-
const result = await compute.
|
|
325
|
+
const result = await compute.listDeployments({ appId: "app_xyz" });
|
|
264
326
|
```
|
|
265
327
|
|
|
266
328
|
---
|
|
267
329
|
|
|
268
|
-
#### `
|
|
330
|
+
#### `showDeployment(options): Promise<Result<DeploymentDetail, ApiRequestError>>`
|
|
269
331
|
|
|
270
332
|
```ts
|
|
271
|
-
const result = await compute.
|
|
333
|
+
const result = await compute.showDeployment({ deploymentId: "dep_abc" });
|
|
272
334
|
if (result.isOk()) {
|
|
273
335
|
console.log(`Status: ${result.value.status}`);
|
|
274
336
|
console.log(`URL: https://${result.value.previewDomain}`);
|
|
@@ -277,31 +339,60 @@ if (result.isOk()) {
|
|
|
277
339
|
|
|
278
340
|
---
|
|
279
341
|
|
|
280
|
-
#### `
|
|
342
|
+
#### `startDeployment(options): Promise<Result<void, ApiRequestError>>`
|
|
281
343
|
|
|
282
344
|
```ts
|
|
283
|
-
await compute.
|
|
345
|
+
await compute.startDeployment({ deploymentId: "dep_abc" });
|
|
284
346
|
```
|
|
285
347
|
|
|
286
348
|
---
|
|
287
349
|
|
|
288
|
-
#### `
|
|
350
|
+
#### `stopDeployment(options): Promise<Result<void, ApiRequestError>>`
|
|
289
351
|
|
|
290
352
|
```ts
|
|
291
|
-
await compute.
|
|
353
|
+
await compute.stopDeployment({ deploymentId: "dep_abc" });
|
|
292
354
|
```
|
|
293
355
|
|
|
294
356
|
---
|
|
295
357
|
|
|
296
|
-
#### `
|
|
358
|
+
#### `deleteDeployment(options): Promise<Result<void, ApiRequestError>>`
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
await compute.deleteDeployment({ deploymentId: "dep_abc" });
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Repository snapshot detection
|
|
365
|
+
|
|
366
|
+
Use `detectComputeApp` when a consumer already has repository metadata but no
|
|
367
|
+
local checkout, such as a GitHub import flow. Detection is scoped to one app
|
|
368
|
+
root, so monorepo consumers enumerate workspace packages and call it once per
|
|
369
|
+
candidate.
|
|
297
370
|
|
|
298
371
|
```ts
|
|
299
|
-
|
|
372
|
+
import { detectComputeApp } from "@prisma/compute-sdk/config";
|
|
373
|
+
|
|
374
|
+
const detected = detectComputeApp({
|
|
375
|
+
root: "apps/server",
|
|
376
|
+
manifest: {
|
|
377
|
+
main: "src/index.ts",
|
|
378
|
+
dependencies: { elysia: "1.3.0" },
|
|
379
|
+
},
|
|
380
|
+
filePaths: [
|
|
381
|
+
"apps/server/package.json",
|
|
382
|
+
"apps/server/src/index.ts",
|
|
383
|
+
],
|
|
384
|
+
});
|
|
300
385
|
```
|
|
301
386
|
|
|
387
|
+
The result includes the Compute framework, build type, HTTP port, inferred
|
|
388
|
+
entrypoint, and the dependency, config file, or runtime script that provided
|
|
389
|
+
the detection evidence. It returns `null` when the package has no deployable
|
|
390
|
+
framework or runtime signal, so shared workspace libraries are not treated as
|
|
391
|
+
apps.
|
|
392
|
+
|
|
302
393
|
## Build strategies
|
|
303
394
|
|
|
304
|
-
A build strategy produces a deployable artifact (a directory with an entrypoint file). The SDK ships with two built-in strategies:
|
|
395
|
+
A build strategy produces a deployable artifact (a directory with an entrypoint file). The SDK ships with two built-in general-purpose strategies (plus framework-specific ones used internally by `AutoBuild`):
|
|
305
396
|
|
|
306
397
|
### `PreBuilt`
|
|
307
398
|
|
|
@@ -368,14 +459,14 @@ const result = await compute.deploy({
|
|
|
368
459
|
|
|
369
460
|
// Pattern 1: isOk / isErr
|
|
370
461
|
if (result.isOk()) {
|
|
371
|
-
console.log(result.value.
|
|
462
|
+
console.log(result.value.deploymentEndpointDomain);
|
|
372
463
|
} else {
|
|
373
464
|
console.error(result.error.message);
|
|
374
465
|
}
|
|
375
466
|
|
|
376
467
|
// Pattern 2: match
|
|
377
468
|
result.match({
|
|
378
|
-
Ok: (value) => console.log(value.
|
|
469
|
+
Ok: (value) => console.log(value.deploymentEndpointDomain),
|
|
379
470
|
Err: (error) => console.error(error.message),
|
|
380
471
|
});
|
|
381
472
|
```
|
|
@@ -384,18 +475,20 @@ result.match({
|
|
|
384
475
|
|
|
385
476
|
Every error extends `TaggedError` and has a `_tag` discriminant for pattern matching:
|
|
386
477
|
|
|
387
|
-
| Error class
|
|
388
|
-
|
|
|
389
|
-
| `AuthenticationError`
|
|
390
|
-
| `ApiError`
|
|
391
|
-
| `MissingArgumentError`
|
|
392
|
-
| `
|
|
393
|
-
| `
|
|
394
|
-
| `
|
|
395
|
-
| `
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
398
|
-
| `
|
|
478
|
+
| Error class | `_tag` | Description |
|
|
479
|
+
| --------------------------- | ----------------------------- | ----------------------------------------------------------- |
|
|
480
|
+
| `AuthenticationError` | `"AuthenticationError"` | API returned HTTP 401 |
|
|
481
|
+
| `ApiError` | `"ApiError"` | API returned a non-401 error |
|
|
482
|
+
| `MissingArgumentError` | `"MissingArgumentError"` | A required argument was not provided |
|
|
483
|
+
| `InvalidOptionsError` | `"InvalidOptionsError"` | A conflicting or invalid combination of options was provided |
|
|
484
|
+
| `BuildError` | `"BuildError"` | Build strategy failed |
|
|
485
|
+
| `ArtifactError` | `"ArtifactError"` | Archive creation or upload failed |
|
|
486
|
+
| `TimeoutError` | `"TimeoutError"` | Deployment didn't reach target status in time |
|
|
487
|
+
| `DeploymentFailedError` | `"DeploymentFailedError"` | Deployment transitioned to `"failed"` status |
|
|
488
|
+
| `NoExistingDeploymentError` | `"NoExistingDeploymentError"` | `updateEnv` called on an app with no prior deployments |
|
|
489
|
+
| `NoDeploymentsFoundError` | `"NoDeploymentsFoundError"` | App has no deployments to select from |
|
|
490
|
+
| `CancelledError` | `"CancelledError"` | Operation cancelled via `AbortSignal` |
|
|
491
|
+
| `DestroyAggregateError` | `"DestroyAggregateError"` | Some deployments failed during `destroyApp` |
|
|
399
492
|
|
|
400
493
|
### Matching specific errors
|
|
401
494
|
|
|
@@ -432,11 +525,12 @@ if (result.isErr()) {
|
|
|
432
525
|
|
|
433
526
|
The SDK exports narrowed error unions for each operation:
|
|
434
527
|
|
|
435
|
-
- **`DeployError`** — errors from `deploy()`: `CancelledError | MissingArgumentError | AuthenticationError | ApiError | BuildError | ArtifactError | TimeoutError |
|
|
436
|
-
- **`UpdateEnvError`** — errors from `updateEnv()`: `CancelledError | MissingArgumentError | AuthenticationError | ApiError |
|
|
437
|
-
- **`
|
|
438
|
-
- **`
|
|
439
|
-
- **`
|
|
528
|
+
- **`DeployError`** — errors from `deploy()`: `CancelledError | MissingArgumentError | InvalidOptionsError | AuthenticationError | ApiError | BuildError | ArtifactError | TimeoutError | DeploymentFailedError`
|
|
529
|
+
- **`UpdateEnvError`** — errors from `updateEnv()`: `CancelledError | MissingArgumentError | InvalidOptionsError | AuthenticationError | ApiError | NoExistingDeploymentError | TimeoutError | DeploymentFailedError`
|
|
530
|
+
- **`DestroyDeploymentError`** — errors from `destroyDeployment()`: `CancelledError | MissingArgumentError | NoDeploymentsFoundError | AuthenticationError | ApiError | TimeoutError | DeploymentFailedError`
|
|
531
|
+
- **`DestroyAppError`** — errors from `destroyApp()`: `CancelledError | AuthenticationError | ApiError | DestroyAggregateError`
|
|
532
|
+
- **`PromoteError`** — errors from `promote()`: `AuthenticationError | ApiError | MissingArgumentError | NoDeploymentsFoundError | TimeoutError | DeploymentFailedError | CancelledError`
|
|
533
|
+
- **`ApiRequestError`** — errors from single-request methods (`createProject`, `listProjects`, `listApps`, `createApp`, `startDeployment`, `stopDeployment`, `deleteDeployment`, etc.): `CancelledError | AuthenticationError | ApiError`
|
|
440
534
|
|
|
441
535
|
## Progress and interaction callbacks
|
|
442
536
|
|
|
@@ -444,11 +538,13 @@ Long-running operations accept `progress` and `interaction` callbacks for UI int
|
|
|
444
538
|
|
|
445
539
|
### Deploy progress
|
|
446
540
|
|
|
541
|
+
`deploy()` promotes the new deployment and stops (optionally destroys) the previous one by default, so `DeployProgress` also reports promotion and old-deployment cleanup progress alongside the build/upload/start steps:
|
|
542
|
+
|
|
447
543
|
```ts
|
|
448
544
|
await compute.deploy({
|
|
449
545
|
strategy,
|
|
450
546
|
projectId: "proj_abc",
|
|
451
|
-
|
|
547
|
+
appName: "my-app",
|
|
452
548
|
region: "us-east-1",
|
|
453
549
|
progress: {
|
|
454
550
|
onBuildStart() {
|
|
@@ -463,8 +559,8 @@ await compute.deploy({
|
|
|
463
559
|
onArchiveReady(sizeBytes) {
|
|
464
560
|
console.log(`Archive: ${(sizeBytes / 1024).toFixed(1)} KB`);
|
|
465
561
|
},
|
|
466
|
-
|
|
467
|
-
console.log(`
|
|
562
|
+
onDeploymentCreated(deploymentId) {
|
|
563
|
+
console.log(`Deployment: ${deploymentId}`);
|
|
468
564
|
},
|
|
469
565
|
onUploadStart() {
|
|
470
566
|
console.log("Uploading...");
|
|
@@ -481,13 +577,25 @@ await compute.deploy({
|
|
|
481
577
|
onRunning(deploymentUrl) {
|
|
482
578
|
console.log(`Live at ${deploymentUrl}`);
|
|
483
579
|
},
|
|
580
|
+
onPromoteStart() {
|
|
581
|
+
console.log("Promoting...");
|
|
582
|
+
},
|
|
583
|
+
onPromoted(appEndpointDomain) {
|
|
584
|
+
console.log(`Promoted: ${appEndpointDomain}`);
|
|
585
|
+
},
|
|
586
|
+
onOldDeploymentStopping(deploymentId) {
|
|
587
|
+
console.log(`Stopping previous deployment ${deploymentId}...`);
|
|
588
|
+
},
|
|
589
|
+
onOldDeploymentStopped(deploymentId) {
|
|
590
|
+
console.log(`Stopped previous deployment ${deploymentId}.`);
|
|
591
|
+
},
|
|
484
592
|
},
|
|
485
593
|
});
|
|
486
594
|
```
|
|
487
595
|
|
|
488
596
|
### Deploy interaction
|
|
489
597
|
|
|
490
|
-
When `projectId`, `
|
|
598
|
+
When `projectId`, `appId`/`appName`, or `region` aren't provided, the SDK calls interaction callbacks so the caller can resolve them (e.g., by prompting the user):
|
|
491
599
|
|
|
492
600
|
```ts
|
|
493
601
|
await compute.deploy({
|
|
@@ -497,16 +605,16 @@ await compute.deploy({
|
|
|
497
605
|
// projects: ProjectInfo[] — return the chosen project ID
|
|
498
606
|
return projects[0].id;
|
|
499
607
|
},
|
|
500
|
-
async
|
|
501
|
-
//
|
|
608
|
+
async selectApp(apps) {
|
|
609
|
+
// apps: AppInfo[] — return an app ID, or null to create a new one
|
|
502
610
|
return null;
|
|
503
611
|
},
|
|
504
|
-
async
|
|
505
|
-
// return a name for the new
|
|
506
|
-
return "my-new-
|
|
612
|
+
async provideAppName() {
|
|
613
|
+
// return a name for the new app
|
|
614
|
+
return "my-new-app";
|
|
507
615
|
},
|
|
508
616
|
async selectRegion(regions) {
|
|
509
|
-
// regions: RegionInfo[] —
|
|
617
|
+
// regions: RegionInfo[] — used to resolve a region when one wasn't supplied
|
|
510
618
|
return "us-east-1";
|
|
511
619
|
},
|
|
512
620
|
},
|
|
@@ -516,28 +624,28 @@ await compute.deploy({
|
|
|
516
624
|
### Destroy progress
|
|
517
625
|
|
|
518
626
|
```ts
|
|
519
|
-
await compute.
|
|
520
|
-
|
|
627
|
+
await compute.destroyApp({
|
|
628
|
+
appId: "app_xyz",
|
|
521
629
|
progress: {
|
|
522
|
-
|
|
630
|
+
onStoppingDeployments(deploymentIds) {
|
|
523
631
|
/* ... */
|
|
524
632
|
},
|
|
525
|
-
|
|
633
|
+
onDeploymentStopped(deploymentId) {
|
|
526
634
|
/* ... */
|
|
527
635
|
},
|
|
528
|
-
|
|
636
|
+
onAllDeploymentsStopped() {
|
|
529
637
|
/* ... */
|
|
530
638
|
},
|
|
531
|
-
|
|
639
|
+
onDeletingDeployments(deploymentIds) {
|
|
532
640
|
/* ... */
|
|
533
641
|
},
|
|
534
|
-
|
|
642
|
+
onDeploymentDeleted(deploymentId) {
|
|
535
643
|
/* ... */
|
|
536
644
|
},
|
|
537
|
-
|
|
645
|
+
onAllDeploymentsDeleted() {
|
|
538
646
|
/* ... */
|
|
539
647
|
},
|
|
540
|
-
|
|
648
|
+
onAppDeleted(appId) {
|
|
541
649
|
/* ... */
|
|
542
650
|
},
|
|
543
651
|
},
|
|
@@ -556,7 +664,7 @@ setTimeout(() => controller.abort(), 30_000);
|
|
|
556
664
|
|
|
557
665
|
const result = await compute.deploy({
|
|
558
666
|
strategy,
|
|
559
|
-
|
|
667
|
+
appId: "app_xyz",
|
|
560
668
|
signal: controller.signal,
|
|
561
669
|
});
|
|
562
670
|
|
|
@@ -570,12 +678,12 @@ if (result.isErr() && result.error._tag === "CancelledError") {
|
|
|
570
678
|
```ts
|
|
571
679
|
import type {
|
|
572
680
|
ProjectInfo, // { id, name, defaultRegion? }
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
681
|
+
AppInfo, // { id, name, region, projectId, createdAt? }
|
|
682
|
+
AppDetail, // AppInfo & { latestDeploymentId?, appEndpointDomain? }
|
|
683
|
+
DeploymentInfo, // { id, status, createdAt, previewDomain? }
|
|
684
|
+
DeploymentDetail, // DeploymentInfo & { envVars?, foundryVersionId? }
|
|
577
685
|
RegionInfo, // { id, displayName }
|
|
578
|
-
ResolvedConfig, // { projectId,
|
|
686
|
+
ResolvedConfig, // { projectId, appId, appName, region, portMapping? }
|
|
579
687
|
PortMapping, // { http?: number | null }
|
|
580
688
|
} from "@prisma/compute-sdk";
|
|
581
689
|
```
|
|
@@ -609,7 +717,7 @@ async function main() {
|
|
|
609
717
|
entrypoint: "server.js",
|
|
610
718
|
}),
|
|
611
719
|
projectId: process.env.PROJECT_ID!,
|
|
612
|
-
|
|
720
|
+
appName: "my-api",
|
|
613
721
|
region: "us-east-1",
|
|
614
722
|
envVars: {
|
|
615
723
|
DATABASE_URL: process.env.DATABASE_URL!,
|
|
@@ -637,7 +745,7 @@ async function main() {
|
|
|
637
745
|
},
|
|
638
746
|
TimeoutError: (e) => {
|
|
639
747
|
console.error(`Deploy timed out (${Math.round(e.elapsedMs / 1000)}s).`);
|
|
640
|
-
console.error(`
|
|
748
|
+
console.error(`Deployment ${e.deploymentId} may still be starting.`);
|
|
641
749
|
process.exit(1);
|
|
642
750
|
},
|
|
643
751
|
_: (e) => {
|
|
@@ -648,17 +756,17 @@ async function main() {
|
|
|
648
756
|
return;
|
|
649
757
|
}
|
|
650
758
|
|
|
651
|
-
const {
|
|
652
|
-
console.log(`\
|
|
653
|
-
console.log(`
|
|
654
|
-
console.log(`URL:
|
|
655
|
-
|
|
656
|
-
// List
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
659
|
-
console.log(`\
|
|
660
|
-
for (const
|
|
661
|
-
console.log(` ${
|
|
759
|
+
const { appId, deploymentId, deploymentEndpointDomain } = deployResult.value;
|
|
760
|
+
console.log(`\nApp: ${appId}`);
|
|
761
|
+
console.log(`Deployment: ${deploymentId}`);
|
|
762
|
+
console.log(`URL: ${deploymentEndpointDomain}`);
|
|
763
|
+
|
|
764
|
+
// List deployments
|
|
765
|
+
const deploymentsResult = await compute.listDeployments({ appId });
|
|
766
|
+
if (deploymentsResult.isOk()) {
|
|
767
|
+
console.log(`\nDeployments (${deploymentsResult.value.length}):`);
|
|
768
|
+
for (const d of deploymentsResult.value) {
|
|
769
|
+
console.log(` ${d.id} — ${d.status} (${d.createdAt})`);
|
|
662
770
|
}
|
|
663
771
|
}
|
|
664
772
|
}
|
|
@@ -669,7 +777,7 @@ main();
|
|
|
669
777
|
## Requirements
|
|
670
778
|
|
|
671
779
|
- Node.js >= 18.0.0
|
|
672
|
-
- `@prisma/management-api-sdk`
|
|
780
|
+
- `@prisma/management-api-sdk` ^1.44.0
|
|
673
781
|
|
|
674
782
|
## License
|
|
675
783
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type FrameworkBuildType } from "./frameworks.ts";
|
|
2
|
+
import type { ComputeFramework } from "./types.ts";
|
|
3
|
+
export interface ComputeAppManifest {
|
|
4
|
+
main?: unknown;
|
|
5
|
+
scripts?: unknown;
|
|
6
|
+
dependencies?: unknown;
|
|
7
|
+
devDependencies?: unknown;
|
|
8
|
+
peerDependencies?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface DetectComputeAppInput {
|
|
11
|
+
root: string;
|
|
12
|
+
manifest: ComputeAppManifest;
|
|
13
|
+
filePaths: Iterable<string>;
|
|
14
|
+
}
|
|
15
|
+
export interface DetectedComputeApp {
|
|
16
|
+
framework: ComputeFramework;
|
|
17
|
+
frameworkName: string;
|
|
18
|
+
buildType: FrameworkBuildType;
|
|
19
|
+
httpPort: number;
|
|
20
|
+
entrypoint: string | null;
|
|
21
|
+
evidence: {
|
|
22
|
+
kind: "dependency" | "config" | "entrypoint";
|
|
23
|
+
path: string;
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Detects one deployable app from an in-memory repository snapshot.
|
|
29
|
+
* Paths are repository-relative so remote consumers do not need a checkout.
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectComputeApp(input: DetectComputeAppInput): DetectedComputeApp | null;
|
|
32
|
+
//# sourceMappingURL=detect-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-app.d.ts","sourceRoot":"","sources":["../../src/config/detect-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE;QACR,IAAI,EAAE,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAC;QAC7C,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,GAC3B,kBAAkB,GAAG,IAAI,CA4D3B"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { FRAMEWORKS, frameworkByKey, } from "./frameworks.js";
|
|
2
|
+
/**
|
|
3
|
+
* Detects one deployable app from an in-memory repository snapshot.
|
|
4
|
+
* Paths are repository-relative so remote consumers do not need a checkout.
|
|
5
|
+
*/
|
|
6
|
+
export function detectComputeApp(input) {
|
|
7
|
+
const root = normalizeRoot(input.root);
|
|
8
|
+
const filePaths = new Set(input.filePaths);
|
|
9
|
+
const dependencies = new Set([
|
|
10
|
+
...recordKeys(input.manifest.dependencies),
|
|
11
|
+
...recordKeys(input.manifest.devDependencies),
|
|
12
|
+
]);
|
|
13
|
+
for (const framework of FRAMEWORKS) {
|
|
14
|
+
const dependency = framework.detectPackages.find((name) => dependencies.has(name));
|
|
15
|
+
if (dependency) {
|
|
16
|
+
return detectedApp(framework, inferEntrypoint(framework, input, filePaths), {
|
|
17
|
+
kind: "dependency",
|
|
18
|
+
path: joinRepoPath(root, "package.json"),
|
|
19
|
+
value: dependency,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const configFile = framework.detectConfigFiles.find((fileName) => filePaths.has(joinRepoPath(root, fileName)));
|
|
23
|
+
if (configFile) {
|
|
24
|
+
return detectedApp(framework, inferEntrypoint(framework, input, filePaths), {
|
|
25
|
+
kind: "config",
|
|
26
|
+
path: joinRepoPath(root, configFile),
|
|
27
|
+
value: configFile,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const runtimeScript = readRuntimeScript(input.manifest.scripts);
|
|
32
|
+
if (runtimeScript) {
|
|
33
|
+
const bun = frameworkByKey("bun");
|
|
34
|
+
const scriptedEntrypoint = extractScriptEntrypoint(runtimeScript.command);
|
|
35
|
+
const scriptReferencesExistingFile = scriptedEntrypoint !== null &&
|
|
36
|
+
filePaths.has(joinRepoPath(root, scriptedEntrypoint));
|
|
37
|
+
const entrypoint = scriptReferencesExistingFile
|
|
38
|
+
? scriptedEntrypoint
|
|
39
|
+
: inferEntrypoint(bun, input, filePaths);
|
|
40
|
+
if (entrypoint) {
|
|
41
|
+
return detectedApp(bun, entrypoint, {
|
|
42
|
+
kind: "entrypoint",
|
|
43
|
+
path: joinRepoPath(root, entrypoint),
|
|
44
|
+
value: `scripts.${runtimeScript.name}`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function detectedApp(framework, entrypoint, evidence) {
|
|
51
|
+
return {
|
|
52
|
+
framework: framework.key,
|
|
53
|
+
frameworkName: framework.displayName,
|
|
54
|
+
buildType: framework.buildType,
|
|
55
|
+
httpPort: framework.defaultHttpPort,
|
|
56
|
+
entrypoint,
|
|
57
|
+
evidence,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function inferEntrypoint(framework, input, filePaths) {
|
|
61
|
+
if (!framework.usesEntrypoint) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const root = normalizeRoot(input.root);
|
|
65
|
+
if (typeof input.manifest.main === "string") {
|
|
66
|
+
const main = normalizeEntrypoint(input.manifest.main);
|
|
67
|
+
if (main && filePaths.has(joinRepoPath(root, main))) {
|
|
68
|
+
return main;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const candidates = [
|
|
72
|
+
framework.defaultEntrypoint,
|
|
73
|
+
"src/index.ts",
|
|
74
|
+
"src/index.js",
|
|
75
|
+
"src/server.ts",
|
|
76
|
+
"src/server.js",
|
|
77
|
+
"index.ts",
|
|
78
|
+
"index.js",
|
|
79
|
+
"server.ts",
|
|
80
|
+
"server.js",
|
|
81
|
+
].filter((value) => Boolean(value));
|
|
82
|
+
return (candidates.find((candidate) => filePaths.has(joinRepoPath(root, candidate))) ?? null);
|
|
83
|
+
}
|
|
84
|
+
function normalizeEntrypoint(value) {
|
|
85
|
+
if (!value ||
|
|
86
|
+
value.startsWith("/") ||
|
|
87
|
+
value.startsWith("\\") ||
|
|
88
|
+
value.includes("\\") ||
|
|
89
|
+
/^[A-Za-z]:/.test(value)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const normalized = value.replace(/^\.\/+/, "").replace(/\/+/g, "/");
|
|
93
|
+
if (!normalized ||
|
|
94
|
+
normalized === "." ||
|
|
95
|
+
normalized.split("/").some((segment) => segment === "..")) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return normalized;
|
|
99
|
+
}
|
|
100
|
+
function readRuntimeScript(scripts) {
|
|
101
|
+
if (!scripts || typeof scripts !== "object") {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const values = scripts;
|
|
105
|
+
for (const name of ["start", "serve"]) {
|
|
106
|
+
const command = values[name];
|
|
107
|
+
if (typeof command === "string" && command.trim()) {
|
|
108
|
+
return { name, command };
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const SCRIPT_OPTIONS_WITH_FILE_ARGUMENT = [
|
|
114
|
+
"--experimental-loader",
|
|
115
|
+
"--import",
|
|
116
|
+
"--loader",
|
|
117
|
+
"--preload",
|
|
118
|
+
"--require",
|
|
119
|
+
"-r",
|
|
120
|
+
];
|
|
121
|
+
function extractScriptEntrypoint(command) {
|
|
122
|
+
const tokens = command.match(/"[^"]*"|'[^']*'|`[^`]*`|\S+/g) ?? [];
|
|
123
|
+
const candidates = [];
|
|
124
|
+
let skipNextToken = false;
|
|
125
|
+
for (const rawToken of tokens) {
|
|
126
|
+
if (skipNextToken) {
|
|
127
|
+
skipNextToken = false;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const quote = rawToken[0];
|
|
131
|
+
const token = (quote === '"' || quote === "'" || quote === "`") &&
|
|
132
|
+
rawToken.at(-1) === quote
|
|
133
|
+
? rawToken.slice(1, -1)
|
|
134
|
+
: rawToken;
|
|
135
|
+
const optionWithFileArgument = SCRIPT_OPTIONS_WITH_FILE_ARGUMENT.find((option) => token === option || token.startsWith(`${option}=`));
|
|
136
|
+
if (optionWithFileArgument) {
|
|
137
|
+
skipNextToken = token === optionWithFileArgument;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (!/^(?:\.{1,2}\/)?[\w@./-]+\.(?:[cm]?[jt]sx?)$/.test(token)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const candidate = normalizeEntrypoint(token);
|
|
144
|
+
if (candidate) {
|
|
145
|
+
candidates.push(candidate);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return candidates.length === 1 ? (candidates[0] ?? null) : null;
|
|
149
|
+
}
|
|
150
|
+
function recordKeys(value) {
|
|
151
|
+
return value && typeof value === "object" ? Object.keys(value) : [];
|
|
152
|
+
}
|
|
153
|
+
function normalizeRoot(root) {
|
|
154
|
+
const normalized = root.replace(/^\.?\/+|\/+$/g, "");
|
|
155
|
+
return normalized === "." ? "" : normalized;
|
|
156
|
+
}
|
|
157
|
+
function joinRepoPath(...parts) {
|
|
158
|
+
return parts.filter(Boolean).join("/").replace(/\/+/g, "/");
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=detect-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-app.js","sourceRoot":"","sources":["../../src/config/detect-app.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,cAAc,GACf,MAAM,iBAAiB,CAAC;AA8BzB;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA4B;IAE5B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;QAC3B,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC1C,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;KAC9C,CAAC,CAAC;IAEH,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACxD,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CACvB,CAAC;QACF,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,WAAW,CAChB,SAAS,EACT,eAAe,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,EAC5C;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,cAAc,CAAC;gBACxC,KAAK,EAAE,UAAU;aAClB,CACF,CAA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AI,CAAC;AAClE,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IACrD,OAAO,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,GAAG,KAAe;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -114,7 +114,7 @@ export const FRAMEWORKS = [
|
|
|
114
114
|
displayName: "Bun",
|
|
115
115
|
buildType: "bun",
|
|
116
116
|
aliases: ["bun"],
|
|
117
|
-
detectPackages: [],
|
|
117
|
+
detectPackages: ["elysia", "express", "fastify"],
|
|
118
118
|
detectConfigFiles: [],
|
|
119
119
|
usesEntrypoint: true,
|
|
120
120
|
defaultEntrypoint: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../src/config/frameworks.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,iBAAiB;IACjB,kBAAkB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Ac;QACjC,iBAAiB,EAAE,IAAI;QACvB,eAAe,EAAE,IAAI;KACtB;IACD;QACE,GAAG,EAAE,QAAQ;QACb,WAAW,EAAE,QAAQ;QACrB,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC3B,cAAc,EAAE,CAAC,cAAc,CAAC;QAChC,iBAAiB,EAAE,CAAC,eAAe,CAAC;QACpC,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,IAAI;QACvB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;KACtB;IACD;QACE,GAAG,EAAE,gBAAgB;QACrB,WAAW,EAAE,gBAAgB;QAC7B,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE;YACP,gBAAgB;YAChB,UAAU;YACV,uBAAuB;YACvB,uBAAuB;SACxB;QACD,cAAc,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;QAClE,iBAAiB,EAAE,EAAE;QACrB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,IAAI;QACvB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;KACtB;IACD;QACE,GAAG,EAAE,QAAQ;QACb,WAAW,EAAE,QAAQ;QACrB,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,cAAc,EAAE,EAAE;QAClB,iBAAiB,EAAE,EAAE;QACrB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,IAAI;QACvB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;KACtB;IACD;QACE,GAAG,EAAE,KAAK;QACV,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,CAAC,KAAK,CAAC;QAChB,cAAc,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../src/config/frameworks.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAC,MAAM,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,CAAC,UAAU,CAAC,CAAC;QACtE,IAAI,CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAa;IAEb,OAAQ,yBAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* of the platform reads the same deploy graph. Consumer-specific concerns —
|
|
7
7
|
* project/branch resolution, prompts, flag precedence — stay with consumers.
|
|
8
8
|
*/
|
|
9
|
+
export { type ComputeAppManifest, type DetectComputeAppInput, type DetectedComputeApp, detectComputeApp, } from "./detect-app.ts";
|
|
9
10
|
export { ASTRO_CONFIG_FILENAMES, CONFIG_BACKED_BUILD_TYPES, type ConfigBackedBuildType, defaultHttpPortForBuildType, ENTRYPOINT_BUILD_TYPES, FRAMEWORK_KEYS, FRAMEWORKS, type FrameworkBuildType, type FrameworkDescriptor, frameworkByKey, frameworkFromAlias, isConfigBackedBuildType, LOCAL_DEV_BUILD_TYPES, NEXT_CONFIG_FILENAMES, NUXT_CONFIG_FILENAMES, } from "./frameworks.ts";
|
|
10
11
|
export { COMPUTE_CONFIG_JSON_SCHEMA, COMPUTE_CONFIG_JSON_SCHEMA_URL, } from "./json-schema.ts";
|
|
11
12
|
export { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAMES, COMPUTE_CONFIG_JSON_FILENAME, ComputeConfigAmbiguousError, type ComputeConfigError, ComputeConfigLoadError, findComputeConfigCandidates, findComputeConfigDir, loadComputeConfig, } from "./load.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* of the platform reads the same deploy graph. Consumer-specific concerns —
|
|
7
7
|
* project/branch resolution, prompts, flag precedence — stay with consumers.
|
|
8
8
|
*/
|
|
9
|
+
export { detectComputeApp, } from "./detect-app.js";
|
|
9
10
|
export { ASTRO_CONFIG_FILENAMES, CONFIG_BACKED_BUILD_TYPES, defaultHttpPortForBuildType, ENTRYPOINT_BUILD_TYPES, FRAMEWORK_KEYS, FRAMEWORKS, frameworkByKey, frameworkFromAlias, isConfigBackedBuildType, LOCAL_DEV_BUILD_TYPES, NEXT_CONFIG_FILENAMES, NUXT_CONFIG_FILENAMES, } from "./frameworks.js";
|
|
10
11
|
export { COMPUTE_CONFIG_JSON_SCHEMA, COMPUTE_CONFIG_JSON_SCHEMA_URL, } from "./json-schema.js";
|
|
11
12
|
export { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAMES, COMPUTE_CONFIG_JSON_FILENAME, ComputeConfigAmbiguousError, ComputeConfigLoadError, findComputeConfigCandidates, findComputeConfigDir, loadComputeConfig, } from "./load.js";
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EAEzB,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,UAAU,EAGV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAE3B,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EAEzB,gCAAgC,EAChC,+BAA+B,EAG/B,mBAAmB,EACnB,yBAAyB,EAEzB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,eAAe,EAQf,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EAEzB,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,UAAU,EAGV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAE3B,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EAEzB,gCAAgC,EAChC,+BAA+B,EAG/B,mBAAmB,EACnB,yBAAyB,EAEzB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,eAAe,EAQf,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FRAMEWORKS,
|
|
3
|
+
type FrameworkBuildType,
|
|
4
|
+
type FrameworkDescriptor,
|
|
5
|
+
frameworkByKey,
|
|
6
|
+
} from "./frameworks.ts";
|
|
7
|
+
import type { ComputeFramework } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
export interface ComputeAppManifest {
|
|
10
|
+
main?: unknown;
|
|
11
|
+
scripts?: unknown;
|
|
12
|
+
dependencies?: unknown;
|
|
13
|
+
devDependencies?: unknown;
|
|
14
|
+
peerDependencies?: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DetectComputeAppInput {
|
|
18
|
+
root: string;
|
|
19
|
+
manifest: ComputeAppManifest;
|
|
20
|
+
filePaths: Iterable<string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DetectedComputeApp {
|
|
24
|
+
framework: ComputeFramework;
|
|
25
|
+
frameworkName: string;
|
|
26
|
+
buildType: FrameworkBuildType;
|
|
27
|
+
httpPort: number;
|
|
28
|
+
entrypoint: string | null;
|
|
29
|
+
evidence: {
|
|
30
|
+
kind: "dependency" | "config" | "entrypoint";
|
|
31
|
+
path: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Detects one deployable app from an in-memory repository snapshot.
|
|
38
|
+
* Paths are repository-relative so remote consumers do not need a checkout.
|
|
39
|
+
*/
|
|
40
|
+
export function detectComputeApp(
|
|
41
|
+
input: DetectComputeAppInput,
|
|
42
|
+
): DetectedComputeApp | null {
|
|
43
|
+
const root = normalizeRoot(input.root);
|
|
44
|
+
const filePaths = new Set(input.filePaths);
|
|
45
|
+
const dependencies = new Set([
|
|
46
|
+
...recordKeys(input.manifest.dependencies),
|
|
47
|
+
...recordKeys(input.manifest.devDependencies),
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
for (const framework of FRAMEWORKS) {
|
|
51
|
+
const dependency = framework.detectPackages.find((name) =>
|
|
52
|
+
dependencies.has(name),
|
|
53
|
+
);
|
|
54
|
+
if (dependency) {
|
|
55
|
+
return detectedApp(
|
|
56
|
+
framework,
|
|
57
|
+
inferEntrypoint(framework, input, filePaths),
|
|
58
|
+
{
|
|
59
|
+
kind: "dependency",
|
|
60
|
+
path: joinRepoPath(root, "package.json"),
|
|
61
|
+
value: dependency,
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const configFile = framework.detectConfigFiles.find((fileName) =>
|
|
67
|
+
filePaths.has(joinRepoPath(root, fileName)),
|
|
68
|
+
);
|
|
69
|
+
if (configFile) {
|
|
70
|
+
return detectedApp(
|
|
71
|
+
framework,
|
|
72
|
+
inferEntrypoint(framework, input, filePaths),
|
|
73
|
+
{
|
|
74
|
+
kind: "config",
|
|
75
|
+
path: joinRepoPath(root, configFile),
|
|
76
|
+
value: configFile,
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const runtimeScript = readRuntimeScript(input.manifest.scripts);
|
|
83
|
+
if (runtimeScript) {
|
|
84
|
+
const bun = frameworkByKey("bun");
|
|
85
|
+
const scriptedEntrypoint = extractScriptEntrypoint(runtimeScript.command);
|
|
86
|
+
const scriptReferencesExistingFile =
|
|
87
|
+
scriptedEntrypoint !== null &&
|
|
88
|
+
filePaths.has(joinRepoPath(root, scriptedEntrypoint));
|
|
89
|
+
const entrypoint = scriptReferencesExistingFile
|
|
90
|
+
? scriptedEntrypoint
|
|
91
|
+
: inferEntrypoint(bun, input, filePaths);
|
|
92
|
+
if (entrypoint) {
|
|
93
|
+
return detectedApp(bun, entrypoint, {
|
|
94
|
+
kind: "entrypoint",
|
|
95
|
+
path: joinRepoPath(root, entrypoint),
|
|
96
|
+
value: `scripts.${runtimeScript.name}`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function detectedApp(
|
|
105
|
+
framework: FrameworkDescriptor,
|
|
106
|
+
entrypoint: string | null,
|
|
107
|
+
evidence: DetectedComputeApp["evidence"],
|
|
108
|
+
): DetectedComputeApp {
|
|
109
|
+
return {
|
|
110
|
+
framework: framework.key,
|
|
111
|
+
frameworkName: framework.displayName,
|
|
112
|
+
buildType: framework.buildType,
|
|
113
|
+
httpPort: framework.defaultHttpPort,
|
|
114
|
+
entrypoint,
|
|
115
|
+
evidence,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function inferEntrypoint(
|
|
120
|
+
framework: FrameworkDescriptor,
|
|
121
|
+
input: DetectComputeAppInput,
|
|
122
|
+
filePaths: Set<string>,
|
|
123
|
+
): string | null {
|
|
124
|
+
if (!framework.usesEntrypoint) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const root = normalizeRoot(input.root);
|
|
128
|
+
if (typeof input.manifest.main === "string") {
|
|
129
|
+
const main = normalizeEntrypoint(input.manifest.main);
|
|
130
|
+
if (main && filePaths.has(joinRepoPath(root, main))) {
|
|
131
|
+
return main;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const candidates = [
|
|
135
|
+
framework.defaultEntrypoint,
|
|
136
|
+
"src/index.ts",
|
|
137
|
+
"src/index.js",
|
|
138
|
+
"src/server.ts",
|
|
139
|
+
"src/server.js",
|
|
140
|
+
"index.ts",
|
|
141
|
+
"index.js",
|
|
142
|
+
"server.ts",
|
|
143
|
+
"server.js",
|
|
144
|
+
].filter((value): value is string => Boolean(value));
|
|
145
|
+
return (
|
|
146
|
+
candidates.find((candidate) =>
|
|
147
|
+
filePaths.has(joinRepoPath(root, candidate)),
|
|
148
|
+
) ?? null
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function normalizeEntrypoint(value: string): string | null {
|
|
153
|
+
if (
|
|
154
|
+
!value ||
|
|
155
|
+
value.startsWith("/") ||
|
|
156
|
+
value.startsWith("\\") ||
|
|
157
|
+
value.includes("\\") ||
|
|
158
|
+
/^[A-Za-z]:/.test(value)
|
|
159
|
+
) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
const normalized = value.replace(/^\.\/+/, "").replace(/\/+/g, "/");
|
|
163
|
+
if (
|
|
164
|
+
!normalized ||
|
|
165
|
+
normalized === "." ||
|
|
166
|
+
normalized.split("/").some((segment) => segment === "..")
|
|
167
|
+
) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return normalized;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function readRuntimeScript(
|
|
174
|
+
scripts: unknown,
|
|
175
|
+
): { name: "start" | "serve"; command: string } | null {
|
|
176
|
+
if (!scripts || typeof scripts !== "object") {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
const values = scripts as Record<string, unknown>;
|
|
180
|
+
for (const name of ["start", "serve"] as const) {
|
|
181
|
+
const command = values[name];
|
|
182
|
+
if (typeof command === "string" && command.trim()) {
|
|
183
|
+
return { name, command };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const SCRIPT_OPTIONS_WITH_FILE_ARGUMENT = [
|
|
190
|
+
"--experimental-loader",
|
|
191
|
+
"--import",
|
|
192
|
+
"--loader",
|
|
193
|
+
"--preload",
|
|
194
|
+
"--require",
|
|
195
|
+
"-r",
|
|
196
|
+
] as const;
|
|
197
|
+
|
|
198
|
+
function extractScriptEntrypoint(command: string): string | null {
|
|
199
|
+
const tokens = command.match(/"[^"]*"|'[^']*'|`[^`]*`|\S+/g) ?? [];
|
|
200
|
+
const candidates: string[] = [];
|
|
201
|
+
let skipNextToken = false;
|
|
202
|
+
|
|
203
|
+
for (const rawToken of tokens) {
|
|
204
|
+
if (skipNextToken) {
|
|
205
|
+
skipNextToken = false;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const quote = rawToken[0];
|
|
210
|
+
const token =
|
|
211
|
+
(quote === '"' || quote === "'" || quote === "`") &&
|
|
212
|
+
rawToken.at(-1) === quote
|
|
213
|
+
? rawToken.slice(1, -1)
|
|
214
|
+
: rawToken;
|
|
215
|
+
const optionWithFileArgument = SCRIPT_OPTIONS_WITH_FILE_ARGUMENT.find(
|
|
216
|
+
(option) => token === option || token.startsWith(`${option}=`),
|
|
217
|
+
);
|
|
218
|
+
if (optionWithFileArgument) {
|
|
219
|
+
skipNextToken = token === optionWithFileArgument;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (!/^(?:\.{1,2}\/)?[\w@./-]+\.(?:[cm]?[jt]sx?)$/.test(token)) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const candidate = normalizeEntrypoint(token);
|
|
227
|
+
if (candidate) {
|
|
228
|
+
candidates.push(candidate);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return candidates.length === 1 ? (candidates[0] ?? null) : null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function recordKeys(value: unknown): string[] {
|
|
236
|
+
return value && typeof value === "object" ? Object.keys(value) : [];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function normalizeRoot(root: string): string {
|
|
240
|
+
const normalized = root.replace(/^\.?\/+|\/+$/g, "");
|
|
241
|
+
return normalized === "." ? "" : normalized;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function joinRepoPath(...parts: string[]): string {
|
|
245
|
+
return parts.filter(Boolean).join("/").replace(/\/+/g, "/");
|
|
246
|
+
}
|
package/src/config/frameworks.ts
CHANGED
|
@@ -156,7 +156,7 @@ export const FRAMEWORKS: readonly FrameworkDescriptor[] = [
|
|
|
156
156
|
displayName: "Bun",
|
|
157
157
|
buildType: "bun",
|
|
158
158
|
aliases: ["bun"],
|
|
159
|
-
detectPackages: [],
|
|
159
|
+
detectPackages: ["elysia", "express", "fastify"],
|
|
160
160
|
detectConfigFiles: [],
|
|
161
161
|
usesEntrypoint: true,
|
|
162
162
|
defaultEntrypoint: null,
|
package/src/config/index.ts
CHANGED
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* project/branch resolution, prompts, flag precedence — stay with consumers.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
export {
|
|
11
|
+
type ComputeAppManifest,
|
|
12
|
+
type DetectComputeAppInput,
|
|
13
|
+
type DetectedComputeApp,
|
|
14
|
+
detectComputeApp,
|
|
15
|
+
} from "./detect-app.ts";
|
|
10
16
|
export {
|
|
11
17
|
ASTRO_CONFIG_FILENAMES,
|
|
12
18
|
CONFIG_BACKED_BUILD_TYPES,
|