![]() 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. We recommend trying out the new npm workspaces and providing feedback to the npm team so they get even better over time.Verdaccio is a project with a big ecosystem, composed by several projects, each one with its own configurations and ways to manage. ![]() from and it will find it on disk through the symlink. Our root package.json adds those three directories’ children as workspaces: We don’t have to keep these three types of packages separated, but it helps us navigate around. We’ve broken our project up into three different types of packages: apps which are preact apps intended to be bundled and deployed somewhere, modules which are plain npm packages for node/browsers and do not bundle their dependencies, and workers which are either Worker or ServiceWorker scripts entirely bundled up with no imports or exports. I’ll try to give a brief overview of our directory structure and how npm’s workspaces work for us.įor us, the new workspaces feature means two things: 1) all dependencies of the root package + sub-packages are installed into a single node_modules folder at the root and 2) sub-packages are symlinked into node_modules during npm install. Workspaces have been available to try since version 7 was released and is now considered “generally available.” I have been familiar with yarn workspaces for some time and I was a bit confused at first about what npm workspaces actually did. Recently I wrote about changing the tooling we use for our JavaScript monorepo and mentioned we are using npm 7’s new workspaces feature. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |