Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Improve monorepo support #127

Closed
wants to merge 3 commits into from

Conversation

natemoo-re
Copy link
Contributor

Related to #122. Feedback welcome!

Goals

  • Simplify integration of new templates
    • Remove hardcoded template references in src/index.ts
  • Introduce project structures (basic, monorepo)
  • Prompt tsdx create users to select project structure (if template supports it)
  • Automatically determine if a template supports monorepo structure
    • basic template and monorepo template must share a basename
    • monorepo template should be suffixed with -monorepo

Ideas

  • Allow tsdx create (or new command?) to scaffold out a new package within an existing monorepo
    • How to determine if run inside a monorepo, where to place package?

@aleclarson
Copy link
Contributor

How to determine if run inside a monorepo, where to place package?

Maybe by finding all directories with a package.json and prompting the CLI user to choose between their parent directories? The other route is supporting only Lerna and Yarn workspaces, and checking their configuration.

@natemoo-re
Copy link
Contributor Author

Both good ideas.

As of right now, this PR adds lerna to any monorepo created with tsdx create. Yarn workspaces are great, but using lerna avoids forcing any package manager lock-in.

If that remains the case, I'd lean towards checking lerna.json packages and prompting the CLI user to select one (if there are multiple.)

@natemoo-re
Copy link
Contributor Author

The current react template includes a playground at /mylib/example. For the react-monorepo template, should the playground be moved to /examples/basic? This seems like a common pattern (see jest, storybook, next.js).

@swyxio
Copy link
Collaborator

swyxio commented May 31, 2019

no opinion, go for it :)

@jaredpalmer jaredpalmer changed the title feat(monorepo): improve monorepo support WIP: Improve monorepo support May 31, 2019
@natemoo-re natemoo-re force-pushed the feat/monorepo branch 2 times, most recently from 72ef6de to 1569137 Compare June 3, 2019 13:23
@natemoo-re
Copy link
Contributor Author

I'll be circling back to this shortly. Does cutting off this PR at adding basic-monorepo and react-monorepo templates sound okay for a first pass?

I'd like to add support for tsdx create within existing monorepos, but I think that can be split out into a separate issue to keep things moving.

@swyxio
Copy link
Collaborator

swyxio commented Aug 28, 2019

circling back. still keen on this? i dont monorepo, personally. @NateRadebaugh might care for #188

@NateRadebaugh
Copy link

Yes I would love to switch my monorepo to use tsdx at the root. It looks like this threat is talking about scaffolding a new project, so https://github.com/natemoo-re/tsdx-monorepo may be enough of an example for my use case.

@natemoo-re
Copy link
Contributor Author

@sw-yx Yes, I'd love to finish this up now that some personal stuff has settled down. Thanks for the reminder! 😄 I'll see what it takes to get this up to date.

If @NateRadebaugh lands some docs to close #188, I would be happy to add a section for monorepos

@jaredpalmer
Copy link
Owner

What's the status of this?

Copy link
Owner

@jaredpalmer jaredpalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed over it.

@@ -0,0 +1,7824 @@
{
"name": "tsdx",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file. We are on #TeamYarn

],
"scripts": {
"start": "tsdx watch",
"build": "tsdx build"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about test and lint cmd?

@natemoo-re
Copy link
Contributor Author

Sorry for clogging up your PRs. I’m going to close this and reopen if I find time to finish it. If anyone wants to use this as a starting point for their own implementation, please do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants