![]() ![]() ![]() The apps folder will contain applications that we will probably not publish to the external repository, while packages will contain modules that we will publish into npm registry / github packages. Our new structure will contain two main folders, apps and packages. eslintrc.js - Dockerfile - package.json - tsconfig.json. storybook - public - scripts - src - components - containers - actions - reducers - index.html. To begin, let’s define the initial state of our repo:. ![]() Once npm7 is installed, we will start with restructuring the repository folders to fit Monorepo’s structure. The first thing you should do is opt-in to npm7 using: npm i -g or install Node.js 15 with Latest Features. Indeed, npm or yarn are not completely alternative to tools such as lerna but they give you the basics you actually need like installing dependencies across child packages and packages symlink. Also, npm declared that their main focus will be on improving workspaces in the upcoming releases. yarn is a great option, but we already using npm. Nx on the other hand, is enforcing a specific project structure with specific dependencies and I found it very hard to customize, also you will find that it’s difficult to control packages versioning. just as a quick note, lerna tool is not updated often these days, looking for maintainers, and has many open issues, also it’s not the best solution in case you want to focus on building apps rather than libs. there are many solutions today for monorepo, and you definitely should explore all of them. This is an advanced guide, we will not get into these dependencies details, there are enough tutorials and How-to about them, rather we will focus on how to configure them correctly to fit a monorepo structure. I will demonstrate the process of moving an existing repo to a Monorepo on an app that its main dependencies are: styled-components, react, redux, webpack, babel, docker, typescript, eslint and jest. You definitely should read the RFC first. For example, the only up-to-date documentation by npm is their RFC, and that’s why I’m writing this documentation. If you are one of the early birds using npm7 and looking to use their new workspaces feature, you probably noticed that there are not too many documentations as of today. ![]()
0 Comments
Leave a Reply. |