File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ */
117import readline from "readline" ;
218import { exec } from "child_process" ;
319import fs from "fs" ;
You can’t perform that action at this time.
0 commit comments