MCPcopy Index your code
hub / github.com/Bnaya/typescript-monorepo-toolkit

github.com/Bnaya/typescript-monorepo-toolkit @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
19 symbols 60 edges 6 files 0 documented · 0% updated 3y ago★ 382 open issues

Browse by type

Functions 17 Types & classes 2
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

typescript-monorepo-toolkit

CLI tool to automatically setup typescript project references for yarn workspaces monorepos and other tasks

It can inject the appropriate tsconfig.references for all of the packages in a yarn workspace, and also help you change rootDir and outDir across all of the packages

Background / Motivation:

How to use

npx typescript-monorepo-toolkit inject-refs ../path-to/yarn-project-root

For debug info

DEBUG=typescript-monorepo-toolkit npx typescript-monorepo-toolkit inject-refs ../path-to/yarn-project-root

```sh Usage: [options] [command]

Options: -V, --version output the version number -p, --tsconfig-path Use alterative config path inside the package. eg: test/tsconfig.json (default: "tsconfig.json") -h, --help output usage information

Commands: inject-refs [options] Inject the appropriate tsconfig references based on yarn workspaces dependency graph set-outDir [newOutDir] Set the compilerOptions.outDir in all of the packages. omit new value to delete set-rootDir [newRootDir] Set the compilerOptions.rootDir in all of the packages. omit new value to delete set-extend [extendedTsconfigPath] Set the extends entry in all of the tsconfigs. omit new value to delete ```

How does it work

yarn workspaces info command has all the info we need.

The tsconfig.json manipulation is done using recast, as tsconfig.json is not really JSON, so we can keep the comments. Unfortunately recast changes some of the formatting of the file.

This tool might break your tsconfigs Please run this tool on a clean git state, and inspect the diff

Future possible improvements

  • Become obsolete when #25376 is fixed
  • Find a good name
  • Support tsconfig.test.json and similar patterns
  • Support lerna/other monorepo tools that can provider us with the dependency graph

Need TypeScript/JavaScript help with your open-source project? Feel free to contact me directly!

Need TypeScript/JavaScript help in your company? I'm available for consultation :)

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 17
Interface 2

Languages

TypeScript100%

Modules by API surface

src/helpers.ts16 symbols
src/index.ts1 symbols
src/commands.ts1 symbols
src/assertNonNull.ts1 symbols

For agents

$ claude mcp add typescript-monorepo-toolkit \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page