Do you want to build a build tool?
summary
Explains step‑by‑step how to read .ts files with Node fs and path, parse them with TypeScript’s createSourceFile into an AST, query and mutate calls with TS Query, generate a new function via ts-template (example: wrap every doPhysics(lat,long,alt) call with doMagic and add a doMagic that sets molecule.temperature = -10), print with TypeScript printer and overwrite files on disk — a working end‑to‑end codegen/transformation pipeline.
AI-written summary · about
chapters (6)
- 0:00Introduction to magic
- 5:28Reading and writing files
- 13:03Abstract syntax trees
- 20:32Modifying source code
- 25:41Putting it all together
- 27:47Summary and tools
related talks
31mDo You Want to Build a Build Tool?
24mStatic Analysis and Source Code Manipulation in TypeScript
24mTypeScript - You'll Like It
50mTypeScript for C++ programmers
46mThe “Perfect” JS Library Tooling
34mGenerating Types without climbing a tree
36mLet Your Angular Code Write Itself
59m4 Steps from JavaScript to TypeScript
