@prisma/compute-sdk 0.47.0 → 0.48.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 +18 -18
- package/dist/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/service/build/build-service.d.ts +3 -3
- package/dist/service/build/build-service.d.ts.map +1 -1
- package/dist/service/build/build-service.js +21 -13
- package/dist/service/build/build-service.js.map +1 -1
- package/dist/service/build/{build-output.d.ts → output-directories.d.ts} +3 -3
- package/dist/service/build/output-directories.d.ts.map +1 -0
- package/dist/service/build/{build-output.js → output-directories.js} +2 -2
- package/dist/service/build/output-directories.js.map +1 -0
- package/dist/service/index.d.ts +3 -3
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/index.js +3 -3
- package/dist/service/index.js.map +1 -1
- package/dist/service/launcher-contract/start-plan.d.ts +3 -3
- package/dist/service/launcher-contract/start-plan.d.ts.map +1 -1
- package/dist/service/launcher-contract/start-plan.js +3 -3
- package/dist/service/launcher-contract/start-plan.js.map +1 -1
- package/dist/service/output/exclude.d.ts +6 -0
- package/dist/service/output/exclude.d.ts.map +1 -0
- package/dist/service/{artifact → output}/exclude.js +2 -2
- package/dist/service/output/exclude.js.map +1 -0
- package/dist/service/output/launcher-file.d.ts +3 -0
- package/dist/service/output/launcher-file.d.ts.map +1 -0
- package/dist/service/{artifact → output}/launcher-file.js +1 -1
- package/dist/service/output/launcher-file.js.map +1 -0
- package/dist/service/{artifact/write-artifact.d.ts → output/write-build-output.d.ts} +6 -6
- package/dist/service/output/write-build-output.d.ts.map +1 -0
- package/dist/service/{artifact/write-artifact.js → output/write-build-output.js} +7 -7
- package/dist/service/output/write-build-output.js.map +1 -0
- package/dist/service/settings/index.d.ts +1 -1
- package/dist/service/settings/index.d.ts.map +1 -1
- package/dist/service/settings/resolve.d.ts +2 -2
- package/dist/service/settings/resolve.d.ts.map +1 -1
- package/dist/service/settings/resolve.js.map +1 -1
- package/dist/service/settings/start-order.d.ts +2 -2
- package/dist/service/settings/start-order.d.ts.map +1 -1
- package/dist/service/settings/types.d.ts +1 -1
- package/dist/service/settings/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +2 -2
- package/src/service/build/build-service.ts +34 -19
- package/src/service/build/{build-output.ts → output-directories.ts} +3 -3
- package/src/service/index.ts +5 -5
- package/src/service/launcher/main.ts +2 -2
- package/src/service/launcher-contract/start-plan.ts +4 -4
- package/src/service/{artifact → output}/exclude.ts +2 -2
- package/src/service/{artifact → output}/launcher-file.ts +1 -1
- package/src/service/{artifact/write-artifact.ts → output/write-build-output.ts} +9 -9
- package/src/service/settings/index.ts +1 -1
- package/src/service/settings/resolve.ts +2 -2
- package/src/service/settings/start-order.ts +2 -2
- package/src/service/settings/types.ts +1 -1
- package/dist/service/artifact/exclude.d.ts +0 -6
- package/dist/service/artifact/exclude.d.ts.map +0 -1
- package/dist/service/artifact/exclude.js.map +0 -1
- package/dist/service/artifact/launcher-file.d.ts +0 -3
- package/dist/service/artifact/launcher-file.d.ts.map +0 -1
- package/dist/service/artifact/launcher-file.js.map +0 -1
- package/dist/service/artifact/write-artifact.d.ts.map +0 -1
- package/dist/service/artifact/write-artifact.js.map +0 -1
- package/dist/service/build/build-output.d.ts.map +0 -1
- package/dist/service/build/build-output.js.map +0 -1
package/README.md
CHANGED
|
@@ -455,9 +455,9 @@ class MyCustomBuild implements BuildStrategy {
|
|
|
455
455
|
|
|
456
456
|
## Build one Service from its own commands
|
|
457
457
|
|
|
458
|
-
`@prisma/compute-sdk/service` builds one Service from its own `install`, `build` and `start` commands. The result is
|
|
458
|
+
`@prisma/compute-sdk/service` builds one Service from its own `install`, `build` and `start` commands. The result is a build output: a folder and the file Compute starts in it. The package holds no framework rules.
|
|
459
459
|
|
|
460
|
-
This package does not deploy. It calls no Compute API. The caller takes the
|
|
460
|
+
This package does not deploy. It calls no Compute API. The caller takes the build output and deploys it: see [What the caller does next](#what-the-caller-does-next).
|
|
461
461
|
|
|
462
462
|
```ts
|
|
463
463
|
import { buildService } from "@prisma/compute-sdk/service";
|
|
@@ -467,10 +467,10 @@ if (built.isErr()) {
|
|
|
467
467
|
throw built.error;
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
built.value.
|
|
470
|
+
built.value.output; // { dir: "/repo", entrypoint: ".prisma/launcher.mjs" }
|
|
471
471
|
```
|
|
472
472
|
|
|
473
|
-
`buildService` returns a `Result`. Success means
|
|
473
|
+
`buildService` returns a `Result`. Success means a build output exists.
|
|
474
474
|
|
|
475
475
|
### Build settings
|
|
476
476
|
|
|
@@ -563,7 +563,7 @@ await buildService({
|
|
|
563
563
|
|
|
564
564
|
### `buildService(options)`
|
|
565
565
|
|
|
566
|
-
Runs install and build, decides the start, and writes two files into the
|
|
566
|
+
Runs install and build, decides the start, and writes two files into the build output folder: the Launcher (`.prisma/launcher.mjs`) and the Start plan (`.prisma/plan.json`). It runs on the Build runner, and needs a shell and the repository's package manager there. It never starts the Service.
|
|
567
567
|
|
|
568
568
|
```ts
|
|
569
569
|
const built = await buildService({
|
|
@@ -574,54 +574,54 @@ const built = await buildService({
|
|
|
574
574
|
if (built.isOk()) {
|
|
575
575
|
built.value.start; // { value: { kind: "command", command: "npm run start" }, from: "package.json" }
|
|
576
576
|
built.value.steps; // [{ name: "install", command: "npm ci", seconds: 12, ok: true }, { name: "build", ... }]
|
|
577
|
-
built.value.
|
|
577
|
+
built.value.output; // { dir: "/repo", entrypoint: ".prisma/launcher.mjs" }
|
|
578
578
|
}
|
|
579
579
|
```
|
|
580
580
|
|
|
581
|
-
A build that produces no
|
|
581
|
+
A build that produces no build output returns a `ServiceBuildError`. It is not thrown.
|
|
582
582
|
|
|
583
583
|
```ts
|
|
584
584
|
if (built.isErr()) {
|
|
585
585
|
built.error.code; // "build_failed"
|
|
586
586
|
built.error.message; // "Build failed: npm run build"
|
|
587
|
-
built.error.
|
|
587
|
+
built.error.commandOutput; // "Service build failed (exit code 2):\nsrc/index.ts(3,1): error TS2304: ..."
|
|
588
588
|
built.error.steps; // [{ name: "install", ok: true, ... }, { name: "build", ok: false, ... }]
|
|
589
589
|
}
|
|
590
590
|
```
|
|
591
591
|
|
|
592
592
|
| `code` | Meaning |
|
|
593
593
|
| --- | --- |
|
|
594
|
-
| `install_failed` | The install command exited with an error. `
|
|
595
|
-
| `build_failed` | The build command exited with an error. `
|
|
594
|
+
| `install_failed` | The install command exited with an error. `commandOutput` holds the end of its output. |
|
|
595
|
+
| `build_failed` | The build command exited with an error. `commandOutput` holds the end of its output. |
|
|
596
596
|
| `no_start` | No start rule matched. |
|
|
597
597
|
|
|
598
598
|
The install command runs with `NODE_ENV=development`, because dev dependencies hold the build tools. A `NODE_ENV` in `env` does not change that. The build command runs with `NODE_ENV=production` unless `env` sets another value.
|
|
599
599
|
|
|
600
|
-
For a static site the
|
|
600
|
+
For a static site the build output is only the built folder. For every other Service it is the Service folder.
|
|
601
601
|
|
|
602
602
|
### What the caller does next
|
|
603
603
|
|
|
604
|
-
The
|
|
604
|
+
The build output is a folder (`output.dir`) and an entry file (`output.entrypoint`, relative to the folder). The caller copies or uploads the folder and tells Compute to start the entry file with Bun.
|
|
605
605
|
|
|
606
|
-
The caller leaves out every file and folder that `
|
|
606
|
+
The caller leaves out every file and folder that `excludedFromBuildOutput` names, at every depth: `.git` and dotenv files (`.env`, `.env.*`). A CI checkout keeps a token in `.git`, and a dotenv file holds local secrets. Set the values the Service needs as variables on the project.
|
|
607
607
|
|
|
608
608
|
```ts
|
|
609
609
|
import { cp } from "node:fs/promises";
|
|
610
610
|
import path from "node:path";
|
|
611
|
-
import {
|
|
611
|
+
import { excludedFromBuildOutput } from "@prisma/compute-sdk/service";
|
|
612
612
|
|
|
613
|
-
const { dir, entrypoint } = built.value.
|
|
613
|
+
const { dir, entrypoint } = built.value.output;
|
|
614
614
|
|
|
615
|
-
await cp(dir, "/tmp/
|
|
615
|
+
await cp(dir, "/tmp/build-output", {
|
|
616
616
|
recursive: true,
|
|
617
|
-
filter: (source) => !
|
|
617
|
+
filter: (source) => !excludedFromBuildOutput(path.basename(source)),
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
621
|
`PreBuilt` takes the same function as its `exclude` option.
|
|
622
622
|
|
|
623
623
|
```ts
|
|
624
|
-
new PreBuilt({ appPath: dir, entrypoint, exclude:
|
|
624
|
+
new PreBuilt({ appPath: dir, entrypoint, exclude: excludedFromBuildOutput });
|
|
625
625
|
```
|
|
626
626
|
|
|
627
627
|
### Port
|
package/dist/errors.d.ts
CHANGED
|
@@ -129,9 +129,9 @@ declare const ServiceBuildError_base: import("better-result").TaggedErrorClass<"
|
|
|
129
129
|
settings: ServiceBuildSettings;
|
|
130
130
|
steps: BuildStep[];
|
|
131
131
|
/** The end of the failed command's output, under a line that gives its exit code. */
|
|
132
|
-
|
|
132
|
+
commandOutput?: string;
|
|
133
133
|
}>;
|
|
134
|
-
/** A build of one Service that produced no
|
|
134
|
+
/** A build of one Service that produced no build output. `code` is stable across releases. */
|
|
135
135
|
export declare class ServiceBuildError extends ServiceBuildError_base {
|
|
136
136
|
}
|
|
137
137
|
export {};
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;;gBAG1D,GAAG;aACN,MAAM;;AAFjB,qBAAa,mBAAoB,SAAQ,wBAGrC;CAAG;;gBAGO,MAAM;gBACN,MAAM;WACX,MAAM;aACJ,MAAM;WACR,MAAM;kBACC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;AANtC,qBAAa,QAAS,SAAQ,aAO1B;CAAG;;WAGE,MAAM;aACJ,MAAM;;AAFjB,q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G,QAAQ,CAAC;AAE9E,MAAM,MAAM,wBAAwB,GAChC,cAAc,GACd,mBAAmB,GACnB,QAAQ,GACR,YAAY,GACZ,qBAAqB,CAAC;;UAIlB,gBAAgB,GAAG,cAAc,GAAG,UAAU;IACpD,oBAAoB;aACX,MAAM;cACL,oBAAoB;WACvB,SAAS,EAAE;IAClB,qFAAqF;oBACrE,MAAM;;AARxB,8FAA8F;AAC9F,qBAAa,iBAAkB,SAAQ,sBAQnC;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -65,7 +65,7 @@ export class InvalidOptionsError extends TaggedError("InvalidOptionsError")() {
|
|
|
65
65
|
}
|
|
66
66
|
export class LogStreamError extends TaggedError("LogStreamError")() {
|
|
67
67
|
}
|
|
68
|
-
/** A build of one Service that produced no
|
|
68
|
+
/** A build of one Service that produced no build output. `code` is stable across releases. */
|
|
69
69
|
export class ServiceBuildError extends TaggedError("ServiceBuildError")() {
|
|
70
70
|
}
|
|
71
71
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,OAAO,mBAAoB,SAAQ,WAAW,CAAC,qBAAqB,CAAC,EAGvE;CAAG;AAEP,MAAM,OAAO,QAAS,SAAQ,WAAW,CAAC,UAAU,CAAC,EAOjD;CAAG;AAEP,MAAM,OAAO,oBAAqB,SAAQ,WAAW,CAAC,sBAAsB,CAAC,EAGzE;IACF,YAAY,IAAuB;QACjC,KAAK,CAAC;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,8BAA8B,IAAI,CAAC,KAAK,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,WAAW,CAAC,YAAY,CAAC,EAGrD;CAAG;AAEP,MAA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C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtE,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,OAAO,EAAE,qBAAqB,IAAI,CAAC,QAAQ,CAAC,MAAM,mBAAmB,SAAS,EAAE;SACjF,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW,CAAC,qBAAqB,CAAC,EAEvE;CAAG;AAEP,MAAM,OAAO,cAAe,SAAQ,WAAW,CAAC,gBAAgB,CAAC,EAG7D;CAAG;AAwDP,8FAA8F;AAC9F,MAAM,OAAO,iBAAkB,SAAQ,WAAW,CAAC,mBAAmB,CAAC,EAQnE;CAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "better-result";
|
|
2
2
|
import { ServiceBuildError } from "../../errors.ts";
|
|
3
|
-
import { type
|
|
3
|
+
import { type BuildOutput } from "../output/write-build-output.ts";
|
|
4
4
|
import type { Resolved, ServiceBuildSettings, ServiceConfig, Start } from "../settings/types.ts";
|
|
5
5
|
import { type BuildStep } from "./run-step.ts";
|
|
6
6
|
export interface BuildServiceOptions {
|
|
@@ -18,10 +18,10 @@ export interface BuiltService {
|
|
|
18
18
|
settings: ServiceBuildSettings;
|
|
19
19
|
start: Resolved<Start>;
|
|
20
20
|
steps: BuildStep[];
|
|
21
|
-
|
|
21
|
+
output: BuildOutput;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Runs the Service's install and build commands, decides how the Service starts, and writes the
|
|
24
|
+
* Runs the Service's install and build commands, decides how the Service starts, and writes the build output.
|
|
25
25
|
*
|
|
26
26
|
* A failed install, a failed build and a missing start are expected outcomes:
|
|
27
27
|
* they come back as a `ServiceBuildError`, not as a thrown error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-service.d.ts","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"build-service.d.ts","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,KAAK,EAGV,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,KAAK,EACN,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAiBD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,CA0ClD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Builds one Service folder
|
|
1
|
+
// Builds one Service folder and writes its build output. Runs on the Build runner: it needs a shell,
|
|
2
2
|
// the repository's package manager, and the checkout. It never starts the Service.
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { Result } from "better-result";
|
|
6
6
|
import { ServiceBuildError } from "../../errors.js";
|
|
7
|
-
import {
|
|
7
|
+
import { writeBuildOutput, } from "../output/write-build-output.js";
|
|
8
8
|
import { resolveServiceBuildSettings, resolveStartAfterBuild, } from "../settings/resolve.js";
|
|
9
|
-
import {
|
|
9
|
+
import { outputDirectoriesSince, snapshotFolders, } from "./output-directories.js";
|
|
10
10
|
import { runStep, } from "./run-step.js";
|
|
11
11
|
/** The build failures have stable codes: the CLI, Console and the fix task key on them. */
|
|
12
12
|
const STEP_FAILURES = {
|
|
@@ -18,7 +18,7 @@ const NO_START = {
|
|
|
18
18
|
message: "No start command. Add a start script to package.json, or set start or static in prisma.config.ts.",
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Runs the Service's install and build commands, decides how the Service starts, and writes the
|
|
21
|
+
* Runs the Service's install and build commands, decides how the Service starts, and writes the build output.
|
|
22
22
|
*
|
|
23
23
|
* A failed install, a failed build and a missing start are expected outcomes:
|
|
24
24
|
* they come back as a `ServiceBuildError`, not as a thrown error.
|
|
@@ -29,23 +29,27 @@ export async function buildService(options) {
|
|
|
29
29
|
const settings = await resolveServiceBuildSettings(read, options.config, options.signal);
|
|
30
30
|
const steps = [];
|
|
31
31
|
const fail = (failure) => Result.err(new ServiceBuildError({ ...failure, settings, steps }));
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
return fail(
|
|
32
|
+
const outputDirectories = await installAndBuild(settings, options, steps);
|
|
33
|
+
if (outputDirectories.isErr()) {
|
|
34
|
+
return fail(outputDirectories.error);
|
|
35
35
|
}
|
|
36
36
|
const start = settings.start === "after build"
|
|
37
|
-
? await resolveStartAfterBuild(read,
|
|
37
|
+
? await resolveStartAfterBuild(read, outputDirectories.value, options.signal)
|
|
38
38
|
: settings.start;
|
|
39
39
|
if (start === null) {
|
|
40
40
|
return fail(NO_START);
|
|
41
41
|
}
|
|
42
42
|
const port = settings.port?.value ?? null;
|
|
43
|
-
const
|
|
43
|
+
const output = writeBuildOutput({
|
|
44
|
+
serviceDir: dir,
|
|
45
|
+
start: start.value,
|
|
46
|
+
port,
|
|
47
|
+
});
|
|
44
48
|
return Result.ok({
|
|
45
49
|
settings: { ...settings, start },
|
|
46
50
|
start,
|
|
47
51
|
steps,
|
|
48
|
-
|
|
52
|
+
output,
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
/** Runs the install, then the build. Returns what the build created, or the step that failed. */
|
|
@@ -63,7 +67,7 @@ async function installAndBuild(settings, options, steps) {
|
|
|
63
67
|
if (!built.ok) {
|
|
64
68
|
return Result.err(stepFailed(build, built.output));
|
|
65
69
|
}
|
|
66
|
-
return Result.ok(
|
|
70
|
+
return Result.ok(outputDirectoriesSince(dir, beforeBuild));
|
|
67
71
|
}
|
|
68
72
|
/** The build runs in production mode. The caller's variables win over these. */
|
|
69
73
|
function buildStep(settings, extraEnv = {}) {
|
|
@@ -84,9 +88,13 @@ function installStep(settings, extraEnv = {}) {
|
|
|
84
88
|
env: { ...process.env, CI: "true", ...extraEnv, NODE_ENV: "development" },
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
|
-
function stepFailed(step,
|
|
91
|
+
function stepFailed(step, commandOutput) {
|
|
88
92
|
const { code, label } = STEP_FAILURES[step.name];
|
|
89
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
code,
|
|
95
|
+
message: `${label} failed: ${step.command}`,
|
|
96
|
+
commandOutput,
|
|
97
|
+
};
|
|
90
98
|
}
|
|
91
99
|
/** Reads the files of the Service folder for the Build rules. */
|
|
92
100
|
function readFrom(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-service.js","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"build-service.js","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E,EAAE,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAAe,EAAE,aAAqB;IACxD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,GAAG,KAAK,YAAY,IAAI,CAAC,OAAO,EAAE;QAC3C,aAAa;KACd,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OutputDirectories } from "../settings/types.ts";
|
|
2
2
|
/** The folders of the Service folder at one moment. Taken before the build, it tells what the build wrote. */
|
|
3
3
|
export interface FolderSnapshot {
|
|
4
4
|
/** Each top-level folder, with the time of the newest change to a file in it. */
|
|
@@ -11,10 +11,10 @@ export declare function snapshotFolders(serviceDir: string): FolderSnapshot;
|
|
|
11
11
|
* What the build wrote: the folders that were not in the snapshot, and the folders that the build wrote to again.
|
|
12
12
|
* The second kind is the output of an earlier build in the same folder. Without it a second build would find no output.
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function outputDirectoriesSince(serviceDir: string, before: FolderSnapshot): OutputDirectories;
|
|
15
15
|
/**
|
|
16
16
|
* True when the site in `dir` holds the first scripts and styles its `index.html` links to.
|
|
17
17
|
* A page copied out of a server build does not, and cannot be served alone.
|
|
18
18
|
*/
|
|
19
19
|
export declare function isSelfContained(dir: string): boolean;
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=output-directories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-directories.d.ts","sourceRoot":"","sources":["../../../src/service/build/output-directories.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,8GAA8G;AAC9G,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oFAAoF;IACpF,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAeD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAelE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GACrB,iBAAiB,CAgBnB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOpD"}
|
|
@@ -26,7 +26,7 @@ export function snapshotFolders(serviceDir) {
|
|
|
26
26
|
* What the build wrote: the folders that were not in the snapshot, and the folders that the build wrote to again.
|
|
27
27
|
* The second kind is the output of an earlier build in the same folder. Without it a second build would find no output.
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
29
|
+
export function outputDirectoriesSince(serviceDir, before) {
|
|
30
30
|
return {
|
|
31
31
|
newDirs: topLevelDirs(serviceDir).filter((dir) => newestFileChange(join(serviceDir, dir)) >
|
|
32
32
|
(before.topLevelDirs.get(dir) ?? Number.NEGATIVE_INFINITY)),
|
|
@@ -96,4 +96,4 @@ function dirsWithIndexHtml(serviceDir, depth, dir = ".") {
|
|
|
96
96
|
function shallowestFirst(a, b) {
|
|
97
97
|
return a.split("/").length - b.split("/").length || a.localeCompare(b);
|
|
98
98
|
}
|
|
99
|
-
//# sourceMappingURL=
|
|
99
|
+
//# sourceMappingURL=output-directories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-directories.js","sourceRoot":"","sources":["../../../src/service/build/output-directories.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8DAA8D;AAC9D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWjC,4CAA4C;AAC5C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,sEAAsE;AACtE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,iHAAiH;AACjH,MAAM,qBAAqB,GACzB,sDAAsD,CAAC;AAEzD,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO;QACL,YAAY,EAAE,IAAI,GAAG,CACnB,YAAY,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;YACpC,GAAG;YACH,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;SACxC,CAAC,CACH;QACD,UAAU,EAAE,IAAI,GAAG,CACjB,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;YAC5D,GAAG;YACH,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC;SACjC,CAAC,CACH;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAkB,EAClB,MAAsB;IAEtB,OAAO;QACL,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC,MAAM,CACtC,CAAC,GAAG,EAAE,EAAE,CACN,gBAAgB,CAAC,IAAI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AG,GAAG,GAAG;IAET,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE;QACrD,aAAa,EAAE,IAAI;KACpB,CAAC,EAAE,CAAC;QACH,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAClD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACtE,KAAK,CAAC,IAAI,CACR,GAAG,iBAAiB,CAAC,UAAU,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CACnE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ServiceBuildError } from "../errors.ts";
|
|
2
|
-
export { excludedFromArtifact } from "./artifact/exclude.ts";
|
|
3
|
-
export type { ServiceArtifact } from "./artifact/write-artifact.ts";
|
|
4
2
|
export { type BuildServiceOptions, type BuiltService, buildService, } from "./build/build-service.ts";
|
|
5
3
|
export type { BuildStep } from "./build/run-step.ts";
|
|
6
|
-
export {
|
|
4
|
+
export { excludedFromBuildOutput } from "./output/exclude.ts";
|
|
5
|
+
export type { BuildOutput } from "./output/write-build-output.ts";
|
|
6
|
+
export { isDevCommand, type OutputDirectories, type PackageManager, type ReadFile, type Resolved, resolveServiceBuildSettings, resolveStartAfterBuild, type ServiceBuildSettings, type ServiceConfig, type Source, type Start, } from "./settings/index.ts";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,KAAK,GACX,MAAM,qBAAqB,CAAC"}
|
package/dist/service/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// The public API of `@prisma/compute-sdk/service`: resolve the Build settings of one Service
|
|
2
|
-
// Nothing here deploys the
|
|
1
|
+
// The public API of `@prisma/compute-sdk/service`: resolve the Build settings of one Service, build it, and write its build output.
|
|
2
|
+
// Nothing here deploys the build output. The caller does that.
|
|
3
3
|
export { ServiceBuildError } from "../errors.js";
|
|
4
|
-
export { excludedFromArtifact } from "./artifact/exclude.js";
|
|
5
4
|
export { buildService, } from "./build/build-service.js";
|
|
5
|
+
export { excludedFromBuildOutput } from "./output/exclude.js";
|
|
6
6
|
export { isDevCommand, resolveServiceBuildSettings, resolveStartAfterBuild, } from "./settings/index.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,oIAAoI;AACpI,+DAA+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAGL,YAAY,GACb,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,YAAY,EAKZ,2BAA2B,EAC3B,sBAAsB,GAKvB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** The Launcher, relative to the
|
|
1
|
+
/** The Launcher, relative to the build output folder. Compute starts this file. */
|
|
2
2
|
export declare const LAUNCHER_FILE = ".prisma/launcher.mjs";
|
|
3
|
-
/** The Start plan, relative to the
|
|
3
|
+
/** The Start plan, relative to the build output folder. */
|
|
4
4
|
export declare const START_PLAN_FILE = ".prisma/plan.json";
|
|
5
5
|
/** The port the Service gets as `PORT` when Compute sets none and the user stated none. */
|
|
6
6
|
export declare const DEFAULT_PORT = 8080;
|
|
@@ -11,7 +11,7 @@ export type StartPlan =
|
|
|
11
11
|
command: string;
|
|
12
12
|
port: number | null;
|
|
13
13
|
}
|
|
14
|
-
/** Serve a folder of static files. `dir` is relative to the
|
|
14
|
+
/** Serve a folder of static files. `dir` is relative to the build output folder. */
|
|
15
15
|
| {
|
|
16
16
|
kind: "static";
|
|
17
17
|
dir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-plan.d.ts","sourceRoot":"","sources":["../../../src/service/launcher-contract/start-plan.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"start-plan.d.ts","sourceRoot":"","sources":["../../../src/service/launcher-contract/start-plan.ts"],"names":[],"mappings":"AAIA,mFAAmF;AACnF,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD,2DAA2D;AAC3D,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,2FAA2F;AAC3F,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,MAAM,MAAM,SAAS;AACnB,wFAAwF;AACtF;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAC3D,oFAAoF;GAClF;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// The Start plan: what the Build runner tells the Launcher to do on the Runtime.
|
|
2
|
-
// The build writes it into the
|
|
2
|
+
// The build writes it into the build output beside the Launcher, and the Launcher reads it at every start.
|
|
3
3
|
// Both files come from the same SDK version, so the format needs no version field.
|
|
4
|
-
/** The Launcher, relative to the
|
|
4
|
+
/** The Launcher, relative to the build output folder. Compute starts this file. */
|
|
5
5
|
export const LAUNCHER_FILE = ".prisma/launcher.mjs";
|
|
6
|
-
/** The Start plan, relative to the
|
|
6
|
+
/** The Start plan, relative to the build output folder. */
|
|
7
7
|
export const START_PLAN_FILE = ".prisma/plan.json";
|
|
8
8
|
/** The port the Service gets as `PORT` when Compute sets none and the user stated none. */
|
|
9
9
|
export const DEFAULT_PORT = 8080;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-plan.js","sourceRoot":"","sources":["../../../src/service/launcher-contract/start-plan.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,
|
|
1
|
+
{"version":3,"file":"start-plan.js","sourceRoot":"","sources":["../../../src/service/launcher-contract/start-plan.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,2GAA2G;AAC3G,mFAAmF;AAEnF,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAEpD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAEnD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True for a file or folder that never goes into a build output, at any depth.
|
|
3
|
+
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
|
+
*/
|
|
5
|
+
export declare function excludedFromBuildOutput(name: string): boolean;
|
|
6
|
+
//# sourceMappingURL=exclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../../src/service/output/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* True for a file or folder that never goes into
|
|
2
|
+
* True for a file or folder that never goes into a build output, at any depth.
|
|
3
3
|
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
5
|
+
export function excludedFromBuildOutput(name) {
|
|
6
6
|
return name === ".git" || name === ".env" || name.startsWith(".env.");
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=exclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../src/service/output/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher-file.d.ts","sourceRoot":"","sources":["../../../src/service/output/launcher-file.ts"],"names":[],"mappings":"AAMA,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,MAAM,CAUrC"}
|
|
@@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
/** The one-file Launcher, relative to this folder. `src/` and `dist/` hold this folder at the same depth, so one path fits both. */
|
|
4
4
|
const BUNDLED_LAUNCHER = "../../../dist/service/launcher.mjs";
|
|
5
|
-
/** The path of the Launcher as one file, ready to copy into
|
|
5
|
+
/** The path of the Launcher as one file, ready to copy into a build output. */
|
|
6
6
|
export function launcherFile() {
|
|
7
7
|
const file = fileURLToPath(new URL(BUNDLED_LAUNCHER, import.meta.url));
|
|
8
8
|
if (!existsSync(file)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher-file.js","sourceRoot":"","sources":["../../../src/service/output/launcher-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oIAAoI;AACpI,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,uFAAuF,CAC1H,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Start } from "../settings/types.ts";
|
|
2
2
|
/** What a build hands to the caller: a folder and the file Compute starts in it. */
|
|
3
|
-
export interface
|
|
4
|
-
/** The folder to copy or upload, without what `
|
|
3
|
+
export interface BuildOutput {
|
|
4
|
+
/** The folder to copy or upload, without what `excludedFromBuildOutput` names. */
|
|
5
5
|
dir: string;
|
|
6
6
|
/** The file Compute starts, relative to `dir`. */
|
|
7
7
|
entrypoint: string;
|
|
8
8
|
}
|
|
9
|
-
/** Picks the
|
|
10
|
-
export declare function
|
|
9
|
+
/** Picks the build output folder, and writes the Launcher and the Start plan into it. */
|
|
10
|
+
export declare function writeBuildOutput(options: {
|
|
11
11
|
serviceDir: string;
|
|
12
12
|
start: Start;
|
|
13
13
|
/** The port the user stated, or null. */
|
|
14
14
|
port: number | null;
|
|
15
|
-
}):
|
|
16
|
-
//# sourceMappingURL=write-
|
|
15
|
+
}): BuildOutput;
|
|
16
|
+
//# sourceMappingURL=write-build-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-build-output.d.ts","sourceRoot":"","sources":["../../../src/service/output/write-build-output.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,GAAG,WAAW,CAWd"}
|
|
@@ -2,23 +2,23 @@ import { copyFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { LAUNCHER_FILE, START_PLAN_FILE, } from "../launcher-contract/start-plan.js";
|
|
4
4
|
import { launcherFile } from "./launcher-file.js";
|
|
5
|
-
/** Picks the
|
|
6
|
-
export function
|
|
7
|
-
const dir =
|
|
5
|
+
/** Picks the build output folder, and writes the Launcher and the Start plan into it. */
|
|
6
|
+
export function writeBuildOutput(options) {
|
|
7
|
+
const dir = outputDir(options.serviceDir, options.start);
|
|
8
8
|
mkdirSync(join(dir, dirname(LAUNCHER_FILE)), { recursive: true });
|
|
9
9
|
copyFileSync(launcherFile(), join(dir, LAUNCHER_FILE));
|
|
10
10
|
writeFileSync(join(dir, START_PLAN_FILE), JSON.stringify(startPlan(options.start, options.port)));
|
|
11
11
|
return { dir, entrypoint: LAUNCHER_FILE };
|
|
12
12
|
}
|
|
13
|
-
/** A static site needs no source and no `node_modules`, so its
|
|
14
|
-
function
|
|
13
|
+
/** A static site needs no source and no `node_modules`, so its build output is the built folder alone. */
|
|
14
|
+
function outputDir(serviceDir, start) {
|
|
15
15
|
return start.kind === "static" ? join(serviceDir, start.dir) : serviceDir;
|
|
16
16
|
}
|
|
17
17
|
function startPlan(start, port) {
|
|
18
18
|
if (start.kind === "static") {
|
|
19
|
-
// The
|
|
19
|
+
// The build output of a static site is the site's own folder, so the plan serves the build output folder itself.
|
|
20
20
|
return { kind: "static", dir: ".", port };
|
|
21
21
|
}
|
|
22
22
|
return { kind: "command", command: start.command, port };
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=write-
|
|
24
|
+
//# sourceMappingURL=write-build-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-build-output.js","sourceRoot":"","sources":["../../../src/service/output/write-build-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,E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E,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PackageManager } from "../../package-manager.ts";
|
|
2
2
|
export { isDevCommand } from "./dev-command.ts";
|
|
3
3
|
export { resolveServiceBuildSettings, resolveStartAfterBuild, } from "./resolve.ts";
|
|
4
|
-
export type {
|
|
4
|
+
export type { OutputDirectories, ReadFile, Resolved, ServiceBuildSettings, ServiceConfig, Source, Start, } from "./types.ts";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/settings/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/settings/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,MAAM,EACN,KAAK,GACN,MAAM,YAAY,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OutputDirectories, ReadFile, Resolved, ServiceBuildSettings, ServiceConfig, Start } from "./types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Resolves the Build settings that can be known before the build runs.
|
|
4
4
|
* `start` is `"after build"` when only the build output can decide it.
|
|
5
5
|
*/
|
|
6
6
|
export declare function resolveServiceBuildSettings(read: ReadFile, config?: ServiceConfig, signal?: AbortSignal): Promise<ServiceBuildSettings>;
|
|
7
7
|
/** Decides the start from the build output and the source. Null means no rule matched. */
|
|
8
|
-
export declare function resolveStartAfterBuild(read: ReadFile, output:
|
|
8
|
+
export declare function resolveStartAfterBuild(read: ReadFile, output: OutputDirectories, signal?: AbortSignal): Promise<Resolved<Start> | null>;
|
|
9
9
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/service/settings/resolve.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/service/settings/resolve.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,QAAQ,EACd,MAAM,GAAE,aAAkB,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAoB/B;AAED,0FAA0F;AAC1F,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAQjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/service/settings/resolve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAA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,KAAK,UAAU,sBAAsB,CAC1C,IAAc,EACd,MAAyB,EACzB,MAAoB;IAEpB,MAAM,EAAE,cAAc,EAAE,CAAC;IAEzB,OAAO,eAAe,CAAC;QACrB,IAAI;QACJ,MAAM;QACN,WAAW,EAAE,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW;KACvD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,2BAA2B,GAC/B,+CAA+C,CAAC;AAElD,4FAA4F;AAC5F,SAAS,YAAY,CACnB,OAA+B,EAC/B,cAA8B,EAC9B,MAAqB;IAErB,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,GAAG,cAAc,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IACxE,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC1C,CAAC;AAED,0EAA0E;AAC1E,SAAS,WAAW,CAAC,MAAqB;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PackageManager } from "../../package-manager.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OutputDirectories, PackageJson, ReadFile, Resolved, ServiceConfig, Start } from "./types.ts";
|
|
3
3
|
/** What a rule may look at before the build runs. */
|
|
4
4
|
interface ServiceBeforeBuild {
|
|
5
5
|
config: ServiceConfig;
|
|
@@ -10,7 +10,7 @@ interface ServiceBeforeBuild {
|
|
|
10
10
|
interface ServiceAfterBuild {
|
|
11
11
|
read: ReadFile;
|
|
12
12
|
packageJson: PackageJson;
|
|
13
|
-
output:
|
|
13
|
+
output: OutputDirectories;
|
|
14
14
|
}
|
|
15
15
|
/** The start, when a rule that needs no build output decides it, and the notes for the user. */
|
|
16
16
|
export declare function startBeforeBuild(service: ServiceBeforeBuild): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-order.d.ts","sourceRoot":"","sources":["../../../src/service/settings/start-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"start-order.d.ts","sourceRoot":"","sources":["../../../src/service/settings/start-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EAEb,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,qDAAqD;AACrD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,sDAAsD;AACtD,UAAU,iBAAiB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AA6CD,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG;IAC7D,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;IACvC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CASA;AAED,2FAA2F;AAC3F,wBAAsB,eAAe,CACnC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CASjC"}
|
|
@@ -45,7 +45,7 @@ export interface ServiceBuildSettings {
|
|
|
45
45
|
notes: string[];
|
|
46
46
|
}
|
|
47
47
|
/** What the build step wrote, as far as the start order needs it. */
|
|
48
|
-
export interface
|
|
48
|
+
export interface OutputDirectories {
|
|
49
49
|
/** Top-level folders the build created or wrote to, such as `dist` or `.output`. */
|
|
50
50
|
newDirs: string[];
|
|
51
51
|
/** Folders that hold a self-contained `index.html` the build wrote, shallowest first. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/service/settings/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;AAEhF,4FAA4F;AAC5F,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,MAAM,MAAM,GACd,QAAQ,GACR,cAAc,GACd,UAAU,GACV,cAAc,GACd,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;CACd;AAED,2GAA2G;AAC3G,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpC;IA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ACzC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -190,7 +190,7 @@ export type DeploymentOperationError =
|
|
|
190
190
|
| TimeoutError
|
|
191
191
|
| DeploymentFailedError;
|
|
192
192
|
|
|
193
|
-
/** A build of one Service that produced no
|
|
193
|
+
/** A build of one Service that produced no build output. `code` is stable across releases. */
|
|
194
194
|
export class ServiceBuildError extends TaggedError("ServiceBuildError")<{
|
|
195
195
|
code: "install_failed" | "build_failed" | "no_start";
|
|
196
196
|
/** For the user. */
|
|
@@ -198,5 +198,5 @@ export class ServiceBuildError extends TaggedError("ServiceBuildError")<{
|
|
|
198
198
|
settings: ServiceBuildSettings;
|
|
199
199
|
steps: BuildStep[];
|
|
200
200
|
/** The end of the failed command's output, under a line that gives its exit code. */
|
|
201
|
-
|
|
201
|
+
commandOutput?: string;
|
|
202
202
|
}>() {}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
// Builds one Service folder
|
|
1
|
+
// Builds one Service folder and writes its build output. Runs on the Build runner: it needs a shell,
|
|
2
2
|
// the repository's package manager, and the checkout. It never starts the Service.
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { Result } from "better-result";
|
|
6
6
|
import { ServiceBuildError } from "../../errors.ts";
|
|
7
7
|
import {
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
} from "../
|
|
8
|
+
type BuildOutput,
|
|
9
|
+
writeBuildOutput,
|
|
10
|
+
} from "../output/write-build-output.ts";
|
|
11
11
|
import {
|
|
12
12
|
resolveServiceBuildSettings,
|
|
13
13
|
resolveStartAfterBuild,
|
|
14
14
|
} from "../settings/resolve.ts";
|
|
15
15
|
import type {
|
|
16
|
-
|
|
16
|
+
OutputDirectories,
|
|
17
17
|
ReadFile,
|
|
18
18
|
Resolved,
|
|
19
19
|
ServiceBuildSettings,
|
|
20
20
|
ServiceConfig,
|
|
21
21
|
Start,
|
|
22
22
|
} from "../settings/types.ts";
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
outputDirectoriesSince,
|
|
25
|
+
snapshotFolders,
|
|
26
|
+
} from "./output-directories.ts";
|
|
24
27
|
import {
|
|
25
28
|
type BuildStep,
|
|
26
29
|
runStep,
|
|
@@ -44,11 +47,11 @@ export interface BuiltService {
|
|
|
44
47
|
settings: ServiceBuildSettings;
|
|
45
48
|
start: Resolved<Start>;
|
|
46
49
|
steps: BuildStep[];
|
|
47
|
-
|
|
50
|
+
output: BuildOutput;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/** What makes a `ServiceBuildError`, beside the Build settings and the steps. */
|
|
51
|
-
type Failure = Pick<ServiceBuildError, "code" | "message" | "
|
|
54
|
+
type Failure = Pick<ServiceBuildError, "code" | "message" | "commandOutput">;
|
|
52
55
|
|
|
53
56
|
/** The build failures have stable codes: the CLI, Console and the fix task key on them. */
|
|
54
57
|
const STEP_FAILURES = {
|
|
@@ -63,7 +66,7 @@ const NO_START: Failure = {
|
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
|
-
* Runs the Service's install and build commands, decides how the Service starts, and writes the
|
|
69
|
+
* Runs the Service's install and build commands, decides how the Service starts, and writes the build output.
|
|
67
70
|
*
|
|
68
71
|
* A failed install, a failed build and a missing start are expected outcomes:
|
|
69
72
|
* they come back as a `ServiceBuildError`, not as a thrown error.
|
|
@@ -82,27 +85,35 @@ export async function buildService(
|
|
|
82
85
|
const fail = (failure: Failure) =>
|
|
83
86
|
Result.err(new ServiceBuildError({ ...failure, settings, steps }));
|
|
84
87
|
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
return fail(
|
|
88
|
+
const outputDirectories = await installAndBuild(settings, options, steps);
|
|
89
|
+
if (outputDirectories.isErr()) {
|
|
90
|
+
return fail(outputDirectories.error);
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
const start =
|
|
91
94
|
settings.start === "after build"
|
|
92
|
-
? await resolveStartAfterBuild(
|
|
95
|
+
? await resolveStartAfterBuild(
|
|
96
|
+
read,
|
|
97
|
+
outputDirectories.value,
|
|
98
|
+
options.signal,
|
|
99
|
+
)
|
|
93
100
|
: settings.start;
|
|
94
101
|
if (start === null) {
|
|
95
102
|
return fail(NO_START);
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
const port = settings.port?.value ?? null;
|
|
99
|
-
const
|
|
106
|
+
const output = writeBuildOutput({
|
|
107
|
+
serviceDir: dir,
|
|
108
|
+
start: start.value,
|
|
109
|
+
port,
|
|
110
|
+
});
|
|
100
111
|
|
|
101
112
|
return Result.ok({
|
|
102
113
|
settings: { ...settings, start },
|
|
103
114
|
start,
|
|
104
115
|
steps,
|
|
105
|
-
|
|
116
|
+
output,
|
|
106
117
|
});
|
|
107
118
|
}
|
|
108
119
|
|
|
@@ -111,7 +122,7 @@ async function installAndBuild(
|
|
|
111
122
|
settings: ServiceBuildSettings,
|
|
112
123
|
options: BuildServiceOptions,
|
|
113
124
|
steps: BuildStep[],
|
|
114
|
-
): Promise<Result<
|
|
125
|
+
): Promise<Result<OutputDirectories, Failure>> {
|
|
115
126
|
const { dir, env, signal } = options;
|
|
116
127
|
const run: StepRun = { dir, steps, log: options.log ?? (() => {}), signal };
|
|
117
128
|
|
|
@@ -128,7 +139,7 @@ async function installAndBuild(
|
|
|
128
139
|
return Result.err(stepFailed(build, built.output));
|
|
129
140
|
}
|
|
130
141
|
|
|
131
|
-
return Result.ok(
|
|
142
|
+
return Result.ok(outputDirectoriesSince(dir, beforeBuild));
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
/** The build runs in production mode. The caller's variables win over these. */
|
|
@@ -158,10 +169,14 @@ function installStep(
|
|
|
158
169
|
};
|
|
159
170
|
}
|
|
160
171
|
|
|
161
|
-
function stepFailed(step: StepToRun,
|
|
172
|
+
function stepFailed(step: StepToRun, commandOutput: string): Failure {
|
|
162
173
|
const { code, label } = STEP_FAILURES[step.name];
|
|
163
174
|
|
|
164
|
-
return {
|
|
175
|
+
return {
|
|
176
|
+
code,
|
|
177
|
+
message: `${label} failed: ${step.command}`,
|
|
178
|
+
commandOutput,
|
|
179
|
+
};
|
|
165
180
|
}
|
|
166
181
|
|
|
167
182
|
/** Reads the files of the Service folder for the Build rules. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// The Build rules must not guess output folders by framework.
|
|
3
3
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import type {
|
|
5
|
+
import type { OutputDirectories } from "../settings/types.ts";
|
|
6
6
|
|
|
7
7
|
/** The folders of the Service folder at one moment. Taken before the build, it tells what the build wrote. */
|
|
8
8
|
export interface FolderSnapshot {
|
|
@@ -46,10 +46,10 @@ export function snapshotFolders(serviceDir: string): FolderSnapshot {
|
|
|
46
46
|
* What the build wrote: the folders that were not in the snapshot, and the folders that the build wrote to again.
|
|
47
47
|
* The second kind is the output of an earlier build in the same folder. Without it a second build would find no output.
|
|
48
48
|
*/
|
|
49
|
-
export function
|
|
49
|
+
export function outputDirectoriesSince(
|
|
50
50
|
serviceDir: string,
|
|
51
51
|
before: FolderSnapshot,
|
|
52
|
-
):
|
|
52
|
+
): OutputDirectories {
|
|
53
53
|
return {
|
|
54
54
|
newDirs: topLevelDirs(serviceDir).filter(
|
|
55
55
|
(dir) =>
|
package/src/service/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// The public API of `@prisma/compute-sdk/service`: resolve the Build settings of one Service
|
|
2
|
-
// Nothing here deploys the
|
|
1
|
+
// The public API of `@prisma/compute-sdk/service`: resolve the Build settings of one Service, build it, and write its build output.
|
|
2
|
+
// Nothing here deploys the build output. The caller does that.
|
|
3
3
|
export { ServiceBuildError } from "../errors.ts";
|
|
4
|
-
export { excludedFromArtifact } from "./artifact/exclude.ts";
|
|
5
|
-
export type { ServiceArtifact } from "./artifact/write-artifact.ts";
|
|
6
4
|
export {
|
|
7
5
|
type BuildServiceOptions,
|
|
8
6
|
type BuiltService,
|
|
9
7
|
buildService,
|
|
10
8
|
} from "./build/build-service.ts";
|
|
11
9
|
export type { BuildStep } from "./build/run-step.ts";
|
|
10
|
+
export { excludedFromBuildOutput } from "./output/exclude.ts";
|
|
11
|
+
export type { BuildOutput } from "./output/write-build-output.ts";
|
|
12
12
|
export {
|
|
13
|
-
type BuildOutput,
|
|
14
13
|
isDevCommand,
|
|
14
|
+
type OutputDirectories,
|
|
15
15
|
type PackageManager,
|
|
16
16
|
type ReadFile,
|
|
17
17
|
type Resolved,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The Launcher: the file Compute starts from
|
|
1
|
+
// The Launcher: the file Compute starts from a build output. It starts the Service.
|
|
2
2
|
// It exists because the Runtime has no /bin/sh and no /usr/bin/env, so `bun run start` cannot work there.
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -33,7 +33,7 @@ if (shim === null) {
|
|
|
33
33
|
* A stop signal goes on to the Service. In static mode it stops the server.
|
|
34
34
|
*/
|
|
35
35
|
async function startService(): Promise<void> {
|
|
36
|
-
// The Launcher is at .prisma/launcher.mjs in the
|
|
36
|
+
// The Launcher is at .prisma/launcher.mjs in the build output, so the Service's folder is one level up.
|
|
37
37
|
const serviceDir = resolve(dirname(launcherFile), "..");
|
|
38
38
|
const plan = readStartPlan(serviceDir);
|
|
39
39
|
const port = routedPort(plan);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// The Start plan: what the Build runner tells the Launcher to do on the Runtime.
|
|
2
|
-
// The build writes it into the
|
|
2
|
+
// The build writes it into the build output beside the Launcher, and the Launcher reads it at every start.
|
|
3
3
|
// Both files come from the same SDK version, so the format needs no version field.
|
|
4
4
|
|
|
5
|
-
/** The Launcher, relative to the
|
|
5
|
+
/** The Launcher, relative to the build output folder. Compute starts this file. */
|
|
6
6
|
export const LAUNCHER_FILE = ".prisma/launcher.mjs";
|
|
7
7
|
|
|
8
|
-
/** The Start plan, relative to the
|
|
8
|
+
/** The Start plan, relative to the build output folder. */
|
|
9
9
|
export const START_PLAN_FILE = ".prisma/plan.json";
|
|
10
10
|
|
|
11
11
|
/** The port the Service gets as `PORT` when Compute sets none and the user stated none. */
|
|
@@ -14,5 +14,5 @@ export const DEFAULT_PORT = 8080;
|
|
|
14
14
|
export type StartPlan =
|
|
15
15
|
/** Run the Service's own start command. `port` is the port the user stated, or null. */
|
|
16
16
|
| { kind: "command"; command: string; port: number | null }
|
|
17
|
-
/** Serve a folder of static files. `dir` is relative to the
|
|
17
|
+
/** Serve a folder of static files. `dir` is relative to the build output folder. */
|
|
18
18
|
| { kind: "static"; dir: string; port: number | null };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* True for a file or folder that never goes into
|
|
2
|
+
* True for a file or folder that never goes into a build output, at any depth.
|
|
3
3
|
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
5
|
+
export function excludedFromBuildOutput(name: string): boolean {
|
|
6
6
|
return name === ".git" || name === ".env" || name.startsWith(".env.");
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
/** The one-file Launcher, relative to this folder. `src/` and `dist/` hold this folder at the same depth, so one path fits both. */
|
|
5
5
|
const BUNDLED_LAUNCHER = "../../../dist/service/launcher.mjs";
|
|
6
6
|
|
|
7
|
-
/** The path of the Launcher as one file, ready to copy into
|
|
7
|
+
/** The path of the Launcher as one file, ready to copy into a build output. */
|
|
8
8
|
export function launcherFile(): string {
|
|
9
9
|
const file = fileURLToPath(new URL(BUNDLED_LAUNCHER, import.meta.url));
|
|
10
10
|
|
|
@@ -9,21 +9,21 @@ import type { Start } from "../settings/types.ts";
|
|
|
9
9
|
import { launcherFile } from "./launcher-file.ts";
|
|
10
10
|
|
|
11
11
|
/** What a build hands to the caller: a folder and the file Compute starts in it. */
|
|
12
|
-
export interface
|
|
13
|
-
/** The folder to copy or upload, without what `
|
|
12
|
+
export interface BuildOutput {
|
|
13
|
+
/** The folder to copy or upload, without what `excludedFromBuildOutput` names. */
|
|
14
14
|
dir: string;
|
|
15
15
|
/** The file Compute starts, relative to `dir`. */
|
|
16
16
|
entrypoint: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/** Picks the
|
|
20
|
-
export function
|
|
19
|
+
/** Picks the build output folder, and writes the Launcher and the Start plan into it. */
|
|
20
|
+
export function writeBuildOutput(options: {
|
|
21
21
|
serviceDir: string;
|
|
22
22
|
start: Start;
|
|
23
23
|
/** The port the user stated, or null. */
|
|
24
24
|
port: number | null;
|
|
25
|
-
}):
|
|
26
|
-
const dir =
|
|
25
|
+
}): BuildOutput {
|
|
26
|
+
const dir = outputDir(options.serviceDir, options.start);
|
|
27
27
|
|
|
28
28
|
mkdirSync(join(dir, dirname(LAUNCHER_FILE)), { recursive: true });
|
|
29
29
|
copyFileSync(launcherFile(), join(dir, LAUNCHER_FILE));
|
|
@@ -35,14 +35,14 @@ export function writeArtifact(options: {
|
|
|
35
35
|
return { dir, entrypoint: LAUNCHER_FILE };
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** A static site needs no source and no `node_modules`, so its
|
|
39
|
-
function
|
|
38
|
+
/** A static site needs no source and no `node_modules`, so its build output is the built folder alone. */
|
|
39
|
+
function outputDir(serviceDir: string, start: Start): string {
|
|
40
40
|
return start.kind === "static" ? join(serviceDir, start.dir) : serviceDir;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function startPlan(start: Start, port: number | null): StartPlan {
|
|
44
44
|
if (start.kind === "static") {
|
|
45
|
-
// The
|
|
45
|
+
// The build output of a static site is the site's own folder, so the plan serves the build output folder itself.
|
|
46
46
|
return { kind: "static", dir: ".", port };
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -5,7 +5,7 @@ import { pinnedNodeVersion } from "./node-version.ts";
|
|
|
5
5
|
import { readPackageJson } from "./package-json.ts";
|
|
6
6
|
import { startAfterBuild, startBeforeBuild } from "./start-order.ts";
|
|
7
7
|
import type {
|
|
8
|
-
|
|
8
|
+
OutputDirectories,
|
|
9
9
|
ReadFile,
|
|
10
10
|
Resolved,
|
|
11
11
|
ServiceBuildSettings,
|
|
@@ -46,7 +46,7 @@ export async function resolveServiceBuildSettings(
|
|
|
46
46
|
/** Decides the start from the build output and the source. Null means no rule matched. */
|
|
47
47
|
export async function resolveStartAfterBuild(
|
|
48
48
|
read: ReadFile,
|
|
49
|
-
output:
|
|
49
|
+
output: OutputDirectories,
|
|
50
50
|
signal?: AbortSignal,
|
|
51
51
|
): Promise<Resolved<Start> | null> {
|
|
52
52
|
signal?.throwIfAborted();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { PackageManager } from "../../package-manager.ts";
|
|
4
4
|
import { isDevCommand } from "./dev-command.ts";
|
|
5
5
|
import type {
|
|
6
|
-
|
|
6
|
+
OutputDirectories,
|
|
7
7
|
PackageJson,
|
|
8
8
|
ReadFile,
|
|
9
9
|
Resolved,
|
|
@@ -23,7 +23,7 @@ interface ServiceBeforeBuild {
|
|
|
23
23
|
interface ServiceAfterBuild {
|
|
24
24
|
read: ReadFile;
|
|
25
25
|
packageJson: PackageJson;
|
|
26
|
-
output:
|
|
26
|
+
output: OutputDirectories;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** A rule returns the start it found, or null when it does not match. */
|
|
@@ -54,7 +54,7 @@ export interface ServiceBuildSettings {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/** What the build step wrote, as far as the start order needs it. */
|
|
57
|
-
export interface
|
|
57
|
+
export interface OutputDirectories {
|
|
58
58
|
/** Top-level folders the build created or wrote to, such as `dist` or `.output`. */
|
|
59
59
|
newDirs: string[];
|
|
60
60
|
/** Folders that hold a self-contained `index.html` the build wrote, shallowest first. */
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* True for a file or folder that never goes into an Artifact, at any depth.
|
|
3
|
-
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
|
-
*/
|
|
5
|
-
export declare function excludedFromArtifact(name: string): boolean;
|
|
6
|
-
//# sourceMappingURL=exclude.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../../src/service/artifact/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../src/service/artifact/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launcher-file.d.ts","sourceRoot":"","sources":["../../../src/service/artifact/launcher-file.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,MAAM,CAUrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launcher-file.js","sourceRoot":"","sources":["../../../src/service/artifact/launcher-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oIAAoI;AACpI,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,4EAA4E;AAC5E,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,uFAAuF,CAC1H,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-artifact.d.ts","sourceRoot":"","sources":["../../../src/service/artifact/write-artifact.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,GAAG,eAAe,CAWlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-artifact.js","sourceRoot":"","sources":["../../../src/service/artifact/write-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,aAAa,EACb,eAAe,GAEhB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAUlD,qFAAqF;AACrF,MAAM,UAAU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