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

Monorepository tools and recomendations #64

Closed
wtrocki opened this issue May 24, 2021 · 9 comments
Closed

Monorepository tools and recomendations #64

wtrocki opened this issue May 24, 2021 · 9 comments
Assignees

Comments

@wtrocki
Copy link
Member

wtrocki commented May 24, 2021

Having multiple packages in single repo is common problem in enterprise world.
We should be giving recommendation for that.

Solutions:

@roastlechon
Copy link
Contributor

We use monorepo at TWC. We use yarn workspace. Would love to contribute to this topic, however I understand this can also be opinionated too.

@wtrocki
Copy link
Member Author

wtrocki commented May 24, 2021

@roastlechon +1 for putting something simple out there. You have my vote for yarn workspace. It is opiniated topics but I do not have opinions and simply looking to get something that works. I'm researching this right now for other things and see struggle - yarn workspaces is ok but do leave tons of things to setup yourself. For the moment I love semantic releases (because it could resolve also versioning problem) vs changesets.

The worst choice seem to be lerna - tons of dependencies, security issues and not maintained

@roastlechon
Copy link
Contributor

I agree with your worst choice with lerna. We had a couple experiments with it but ultimately did yarn workspace with custom local tooling.

@mhdawson
Copy link
Contributor

I'll add this to the agenda for the next meeting as well.

@wtrocki
Copy link
Member Author

wtrocki commented May 31, 2021

Another problem is - changelogs, single version vs multiple versions.
As builder of multi package repos for couple years this have been my main struggle (usually custom tooling were made for purpose)

@helio-frota
Copy link
Member

Some workarounds in husky but apparently no official solution yet:
typicode/husky#677

To consider as a link of:
https://github.com/nodeshift/nodejs-reference-architecture/blob/main/docs/development/code-consistency.md#guidance

@RoystonS
Copy link

RoystonS commented Jun 8, 2021

+1 for https://github.com/atlassian/changesets. A bit like semantic-release but with a bit more manual control over which packages are released when; very useful if you to batch changes up for chunkier releases rather than releasing with every commit.

We're using yarn workspaces with our own hand-crafted 'mini lerna' to run tasks across the workspace, but we'll likely shift to https://github.com/hfour/wsrun as that includes the ability to consider a build complete when it emits a certain piece of text, which is very useful for running parallel 'watch' builds.

@jimlindeman
Copy link
Contributor

jimlindeman commented Sep 15, 2021

So with large mono-repositories, dynamically managing which portions of build/test jobs get invoked becomes important to avoid small changes requiring 30-60+ minute builds in the PR-validation pipeline. To manage that, Bazel (https://bazel.build/) has been used, where a BUILD file was defined at each package/microservice in the monorepo, and so the dependency list in package.json would be duplicated there like this example:

deps = [
    "//ts/packages/base-config",
    "//ts/packages/logger",
    "//ts/packages/utils",
    "@npm//@types/amqplib",
    "@npm//@types/convict",
    "@npm//@types/node",
    "@npm//amqplib",
    "@npm//convict",
    "@npm//get-port",
    "@npm//prom-client",
] 

where the //ts/packages/... were peer packages in the monorepo (yarn workspaces) and the others were resolved by npm install.

@roastlechon roastlechon self-assigned this Oct 13, 2021
@roastlechon
Copy link
Contributor

First pass draft #92

roastlechon added a commit that referenced this issue Oct 13, 2021
roastlechon added a commit that referenced this issue Mar 16, 2022
* Mono-Repository Guidance and Tooling (draft)

* Added subsection for building

* Add link to code consistency

Recommended by @helio-frota #64 (comment)

* Update docs/development/mono-repository.md

Co-authored-by: Wojciech Trocki <wtrocki@redhat.com>

* Miscellaneous fixes
* Fix links
* Add section about advanced techniques

* Fix broken links

* Add additional guidance based on previous meeting

* Add additional guidance from comments

* Update docs/development/mono-repository.md

Co-authored-by: Benny Powers <bennypowers@users.noreply.github.com>

* On the fly changes

* Add prefix statement explaining service releasing options

* Remove TODOs and place as Issues

Co-authored-by: Wojciech Trocki <wtrocki@redhat.com>
Co-authored-by: Benny Powers <bennypowers@users.noreply.github.com>
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

No branches or pull requests

6 participants