-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Monorepo Migration #1515
Merged
Merged
Monorepo Migration #1515
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploy preview for netlify-cms-www ready! Built with commit 77021ed |
4db3e4e
to
41cda4d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1410.
High points
Answering your questions before you ask them
Why Webpack for everything?
Most monorepos are libraries, and most libraries aren't built with Webpack. Usually Babel or Rollup are used for production, as they typically excel at producing leaner bundles.
The short answer is that Netlify CMS is an application, not a library, so it's dependencies aren't quite as focused as a typical library. Our packages import all kinds of stuff, and we really need the build tooling to Just Work™. After many, many, many hours of toil, I can confirm that no other tooling was able to stomach our dependency graph nearly as well as Webpack + Babel. Rollup came close at some points, but there were a lot of gotchas for our use case.
To be clear: we'd ideally use Rollup for most of our packages. Maybe in the future.
Why Emotion?
Because CSS is for babies.
Seriously, though, CSS hit the scale limit once we split into a bunch of packages that needed to share styles, with surely more to come. Emotion gives us the beauty of the Styled Components approach with the "just make a classname" flexibility of CSS modules, for those times when you need it. And we did have those times.
Tour of the new digs
We really need to document a whole lot of stuff now. Here's the lightning tour:
/packages
./packages/netlify-cms
= the good ol' package you know and love. A tiny wrapper that preloads all of the official extensions.NPM is your friend.
If you want to use the core with a select few extensions, you'll need to use NPM. The
netlify-cms
package is a good example of how to do this, and it's fairly straightforward. The reason you need to use npm and bundle it up is "because builds". We need to get a shared dependency scheme going so that every widget doesn't have to cart around the same 800kb of dupe code. If you tried to throw together the core and some widgets via script tags in the browser today, it won't work. This is still a massive step forward, and we haven't lost any of the flexibility Netlify CMS already had, but it's sure to trip some folks up. Please be patient as we tumble down the rabbit hole ofhip new toolswise architectural decisions.What now?
More modularity. The more consumable pieces Netlify CMS exists in, the more clearly defined extension points become, and the more obvious examples everyone has on how to do cool things within. You can still use Netlify CMS like you always have, but it's simpler than ever to make your own version of an "official" widget and whip up a CMS instance with just the extensions you choose. We're stoked at the possibilities. Let us know what you think!