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

All the new Monorepo things #1727

Merged
merged 22 commits into from
Oct 9, 2019
Merged

All the new Monorepo things #1727

merged 22 commits into from
Oct 9, 2019

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented Oct 3, 2019

  • Bolt -> Yarn Workspaces which means when you currently run bolt, you should run yarn instead now
  • Use Manypkg for enforcing some monorepo rules, see Manypkg for the reasoning behind all the rules
  • Changesets 2 - single file changesets, new config
    • not a Changesets 2 thing but I updated the changelog generator so it includes references to the PR a change was from and who made the change
  • Remove some unnecessary dependencies and force a bunch of Babel packages to a certain version so they're not duplicated a bunch(there were like 34 copies of @babel/parser iirc)

If you're curious about any of the reasoning for the high level choices, refer to the Thinkmill Monorepo Style Guide

@request-info
Copy link

request-info bot commented Oct 3, 2019

It looks like we could use some more details. Good titles and descriptions help us fix things faster. If you can provide more information please update this issue.

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2019

🦋 Changeset is good to go

Latest commit: 7ebadb9

We got this.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@emmatown emmatown changed the title [WIP] All the new Monorepo things All the new Monorepo things Oct 8, 2019
@emmatown emmatown marked this pull request as ready for review October 9, 2019 04:26
@emmatown emmatown requested review from jesstelford and timleslie and removed request for jesstelford October 9, 2019 04:26
Copy link
Contributor

@MadeByMike MadeByMike left a comment

Choose a reason for hiding this comment

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

Mitchell this looks great! Awesome work.


Keystone uses @noviny's [@changesets/cli](https://github.com/noviny/changesets) in combination with `bolt` to track package versions and publish packages.
KeystoneJS follows the [Thinkmill Monorepo Style Guide](https://github.com/Thinkmill/monorepo). For more information on the reasoning behind using certain tooling, please refer to it.
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

@@ -9,5 +9,8 @@
},
"peerDependencies": {
"express": "^4.17.1"
},
"devDependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure you've got this right... but for my own education why does this need to be both a peer dep and dev dep? I thought if it is peer it would be installed anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

Peer deps aren't ever installed unless you specify to install them in regular deps, optionalDeps or devDeps. They're essentially a way to say to a consumer "Please install this dependency and the version should be within this range and if you don't you'll see a warning that you'll probably ignore". See my answer from a question on TM's Stack Overflow about peer deps for more details:

peerDependencies are a way to communicate that the consumer of a package must install certain dependencies. It's very important to emphasize the consumer part of that, peerDependencies are not automatically installed, a consumer has to install them.

Why would this be a thing people want you might ask? It allows you to enforce that there is only a single copy of a package (sort of) which is very important for packages like React where there can only be a single copy of them otherwise they break.

So we understand why you want them and what they do but we also need to know how to use them. As a consumer of a package, you need to add any dependencies in the package's peerDependencies section, to your own project's package.json.

As a developer of a package, peerDependencies are not installed by default (this is sort of not true with how we work in monorepos because all the packages are hoisted to the root node_modules and therefore available everywhere but we will likely switch to more strict package managers that don't hoist everything and therefore require things that depend on things to say they depend on them). To resolve this, we can add our peerDependencies as devDependencies to have them installed locally when developing a package.

@emmatown emmatown merged commit 260be73 into master Oct 9, 2019
@emmatown emmatown deleted the new-monorepo-things branch October 9, 2019 22:01
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.

2 participants