question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a monorepo template?

See original GitHub issue

Current Behavior

Currently, users can scaffold out a monorepo manually, then add tsdx as a dependency at the root of the project.

Desired Behavior

Users should be able to scaffold out a monorepo project using npx tsdx create. Just like the current templates, users could pass a flag or select from the interactive prompt.

Suggested Solution

Create two new templates, monorepo-basic and monorepo-react. In both cases, the only additional dependency would be lerna. The root package.json scripts would use lerna run command and any packages would use tsdx command.

  1. Add these options directly to the create template prompt and add CLI flags for each.

  2. Add an additional prompt to the create command which allows you to select a project structure (basic or monorepo?) and add a —monorepo CLI flag which will automatically resolve the monorepo templates.

Who does this impact? Who is this for?

This feature would be very beneficial for anyone managing a larger project who wishes to leverage both tsdx and lerna.

Describe alternatives you’ve considered

If this use case seems out of scope, improving the documentation around integrating with lerna would be helpful to guide users through manual setup.

As a possible alternative, tsdx could become monorepo-aware so that running npx tsdx create mylib from within a monorepo could scaffold out a new package in the packages/ (or configured in lerna.json) directory.

Additional context

I have created a minimal tsdx-monorepo example project.

I would be happy to contribute to this feature, but I want to collect feedback and hash out the preferred approach before starting.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:46
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
jaredpalmercommented, Dec 10, 2019

Update: I just moved formik into a monorepo powered by tsdx (with both React native and react packages). Should be a good test bed. We DEF want to bake this in because it was huge pain to setup with VSCode.

7reactions
mwargercommented, Mar 3, 2020

@jaredpalmer - any updates on the baked-in monorepo setup? Interested to see what you encountered… Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sample monorepo setup with npm workspaces and ... - GitHub
Sample monorepo setup with npm workspaces and typescript project references ... Adding new packages is as simple as dropping an existing package in...
Read more >
Working with monorepos - Expo Documentation
In this example, we will set up a monorepo using yarn workspaces without the nohoist option. We will assume some familiar names, but...
Read more >
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 >
Setting up a monorepo with Lerna for a TypeScript project
To install necessary dependencies from npm, or link ones from the monorepo, use the lerna add command from the root of the project....
Read more >
Monorepos in Git | Atlassian Git Tutorial
Facebook has one such example of a monorepo: ... Add together many unrelated modules found in a monorepo and the performance issues compound....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found