@ecomweb/cli 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.js +21 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/logs.d.ts +1 -0
- package/dist/commands/logs.js +9 -2
- package/dist/commands/logs.js.map +1 -1
- package/dist/lib/build-log-render.d.ts +26 -0
- package/dist/lib/build-log-render.js +103 -0
- package/dist/lib/build-log-render.js.map +1 -0
- package/dist/lib/build-log-view.d.ts +37 -0
- package/dist/lib/build-log-view.js +135 -0
- package/dist/lib/build-log-view.js.map +1 -0
- package/dist/lib/deployments.d.ts +12 -0
- package/dist/lib/deployments.js +140 -34
- package/dist/lib/deployments.js.map +1 -1
- package/dist/lib/project-setup.d.ts +1 -0
- package/dist/lib/project-setup.js +14 -0
- package/dist/lib/project-setup.js.map +1 -1
- package/dist/lib/theme-schema-export.d.ts +7 -0
- package/dist/lib/theme-schema-export.js +49 -0
- package/dist/lib/theme-schema-export.js.map +1 -0
- package/oclif.manifest.json +3025 -3002
- package/package.json +1 -1
|
@@ -6,6 +6,8 @@ export default class Deploy extends BaseCommand {
|
|
|
6
6
|
dir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
prebuilt: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
"skip-build": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
theme: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
11
|
prod: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
13
|
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
package/dist/commands/deploy.js
CHANGED
|
@@ -11,10 +11,13 @@ const errors_1 = require("../lib/errors");
|
|
|
11
11
|
const exit_guard_1 = require("../lib/exit-guard");
|
|
12
12
|
const pack_source_1 = require("../lib/pack-source");
|
|
13
13
|
const pack_prebuilt_1 = require("../lib/pack-prebuilt");
|
|
14
|
+
const project_setup_1 = require("../lib/project-setup");
|
|
15
|
+
const theme_schema_export_1 = require("../lib/theme-schema-export");
|
|
14
16
|
class Deploy extends base_command_1.BaseCommand {
|
|
15
17
|
async run() {
|
|
16
|
-
this.requireStore();
|
|
17
18
|
const dir = node_path_1.default.resolve(this.getFlag("dir"));
|
|
19
|
+
this.requireStore(dir);
|
|
20
|
+
const storeThemeId = this.getFlag("theme") ?? (0, project_setup_1.projectStoreThemeId)(dir);
|
|
18
21
|
const prebuilt = this.getFlag("prebuilt") ?? false;
|
|
19
22
|
const pack = prebuilt
|
|
20
23
|
? async (d) => {
|
|
@@ -29,7 +32,10 @@ class Deploy extends base_command_1.BaseCommand {
|
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
31
34
|
const quiet = this.getFlag("quiet") ?? false;
|
|
35
|
+
const settingsSchema = await (0, theme_schema_export_1.exportThemeSchema)(dir);
|
|
32
36
|
const result = await (0, exit_guard_1.untilSettled)((0, deployments_1.deploy)(dir, {
|
|
37
|
+
storeThemeId,
|
|
38
|
+
settingsSchema,
|
|
33
39
|
client: this.apiClient,
|
|
34
40
|
pack,
|
|
35
41
|
artifact: prebuilt ? "prebuilt" : "source",
|
|
@@ -39,8 +45,12 @@ class Deploy extends base_command_1.BaseCommand {
|
|
|
39
45
|
process.stderr.write(text);
|
|
40
46
|
},
|
|
41
47
|
liveLogs: !quiet && Boolean(process.stderr.isTTY),
|
|
48
|
+
debug: this.getFlag("debug") ?? false,
|
|
49
|
+
tty: !quiet && Boolean(process.stderr.isTTY),
|
|
42
50
|
prod: this.getFlag("prod") ?? false,
|
|
43
51
|
}), () => {
|
|
52
|
+
if (!quiet && process.stderr.isTTY)
|
|
53
|
+
process.stderr.write("\r\x1b[2K");
|
|
44
54
|
process.stderr.write("Stopped following the deployment before it finished. It carries on: check it with ecomweb deployments, follow its log with ecomweb logs <id>.\n");
|
|
45
55
|
process.exitCode = errors_1.ExitCode.ERROR;
|
|
46
56
|
});
|
|
@@ -53,6 +63,8 @@ Deploy.examples = [
|
|
|
53
63
|
"ecomweb deploy --prod",
|
|
54
64
|
"ecomweb deploy --prebuilt",
|
|
55
65
|
"ecomweb deploy --dir ./my-storefront --quiet",
|
|
66
|
+
"ecomweb deploy --theme 12 --prod",
|
|
67
|
+
"ecomweb deploy --debug",
|
|
56
68
|
];
|
|
57
69
|
Deploy.flags = {
|
|
58
70
|
...base_command_1.BaseCommand.baseFlags,
|
|
@@ -68,6 +80,14 @@ Deploy.flags = {
|
|
|
68
80
|
description: "With --prebuilt: use the existing .next/standalone instead of running pnpm build",
|
|
69
81
|
default: false,
|
|
70
82
|
}),
|
|
83
|
+
debug: core_1.Flags.boolean({
|
|
84
|
+
description: "Show the raw build log (Docker, BuildKit and Cloud Build output) instead of the build view",
|
|
85
|
+
default: false,
|
|
86
|
+
}),
|
|
87
|
+
theme: core_1.Flags.string({
|
|
88
|
+
description: "The code theme to deploy to (its id in the dashboard's Themes page); needed when the store has several. Also ECOMWEB_STORE_THEME_ID or storeThemeId in .ecomweb.json",
|
|
89
|
+
env: "ECOMWEB_STORE_THEME_ID",
|
|
90
|
+
}),
|
|
71
91
|
prod: core_1.Flags.boolean({
|
|
72
92
|
description: "Promote to production once built (the store keeps its current version if the new one never gets ready: exit 6)",
|
|
73
93
|
default: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;;;AAAA,0DAA6B;AAC7B,sCAAoC;AACpC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AM,CAAC,CAAC;IAC1B,CAAC;;AAtFM,kBAAW,GAChB,iIAAiI,CAAC;AAE7H,eAAQ,GAAG;IAChB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,8CAA8C;IAC9C,kCAAkC;IAClC,wBAAwB;CACzB,CAAC;AAEK,YAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,GAAG,EAAE,YAAK,CAAC,MAAM,CAAC;QAChB,WAAW,EAAE,kCAAkC;QAC/C,OAAO,EAAE,GAAG;KACb,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,OAAO,CAAC;QACtB,WAAW,EAAE,2GAA2G;QACxH,OAAO,EAAE,KAAK;KACf,CAAC;IACF,YAAY,EAAE,YAAK,CAAC,OAAO,CAAC;QAC1B,WAAW,EAAE,kFAAkF;QAC/F,OAAO,EAAE,KAAK;KACf,CAAC;IACF,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,WAAW,EAAE,4FAA4F;QACzG,OAAO,EAAE,KAAK;KACf,CAAC;IACF,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,sKAAsK;QACnL,GAAG,EAAE,wBAAwB;KAC9B,CAAC;IACF,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC;QAClB,WAAW,EAAE,gHAAgH;QAC7H,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC;kBAvCiB,MAAM"}
|
package/dist/commands/logs.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export default class Logs extends BaseCommand {
|
|
|
6
6
|
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
|
+
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
11
|
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
package/dist/commands/logs.js
CHANGED
|
@@ -9,7 +9,10 @@ class Logs extends base_command_1.BaseCommand {
|
|
|
9
9
|
async run() {
|
|
10
10
|
this.requireStore();
|
|
11
11
|
const { args } = await this.parse(Logs);
|
|
12
|
-
const
|
|
12
|
+
const raw = this.getFlag("debug") ?? false;
|
|
13
|
+
const view = raw ? null : (0, deployments_1.buildView)((t) => process.stdout.write(t), Boolean(process.stdout.isTTY));
|
|
14
|
+
const status = await (0, exit_guard_1.untilSettled)((0, deployments_1.followLogs)(this.apiClient, args.id, view ? view.onText : (text) => process.stdout.write(text)).finally(() => view?.finish()), () => {
|
|
15
|
+
view?.finish();
|
|
13
16
|
process.stderr.write(`Stopped following ${args.id} before the build finished. Run ecomweb logs ${args.id} again.\n`);
|
|
14
17
|
process.exitCode = errors_1.ExitCode.ERROR;
|
|
15
18
|
});
|
|
@@ -17,12 +20,16 @@ class Logs extends base_command_1.BaseCommand {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
Logs.description = "Print a deployment's build log, following it until the build ends (storefront hosting). Exits 5 if the build failed";
|
|
20
|
-
Logs.examples = ["ecomweb logs d_7f3k2abc"];
|
|
23
|
+
Logs.examples = ["ecomweb logs d_7f3k2abc", "ecomweb logs d_7f3k2abc --debug"];
|
|
21
24
|
Logs.args = {
|
|
22
25
|
id: core_1.Args.string({ description: "Deployment id (from ecomweb deploy)", required: true }),
|
|
23
26
|
};
|
|
24
27
|
Logs.flags = {
|
|
25
28
|
...base_command_1.BaseCommand.baseFlags,
|
|
29
|
+
debug: core_1.Flags.boolean({
|
|
30
|
+
description: "Show the raw build log (Docker, BuildKit and Cloud Build output) instead of the build view",
|
|
31
|
+
default: false,
|
|
32
|
+
}),
|
|
26
33
|
};
|
|
27
34
|
exports.default = Logs;
|
|
28
35
|
//# sourceMappingURL=logs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAC1C,kDAA8C;AAC9C,oDAA2D;AAC3D,0CAAyC;AACzC,kDAAiD;AAEjD,MAAqB,IAAK,SAAQ,0BAAW;IAkB3C,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAU,OAAO,CAAC,IAAI,KAAK,CAAC;QACpD,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,uBAAS,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAY,EAC/B,IAAA,wBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAC1G,IAAI,EAAE,MAAM,EAAE,CACf,EACD,GAAG,EAAE;YACH,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,EAAE,gDAAgD,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;YACrH,OAAO,CAAC,QAAQ,GAAG,iBAAQ,CAAC,KAAK,CAAC;QACpC,CAAC,CACF,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC;IAC7D,CAAC;;AAjCM,gBAAW,GAChB,qHAAqH,CAAC;AAEjH,aAAQ,GAAG,CAAC,yBAAyB,EAAE,iCAAiC,CAAC,CAAC;AAE1E,SAAI,GAAG;IACZ,EAAE,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CACxF,CAAC;AAEK,UAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,WAAW,EAAE,4FAA4F;QACzG,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC;kBAhBiB,IAAI"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ViewEvent } from "./build-log-view";
|
|
2
|
+
export declare function formatDuration(seconds: number): string;
|
|
3
|
+
export declare class BuildLogRenderer {
|
|
4
|
+
private readonly opts;
|
|
5
|
+
private liveLabel;
|
|
6
|
+
private readonly phaseStart;
|
|
7
|
+
private liveSince;
|
|
8
|
+
private timer;
|
|
9
|
+
private readonly now;
|
|
10
|
+
private readonly c;
|
|
11
|
+
constructor(opts: {
|
|
12
|
+
write: (text: string) => void;
|
|
13
|
+
tty: boolean;
|
|
14
|
+
now?: () => number;
|
|
15
|
+
color?: boolean;
|
|
16
|
+
});
|
|
17
|
+
elapsed(): number;
|
|
18
|
+
live(label: string): void;
|
|
19
|
+
done(label: string, detail: string): void;
|
|
20
|
+
line(text: string): void;
|
|
21
|
+
events(events: ViewEvent[]): void;
|
|
22
|
+
stop(): void;
|
|
23
|
+
private stopTicker;
|
|
24
|
+
private print;
|
|
25
|
+
private draw;
|
|
26
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BuildLogRenderer = void 0;
|
|
7
|
+
exports.formatDuration = formatDuration;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const build_log_view_1 = require("./build-log-view");
|
|
10
|
+
const WITH_OUTPUT = new Set(["install", "app"]);
|
|
11
|
+
function formatDuration(seconds) {
|
|
12
|
+
if (seconds < 10)
|
|
13
|
+
return `${(Math.floor(seconds * 10) / 10).toFixed(1)}s`;
|
|
14
|
+
if (seconds < 60)
|
|
15
|
+
return `${Math.round(seconds)}s`;
|
|
16
|
+
const s = Math.round(seconds);
|
|
17
|
+
return `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
18
|
+
}
|
|
19
|
+
const WIDTH = 34;
|
|
20
|
+
const leader = (label) => `${label} ${".".repeat(Math.max(3, WIDTH - label.length - 1))}`;
|
|
21
|
+
class BuildLogRenderer {
|
|
22
|
+
constructor(opts) {
|
|
23
|
+
this.opts = opts;
|
|
24
|
+
this.liveLabel = null;
|
|
25
|
+
this.phaseStart = new Map();
|
|
26
|
+
this.liveSince = 0;
|
|
27
|
+
this.timer = null;
|
|
28
|
+
this.now = opts.now ?? Date.now;
|
|
29
|
+
this.c = opts.color === false ? new chalk_1.default.Instance({ level: 0 }) : chalk_1.default;
|
|
30
|
+
}
|
|
31
|
+
elapsed() {
|
|
32
|
+
return (this.now() - this.liveSince) / 1000;
|
|
33
|
+
}
|
|
34
|
+
live(label) {
|
|
35
|
+
this.liveLabel = label;
|
|
36
|
+
this.liveSince = this.now();
|
|
37
|
+
if (!this.opts.tty)
|
|
38
|
+
return;
|
|
39
|
+
this.draw();
|
|
40
|
+
if (!this.timer) {
|
|
41
|
+
this.timer = setInterval(() => this.draw(), 1000);
|
|
42
|
+
this.timer.unref?.();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
done(label, detail) {
|
|
46
|
+
this.stopTicker();
|
|
47
|
+
this.print(`${leader(label)} ${this.c.dim(detail)}`);
|
|
48
|
+
}
|
|
49
|
+
line(text) {
|
|
50
|
+
this.print(text);
|
|
51
|
+
}
|
|
52
|
+
events(events) {
|
|
53
|
+
for (const e of events) {
|
|
54
|
+
if (e.kind === "machine")
|
|
55
|
+
this.print(`Building on ${e.label}`);
|
|
56
|
+
else if (e.kind === "start") {
|
|
57
|
+
this.phaseStart.set(e.phase, this.now());
|
|
58
|
+
if (WITH_OUTPUT.has(e.phase))
|
|
59
|
+
this.print(` ${build_log_view_1.PHASE_LABEL[e.phase]}`);
|
|
60
|
+
this.live(` ${build_log_view_1.PHASE_LABEL[e.phase]}`);
|
|
61
|
+
}
|
|
62
|
+
else if (e.kind === "output")
|
|
63
|
+
this.print(` ${e.line}`);
|
|
64
|
+
else if (e.kind === "end") {
|
|
65
|
+
this.stopTicker();
|
|
66
|
+
const since = this.phaseStart.has(e.phase) ? (this.now() - this.phaseStart.get(e.phase)) / 1000 : 0;
|
|
67
|
+
const seconds = e.seconds ?? (since >= 0.5 ? since : undefined);
|
|
68
|
+
const detail = e.cached ? "cached" : seconds !== undefined ? formatDuration(seconds) : "";
|
|
69
|
+
this.print(` ${this.c.green("✓")} ${leader(build_log_view_1.PHASE_LABEL[e.phase])}${detail ? ` ${this.c.dim(detail)}` : ""}`.trimEnd());
|
|
70
|
+
}
|
|
71
|
+
else if (e.kind === "failed") {
|
|
72
|
+
this.stopTicker();
|
|
73
|
+
const what = e.phase ? `${build_log_view_1.PHASE_LABEL[e.phase]} failed` : "Build failed";
|
|
74
|
+
this.print(` ${this.c.red("✗")} ${what}: ${e.line}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
stop() {
|
|
79
|
+
this.stopTicker();
|
|
80
|
+
if (this.opts.tty)
|
|
81
|
+
this.opts.write("\r\x1b[2K");
|
|
82
|
+
}
|
|
83
|
+
stopTicker() {
|
|
84
|
+
if (this.timer)
|
|
85
|
+
clearInterval(this.timer);
|
|
86
|
+
this.timer = null;
|
|
87
|
+
this.liveLabel = null;
|
|
88
|
+
}
|
|
89
|
+
print(text) {
|
|
90
|
+
this.opts.write(`${this.opts.tty ? "\r\x1b[2K" : ""}${text}\n`);
|
|
91
|
+
if (this.opts.tty && this.liveLabel)
|
|
92
|
+
this.draw();
|
|
93
|
+
}
|
|
94
|
+
draw() {
|
|
95
|
+
if (!this.liveLabel)
|
|
96
|
+
return;
|
|
97
|
+
const s = Math.floor(this.elapsed());
|
|
98
|
+
const clock = `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
99
|
+
this.opts.write(`\r\x1b[2K${this.liveLabel} ${this.c.dim(clock)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.BuildLogRenderer = BuildLogRenderer;
|
|
103
|
+
//# sourceMappingURL=build-log-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-log-render.js","sourceRoot":"","sources":["../../src/lib/build-log-render.ts"],"names":[],"mappings":";;;;;;AAMA,wCAKC;AAXD,kDAA0B;AAC1B,qDAA2E;AAG3E,MAAM,WAAW,GAAuB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE,SAAgB,cAAc,CAAC,OAAe;IAC5C,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1E,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OA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I,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;CACF;AApFD,4CAoFC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type Phase = "install" | "app" | "package" | "upload";
|
|
2
|
+
export declare const PHASE_LABEL: Record<Phase, string>;
|
|
3
|
+
export type ViewEvent = {
|
|
4
|
+
kind: "machine";
|
|
5
|
+
label: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "start";
|
|
8
|
+
phase: Phase;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "end";
|
|
11
|
+
phase: Phase;
|
|
12
|
+
seconds?: number;
|
|
13
|
+
cached?: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "output";
|
|
16
|
+
phase: Phase;
|
|
17
|
+
line: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "failed";
|
|
20
|
+
phase?: Phase;
|
|
21
|
+
line: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function machineLabel(name: string): string;
|
|
24
|
+
export declare class BuildLogView {
|
|
25
|
+
private partial;
|
|
26
|
+
private readonly steps;
|
|
27
|
+
private readonly started;
|
|
28
|
+
private readonly ended;
|
|
29
|
+
private onceSeen;
|
|
30
|
+
private failedOnce;
|
|
31
|
+
feed(chunk: string): ViewEvent[];
|
|
32
|
+
end(): ViewEvent[];
|
|
33
|
+
private start;
|
|
34
|
+
private finish;
|
|
35
|
+
private fail;
|
|
36
|
+
private line;
|
|
37
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildLogView = exports.PHASE_LABEL = void 0;
|
|
4
|
+
exports.machineLabel = machineLabel;
|
|
5
|
+
exports.PHASE_LABEL = {
|
|
6
|
+
install: "Installing dependencies",
|
|
7
|
+
app: "Building app",
|
|
8
|
+
package: "Packaging image",
|
|
9
|
+
upload: "Uploading image",
|
|
10
|
+
};
|
|
11
|
+
const VCPU = { default: 2, E2_MEDIUM: 1, E2_HIGHCPU_8: 8, E2_HIGHCPU_32: 32, N1_HIGHCPU_8: 8, N1_HIGHCPU_32: 32 };
|
|
12
|
+
function machineLabel(name) {
|
|
13
|
+
if (name === "cluster")
|
|
14
|
+
return "the build server";
|
|
15
|
+
const type = name.startsWith("cloudbuild:") ? name.slice("cloudbuild:".length) : name;
|
|
16
|
+
return VCPU[type] ? `Cloud Build (${VCPU[type]} vCPU)` : `Cloud Build (${type})`;
|
|
17
|
+
}
|
|
18
|
+
const CLOUD_STEP = /^Step #\d+ - "([\w-]+)": ?(.*)$/;
|
|
19
|
+
const CLOUD_MARK = /^(Starting|Finished) Step #\d+ - "([\w-]+)"$/;
|
|
20
|
+
const BUILDKIT = /^#(\d+) (.*)$/;
|
|
21
|
+
const HEADER = /^\[[\w-]+(?: \d+\/\d+)?\] (.*)$/;
|
|
22
|
+
const ELAPSED = /^\d+(?:\.\d+)? ?(.*)$/;
|
|
23
|
+
const NOISE = [
|
|
24
|
+
/^Progress: /,
|
|
25
|
+
/^\+{3,}/,
|
|
26
|
+
/^\+ \S+ \S+$/,
|
|
27
|
+
/^(dev)?[dD]ependencies:$/,
|
|
28
|
+
/[╭╮╰╯│]/,
|
|
29
|
+
/^\.\.\.\/.* (install|postinstall)(\$ |: Done)/,
|
|
30
|
+
/^\? Verifying lockfile/,
|
|
31
|
+
/^\s*$/,
|
|
32
|
+
];
|
|
33
|
+
const ONCE = /\[baseline-browser-mapping\]/;
|
|
34
|
+
class BuildLogView {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.partial = "";
|
|
37
|
+
this.steps = new Map();
|
|
38
|
+
this.started = new Set();
|
|
39
|
+
this.ended = new Set();
|
|
40
|
+
this.onceSeen = false;
|
|
41
|
+
this.failedOnce = false;
|
|
42
|
+
}
|
|
43
|
+
feed(chunk) {
|
|
44
|
+
const text = this.partial + chunk;
|
|
45
|
+
const lines = text.split("\n");
|
|
46
|
+
this.partial = lines.pop() ?? "";
|
|
47
|
+
return lines.flatMap((l) => this.line(l.replace(/\r$/, "")));
|
|
48
|
+
}
|
|
49
|
+
end() {
|
|
50
|
+
const rest = this.partial;
|
|
51
|
+
this.partial = "";
|
|
52
|
+
return rest ? this.line(rest) : [];
|
|
53
|
+
}
|
|
54
|
+
start(phase) {
|
|
55
|
+
if (this.started.has(phase))
|
|
56
|
+
return [];
|
|
57
|
+
this.started.add(phase);
|
|
58
|
+
return [{ kind: "start", phase }];
|
|
59
|
+
}
|
|
60
|
+
finish(phase, extra = {}) {
|
|
61
|
+
if (this.ended.has(phase))
|
|
62
|
+
return [];
|
|
63
|
+
this.ended.add(phase);
|
|
64
|
+
return [...this.start(phase), { kind: "end", phase, ...extra }];
|
|
65
|
+
}
|
|
66
|
+
fail(phase, line) {
|
|
67
|
+
if (this.failedOnce)
|
|
68
|
+
return [];
|
|
69
|
+
this.failedOnce = true;
|
|
70
|
+
return [{ kind: "failed", ...(phase && { phase }), line }];
|
|
71
|
+
}
|
|
72
|
+
line(raw) {
|
|
73
|
+
const mark = CLOUD_MARK.exec(raw);
|
|
74
|
+
if (mark) {
|
|
75
|
+
if (mark[2] !== "upload")
|
|
76
|
+
return [];
|
|
77
|
+
return mark[1] === "Starting" ? this.start("upload") : this.finish("upload");
|
|
78
|
+
}
|
|
79
|
+
const step = CLOUD_STEP.exec(raw);
|
|
80
|
+
const text = step ? step[2] : raw;
|
|
81
|
+
const machine = /^ecomweb: building on (\S+)$/.exec(text);
|
|
82
|
+
if (machine)
|
|
83
|
+
return [{ kind: "machine", label: machineLabel(machine[1]) }];
|
|
84
|
+
if (text === "image uploaded")
|
|
85
|
+
return this.finish("upload");
|
|
86
|
+
const ours = /^(unpack|upload) failed: .+$/.exec(text);
|
|
87
|
+
if (ours)
|
|
88
|
+
return this.fail(ours[1] === "upload" ? "upload" : undefined, text);
|
|
89
|
+
const solve = /^(?:ERROR|error): (failed to solve: .*)$/.exec(text);
|
|
90
|
+
if (solve)
|
|
91
|
+
return this.fail(undefined, solve[1]);
|
|
92
|
+
const bk = BUILDKIT.exec(text);
|
|
93
|
+
if (!bk)
|
|
94
|
+
return [];
|
|
95
|
+
const [, n, rest] = bk;
|
|
96
|
+
const header = HEADER.exec(rest);
|
|
97
|
+
if (header) {
|
|
98
|
+
const phase = /^RUN pnpm install\b/.test(header[1]) ? "install" : /^RUN pnpm build\b/.test(header[1]) ? "app" : null;
|
|
99
|
+
if (!this.steps.has(n))
|
|
100
|
+
this.steps.set(n, phase);
|
|
101
|
+
return phase ? this.start(phase) : [];
|
|
102
|
+
}
|
|
103
|
+
if (/^exporting to /.test(rest)) {
|
|
104
|
+
this.steps.set(n, "package");
|
|
105
|
+
return this.start("package");
|
|
106
|
+
}
|
|
107
|
+
const phase = this.steps.get(n) ?? null;
|
|
108
|
+
const error = /^ERROR: (.*)$/.exec(rest);
|
|
109
|
+
if (error)
|
|
110
|
+
return this.fail(phase ?? undefined, error[1]);
|
|
111
|
+
if (!phase)
|
|
112
|
+
return [];
|
|
113
|
+
const done = /^DONE (\d+(?:\.\d+)?)s$/.exec(rest);
|
|
114
|
+
if (done)
|
|
115
|
+
return this.finish(phase, { seconds: Number(done[1]) });
|
|
116
|
+
if (rest === "CACHED")
|
|
117
|
+
return this.finish(phase, { cached: true });
|
|
118
|
+
if (phase === "package")
|
|
119
|
+
return [];
|
|
120
|
+
const out = ELAPSED.exec(rest);
|
|
121
|
+
if (!out)
|
|
122
|
+
return [];
|
|
123
|
+
const line = out[1];
|
|
124
|
+
if (NOISE.some((r) => r.test(line)))
|
|
125
|
+
return [];
|
|
126
|
+
if (ONCE.test(line)) {
|
|
127
|
+
if (this.onceSeen)
|
|
128
|
+
return [];
|
|
129
|
+
this.onceSeen = true;
|
|
130
|
+
}
|
|
131
|
+
return [{ kind: "output", phase, line }];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.BuildLogView = BuildLogView;
|
|
135
|
+
//# sourceMappingURL=build-log-view.js.map
|
|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C;QAC/C,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAzFD,oCAyFC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PackedSource } from "./pack-source";
|
|
2
|
+
import { BuildLogRenderer } from "./build-log-render";
|
|
2
3
|
export type DeploymentStatus = "uploading" | "queued" | "building" | "built" | "running" | "stopped" | "failed";
|
|
3
4
|
export interface DeploymentView {
|
|
4
5
|
id: string;
|
|
@@ -38,6 +39,10 @@ export interface DeployDeps {
|
|
|
38
39
|
previewTimeoutMs?: number;
|
|
39
40
|
prod?: boolean;
|
|
40
41
|
artifact?: "source" | "prebuilt";
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
tty?: boolean;
|
|
44
|
+
storeThemeId?: string;
|
|
45
|
+
settingsSchema?: unknown;
|
|
41
46
|
}
|
|
42
47
|
export declare function hostingError(error: unknown): unknown;
|
|
43
48
|
export declare function uploadSource(url: string, packed: PackedSource): Promise<void>;
|
|
@@ -50,6 +55,13 @@ export declare function followLogs(client: HostingClient, id: string, onText: (t
|
|
|
50
55
|
sleep?: (ms: number) => Promise<void>;
|
|
51
56
|
maxRetries?: number;
|
|
52
57
|
}): Promise<DeploymentStatus>;
|
|
58
|
+
export declare function buildView(write: (t: string) => void, tty: boolean, now?: () => number): {
|
|
59
|
+
renderer: BuildLogRenderer;
|
|
60
|
+
onText: (text: string) => void;
|
|
61
|
+
finish: () => void;
|
|
62
|
+
shown: () => boolean;
|
|
63
|
+
failed: () => boolean;
|
|
64
|
+
};
|
|
53
65
|
export declare function deploy(dir: string, deps: DeployDeps): Promise<DeployResult>;
|
|
54
66
|
export declare function promote(client: HostingClient, id: string, opts: {
|
|
55
67
|
wait: boolean;
|