Skip to content

Commit bd5a290

Browse files
committed
q
1 parent dfcfd34 commit bd5a290

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

transpile_pipe.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* This script acts as a post-processor for the transpilation process.
3+
* It is intended to be used in a pipe, typically following `transpile.ts`.
4+
*
5+
* Workflow:
6+
* 1. Listens to `stdin` for lines matching the pattern "transpiled [file].ts".
7+
* 2. When a match is found, it identifies the corresponding generated ".js" file.
8+
* 3. Checks if the ".js" file exists on the filesystem.
9+
* 4. If it exists, it triggers `prettier` to format the generated JavaScript file
10+
* using the project's configuration (prettier.config.cjs).
11+
* 5. Logs the original stdin line (prefixed with "stdin: ") and reports successful
12+
* formatting (prefixed with "frmtd: ") or any errors encountered.
13+
*
14+
* Usage example:
15+
* node transpile.ts --watch | node transpile_pipe.ts
16+
*/
117
import readline from "readline";
218
import { exec } from "child_process";
319
import fs from "fs";

0 commit comments

Comments
 (0)