AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Yarn workspaces vs npm workspaces11/30/2023 npmClient: you can define in you want to use Yarn, Npm or your favourite client.We prefer fixed mode to keep all packages with the same version and reduce headaches to users. Take care that independent mode will create one tag for each package that will be published with its own version. It could be a semver value (called fixed mode) or independent if you want to let packages define their own version. In our case, we use core/*, plugins/* and tools/*. They could be explicit ( packages/pkg1) or, if a folder has several packages, you can use * wildcard. packages: this array defines the location for all packages that conforms the monorepo.This will generate files like package.json or lerna.json (packages structure is shown as example, but not generated). The initial setup is really simple, you only need to create a new repository and run lerna init to initialize the monorepo. Since Yarn 1.0, this feature is enabled by default, you only need a root package.json to setup them. If a package has a dependency on other package in the workspace, they are linked without affecting your global environment.All the packages in the workspace uses a common lockfile as a single source of truth.This involves two things that you could not see at the first moment. Yarn Workspaces is a way to setup package architecture where all packages dependencies are installed together with a single yarn install. Also, if you don't want to install it, you can use package runners such as npx. You can install it globally with npm install -global lerna, yarn global add lerna or your favourite package manager, to run commands with lerna. Lerna is a tool to manage several Javascript projects with multiple packages (called monorepos), optimizing the workflows around them. There are more tools for this purpose, but we will focus on Lerna and Yarn Workspaces. In order to achieve our goal, and we found Lerna and Yarn Workspaces.Īs a first step, we created the basic architecture of the monorepo and moved the first dependencies in, an ESLint config and a Babel preset.Īfter Verdaccio 4 release, Typescript migration and more, we saw that many projects shares the same architecture, so it could be a good moment to achieve our goals. We decided to unify all configurations, because handle several repositories would not be realistic and would have all things replicated in all repositories. We had some concerns about the Verdaccio ecosystem we want to build, such amount of repositories requires hard work for maintenance by each one with their own dependencies, scripts, configurations, etc. Background and tools Ī year ago, Juan and I met in Madrid, Spain, and were talking about the roadmap for Verdaccio 4, the scope of the projects and more. This article is the first part of a series of articles where we will try to explain our motivation about to set up by your own, improve the management and workflows (CI, code quality, etc). Now, we are proud to announce our monorepo, our big ecosystem joined in only one repository. There are many examples out there that Javascript developer use nowadays, like Babel, Create React App or Material UI. We need a monorepo.Ī monorepo is a project configuration to manage a collection of dependencies in a simple and unified way. So, we needed to simplify and unify them to make it easier. We saw a problem, these configurations entropy made harder to work with all the projects. This fact transforms a simple maintenance operation, like updating a common dependency, into a real hard work. Verdaccio is a project with a big ecosystem, composed by several projects, each one with its own configurations and ways to manage.
0 Comments
Read More
Leave a Reply. |