@n6k.io/build 0.0.1 → 0.0.3
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/package.json +2 -2
- package/src/util/logger.ts +6 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n6k.io/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Static build pipeline (.mdx + ts/tsx/js/jsx → esbuild bundle → HTML) for n6k apps",
|
|
6
6
|
"homepage": "https://github.com/n6k-io/build#readme",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@eslint/js": "^10.0.1",
|
|
84
|
-
"@n6k.io/db": "
|
|
84
|
+
"@n6k.io/db": "^0.5.0",
|
|
85
85
|
"@storybook/react": "^10.4.4",
|
|
86
86
|
"@tanstack/react-query": "^5.101.0",
|
|
87
87
|
"@types/bun": "latest",
|
package/src/util/logger.ts
CHANGED
|
@@ -11,31 +11,14 @@ export function initLogger(debug: boolean) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// pino
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
typeof l === "object" &&
|
|
21
|
-
l !== null &&
|
|
22
|
-
"stream" in l &&
|
|
23
|
-
typeof l.stream === "object" &&
|
|
24
|
-
l.stream !== null &&
|
|
25
|
-
"end" in l.stream &&
|
|
26
|
-
typeof l.stream.end === "function"
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
14
|
+
// Drain pino's buffered logs before the process exits. pino keeps its output
|
|
15
|
+
// stream on an internal Symbol (not a public `.stream` property), so there is
|
|
16
|
+
// nothing to `.end()` directly — `logger.flush(cb)` is the supported drain: it
|
|
17
|
+
// invokes the callback once the underlying stream (including the pino-pretty
|
|
18
|
+
// worker thread) has flushed.
|
|
30
19
|
export function flushLogger(): Promise<void> {
|
|
31
20
|
return new Promise((resolve) => {
|
|
32
|
-
logger.flush(() =>
|
|
33
|
-
if (hasFlushableStream(logger)) {
|
|
34
|
-
logger.stream.end(() => resolve());
|
|
35
|
-
} else {
|
|
36
|
-
resolve();
|
|
37
|
-
}
|
|
38
|
-
});
|
|
21
|
+
logger.flush(() => resolve());
|
|
39
22
|
});
|
|
40
23
|
}
|
|
41
24
|
|