Infer project references from common monorepo patterns / tools
See original GitHub issueGenesis: see section “Repetitive configuration” in https://github.com/Microsoft/TypeScript/issues/3469#issuecomment-400439520
Search Terms
monorepo infer project references automatically yarn lerna workspace package.json
Suggestion
For common monorepo managers, we should natively understand cross-project references declared in package.json
as if they were declared in tsconfig.json
Open questions:
- Which formats (lerna, yarn, pnpm, etc) would be supported? Can all of them be consistently detected, or would you need to opt in to a specific “monorepo format” to enable a specific resolution algorithm?
- How do we find the
tsconfig.json
file? This data is actually not present in the current (non-tsconfig) dependency graph. We could assume it to be in the package root; what if it’s elsewhere? - Would you need to opt in? Would there be a way to opt out? What should that look like?
Use Cases
- Monorepos of all (supportable) flavors
Examples
https://github.com/RyanCavanaugh/learn-a
This repo has a fair bit of duplication where projects need to write down their dependencies in package.json and as references (with different syntax) in tsconfig.json
.
Checklist
My suggestion meets these guidelines:
- This wouldn’t be a breaking change in existing TypeScript / JavaScript code
- This wouldn’t change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn’t a runtime feature (e.g. new expression-level syntax)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:183
- Comments:55 (22 by maintainers)
Top Results From Across the Web
11 Great Tools for a Monorepo in 2021 | Bits and Pieces
Best tools to build a monorepo. Develop, build, and publish packages, and scale development. Discover Lerna, Nx, Rush, Bit, Yarn Workspaces, and more....
Read more >Typescript-monorepo-toolkit NPM | npm.io
typescript-monorepo-toolkit. CLI tool to automatically setup typescript project references for yarn workspaces monorepos and other tasks.
Read more >How to set up a TypeScript monorepo and make Go ... - Medium
`references` are not inherited in `tsconfig. · NiGhTTraX/ts-monorepo · Infer project references from common monorepo patterns / tools · Issue # ...
Read more >The Ultimate Guide to TypeScript Monorepos
TypeScript project references have chiefly been developed to help address the ... monorepo have taken advantage of common JavaScript tools, ...
Read more >Search: Project infer - Sudo null
https://www.microsoft.com/en-us/research/project/infernet/. Infer.NET is a . ... Infer project references from common monorepo patterns / tools.
Read more >Top Related Medium Post
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in the process of writing an apology to the community (for a number of things) accompanying a revert of the license changes. I have been suffering a low-grade anxiety attack almost all day long. I appreciate your patience.
Due to the most common monorepo tool effectively blocking our use of it [1], I don’t think we’ll be able to do any work here without inviting potential legal problems.FYI @satyanadella[1] https://github.com/lerna/lerna/pull/1616
Edit: We’re back; see below.