@faable/faable 4.21.1 → 4.22.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.
@@ -31,6 +31,19 @@ const retry_of = (deployment) => {
31
31
  * was about to succeed (backlog §379).
32
32
  */
33
33
  const TAIL_CHARS = 200;
34
+ /**
35
+ * The build's warnings, after its log (api `deployment.build_warnings`). The
36
+ * same lines are in the log above, but scrolled away among hundreds of npm
37
+ * lines; a deploy that ends READY is exactly the one nobody scrolls back on.
38
+ */
39
+ const format_build_warnings = (warnings) => {
40
+ if (!warnings?.length)
41
+ return '';
42
+ const n = warnings.length;
43
+ return (`\n⚠️ ${n} build warning${n === 1 ? '' : 's'} — the build worked around ${n === 1 ? 'this' : 'these'}; fix ${n === 1 ? 'it' : 'them'} so it does not have to:\n` +
44
+ warnings.map(w => ` • ${w.message}\n`).join('') +
45
+ '\n');
46
+ };
34
47
  /**
35
48
  * The part of `content` not shown yet, given how much was `printed` and the
36
49
  * last characters of it (`seen_tail`).
@@ -111,11 +124,18 @@ out = process.stdout) => {
111
124
  // already live (READY) — the promotion poll takes over from here.
112
125
  if (phase === 'INITIALIZING' || phase === 'READY') {
113
126
  await tail_logs();
114
- return { id: deployment_id };
127
+ const build_warnings = deployment?.build_warnings;
128
+ const summary = format_build_warnings(build_warnings);
129
+ if (summary)
130
+ out.write(summary);
131
+ return {
132
+ id: deployment_id,
133
+ ...(build_warnings?.length ? { build_warnings } : {})
134
+ };
115
135
  }
116
136
  await wait(POLL_INTERVAL_MS);
117
137
  }
118
138
  throw new Error('Timed out waiting for the remote build. Check the dashboard for its status.');
119
139
  };
120
140
 
121
- export { follow_remote_build, unseen };
141
+ export { follow_remote_build, format_build_warnings, unseen };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/faable",
3
- "version": "4.21.1",
3
+ "version": "4.22.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Marc Pomar <marc@faable.com>",