@webtypen/webframez-core 0.3.41 → 0.3.42

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.
@@ -54,6 +54,8 @@ export declare class BuildApplication {
54
54
  private readonly buildId;
55
55
  constructor(projectRoot: string, config: WebframezAppConfig, options: BuildApplicationOptions);
56
56
  run(): Promise<void>;
57
+ private logBuildStep;
58
+ private runStep;
57
59
  private createContext;
58
60
  private callHook;
59
61
  private runTypescriptBuild;
@@ -20,6 +20,9 @@ const node_child_process_1 = require("node:child_process");
20
20
  function timestamp() {
21
21
  return new Date().toISOString().replace(/[-:TZ.]/g, "");
22
22
  }
23
+ function logTimestamp() {
24
+ return new Date().toISOString();
25
+ }
23
26
  function normalizePackageWebframezPlugins(value) {
24
27
  if (!value) {
25
28
  return [];
@@ -52,19 +55,21 @@ class BuildApplication {
52
55
  return __awaiter(this, void 0, void 0, function* () {
53
56
  const context = this.createContext();
54
57
  const plugins = this.loadPlugins();
58
+ const startedAt = Date.now();
59
+ this.logBuildStep("start", `outDir=${this.outDir}`);
55
60
  yield promises_1.default.rm(this.stagingDir, { recursive: true, force: true });
56
61
  yield promises_1.default.mkdir(this.stagingDir, { recursive: true });
57
62
  try {
58
63
  yield this.callHook(plugins, "beforeBuild", context);
59
- yield this.runTypescriptBuild(context);
64
+ yield this.runStep("typescript", () => this.runTypescriptBuild(context));
60
65
  yield this.callHook(plugins, "afterTypescriptBuild", context);
61
- yield this.copyRuntimeFiles();
66
+ yield this.runStep("runtime files", () => this.copyRuntimeFiles());
62
67
  yield this.callHook(plugins, "afterRuntimeFilesCopied", context);
63
68
  yield this.callHook(plugins, "buildAssets", context);
64
- yield this.validateCoreBuild();
69
+ yield this.runStep("core validation", () => this.validateCoreBuild());
65
70
  yield this.callHook(plugins, "validateBuild", context);
66
- yield this.promoteBuild();
67
- console.log(`[webframez] Build ready: ${node_path_1.default.relative(this.projectRoot, this.outDir) || this.outDir}`);
71
+ yield this.runStep("promote", () => this.promoteBuild());
72
+ console.log(`[webframez] Build ready: ${node_path_1.default.relative(this.projectRoot, this.outDir) || this.outDir} (${Math.round((Date.now() - startedAt) / 1000)}s)`);
68
73
  }
69
74
  catch (error) {
70
75
  yield promises_1.default.rm(this.stagingDir, { recursive: true, force: true });
@@ -72,6 +77,24 @@ class BuildApplication {
72
77
  }
73
78
  });
74
79
  }
80
+ logBuildStep(label, details = "") {
81
+ console.log(`[webframez] [${logTimestamp()}] ${label}${details ? `: ${details}` : ""}`);
82
+ }
83
+ runStep(label, callback) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const startedAt = Date.now();
86
+ this.logBuildStep(`${label}:start`);
87
+ try {
88
+ const result = yield callback();
89
+ this.logBuildStep(`${label}:done`, `${Math.round((Date.now() - startedAt) / 1000)}s`);
90
+ return result;
91
+ }
92
+ catch (error) {
93
+ this.logBuildStep(`${label}:failed`, `${Math.round((Date.now() - startedAt) / 1000)}s`);
94
+ throw error;
95
+ }
96
+ });
97
+ }
75
98
  createContext() {
76
99
  return {
77
100
  projectRoot: this.projectRoot,
@@ -236,7 +259,13 @@ class BuildApplication {
236
259
  env: Object.assign(Object.assign({}, process.env), envAdditions),
237
260
  });
238
261
  child.on("error", reject);
239
- child.on("close", (code) => resolve(code || 0));
262
+ child.on("close", (code, signal) => {
263
+ if (signal) {
264
+ reject(new Error(`${binaryName} exited with signal ${signal}`));
265
+ return;
266
+ }
267
+ resolve(code !== null && code !== void 0 ? code : 0);
268
+ });
240
269
  });
241
270
  }
242
271
  resolveBinary(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.41",
3
+ "version": "0.3.42",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",