@cslug/cli 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cslug/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "The cslug command: generators, dev server, start supervisor, REPL.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "cslug": "src/bin.ts"
32
32
  },
33
33
  "peerDependencies": {
34
- "@cslug/core": "0.1.0"
34
+ "@cslug/core": "0.2.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@cslug/database": "workspace:*",
package/src/config.ts CHANGED
@@ -9,4 +9,5 @@ export type CslugConfig = {
9
9
  /** Seconds a child gets to finish after SIGTERM before it is killed (default 30). */
10
10
  shutdownTimeout?: number
11
11
  }
12
+ /** Typed helper for `cslug.config.ts`: `export default defineCslugConfig({ … })`. */
12
13
  export const defineCslugConfig = (config: CslugConfig): CslugConfig => config
package/src/supervisor.ts CHANGED
@@ -127,8 +127,10 @@ export class Supervisor {
127
127
  private async pipe(stream: ReadableStream<Uint8Array>, name: string, out: NodeJS.WriteStream): Promise<void> {
128
128
  const decoder = new TextDecoder()
129
129
  let buffer = ''
130
- for await (const chunk of stream) {
131
- buffer += decoder.decode(chunk, { stream: true })
130
+ // a reader, not `for await`: the app's tsconfig may use the DOM lib, whose ReadableStream is not async-iterable
131
+ const reader = stream.getReader()
132
+ for (let r = await reader.read(); !r.done; r = await reader.read()) {
133
+ buffer += decoder.decode(r.value, { stream: true })
132
134
  const lines = buffer.split('\n')
133
135
  buffer = lines.pop() ?? ''
134
136
  for (const line of lines) out.write(`[${name}] ${line}\n`)