twitch icon indicating copy to clipboard operation
twitch copied to clipboard

Monorepo setup

Open KevinBatdorf opened this issue 3 years ago • 2 comments

Might be worth exploring setting up a monorepo for agency or larger product type development.

Two popular tools

NX: https://nx.dev/ Overview of NX: https://egghead.io/courses/scale-react-development-with-nx-4038

Turborepo: https://turborepo.org/

NX is the successor to Lerna, which Gutenberg uses. So you can get an idea of how it works if you think about WP.

Why?

Essentially for code sharing and faster/effecient builds.

Imagine you're an agency that has 4 plugins, 3 themes, a desktop app, a website, and a few backend apps. Sharing code between all of these while maintaining separate build and release workflows is a pain. A monorepo solves that.

Create block sets you up with a primitive monorepo in that it will build multiple blocks for you. It stops there though. It also sets you up to release the blocks as a single plugin.

Create block could start building out similar features the other tools provide, OR someone could build (on stream) integrations for the other tools.

Building the perfect mono repo specific to WordPress would be nice though, but a lot of work.

KevinBatdorf avatar Aug 11 '22 23:08 KevinBatdorf

+1 for me, I work with a monorepo now and want to learn more. Especially build tools in theme or individual plugins within the monorepo

troychaplin avatar May 04 '23 14:05 troychaplin

I'll add that turborepo is something you use with a monorepo setup, like nx or pnpm workspaces. Here's an example repo: https://github.com/vercel/turbo/tree/main/examples/basic

That examples directory has a ton of examples too.

KevinBatdorf avatar May 04 '23 17:05 KevinBatdorf