[Discussion] Moving away from lerna #1480
Replies: 3 comments 3 replies
-
As discussed earlier, It would be nice to be able to enforce the commit spec (message, description, name, etc...) by using a tool like commitlint as well as adding some pre-commit hook using something like husky or something like that. The purpose would be to get the change log and commits in general to follow a common pattern and keep it align with everything. I would like to ear about what you think about that :) |
Beta Was this translation helpful? Give feedback.
-
We use NX successfully in several of our projects, it makes handling large code bases easier. We’d love to come alongside your team and work with @adrien2p to help setup toolsets for the best development experience. These tools (like Adrien suggested too) would also help with automating change logs and keeping everything consistent as a large open source network. NX has some powerful generation tools also if you want to help people generate their own plugins or many other potential use cases for that. |
Beta Was this translation helpful? Give feedback.
-
I think the functional concept of using a monorepo should remain intact, but I would highly suggest looking into Yarn Berry... also known as Yarn 3.x. It's support for monorepos doesn't really differ from what exists with Lerna... it just doesn't have the robust publishing capabilities that Learna does. I've been using it in production for several large scale enterprises and it scales wonderfully as well as is an immense upgrade from using Yarn 1.x. It's faster, more explicit and intentional an how dependencies are managed an added and isn't all too different from what we're used to using right now with Lerna. From their documentation...
In addition, they have a concept of Zero Installs that really increases predictability, caching, development onboarding, and my personal favorite, CI installation time. I'd recommend really considering this if you want to 1) use your own publishing tool 2) maintain the sanity of your monorepo without a lot of re-learning or overhead https://yarnpkg.com/features/workspaces - workspaces docs |
Beta Was this translation helpful? Give feedback.
-
As discussed in this issue and made public by the author in the project's readme, lerna is no longer maintained. I think now might be a good time to look for alternatives to move away from lerna.
Lerna in Medusa
For Medusa, lerna has been mostly used for symlinking, task execution (i.e: building packages), and (pre)releasing packages. In the last few months, we started using yarn workspaces with lerna, which, in retrospect, can now be seen as an incremental migration. Currently, we also have an open PR for using turborepo for task execution/scheduling.
Current release/publishing process
Up until now, Medusa's release process has been a little bit manual and more or less looks like this: new features and bug fixes get merged to the
develop
branch, we fix a time during the week to branch out fromdevelop
to a new release branch, publish a canary version, do some testing, publish the branch to npm, then merge the release branch tomaster
then ontodevelop
(correct me if I'm wrong @olivermrbl). I think we can (and should) use this opportunity to improve our release process.Next steps
After moving to yarn workspaces and having an open PR for turborepo, I think what's left is to choose an alternative tool for publishing packages to npm. One alternative to lerna when it comes to publishing is Changesets. It seems like a good candidate but I personally don't have any experience with it and it does seem to follow a different philosophy when it comes to publishing/releasing which we may or may not benefit from.
Helpful resources
I thought I'd share a few resources here that might help mere mortals (like myself) who want to be involved in this discussion:
Thanks for reading and let me know what you guys think!
Beta Was this translation helpful? Give feedback.
All reactions