monorepo

Yuyang 前端小白🥬

Preface

之前写过的一个项目是基于vue.js的前端和express的后端,一直是以分开的git repositories管理的。但其实后端内容很少,因此考虑后期的维护和开发,将前后端合并到一个git repository中,这样可以更好的管理项目。

What is Monorepo

A monorepo is a code management approach where all code for multiple projects, including components, libraries, and internal dependencies, is stored in a single centralized repository, often involving multiple programming languages and application types.

Why Monorepo

  • Simplified Code Management
  • Enhanced Collaboration
  • Streamlined Tooling
  • Code Sharing and Reusability
  • Dependency Management
  • Consistent Development Environment
  • Flexibility and Scalability

How to create a Monorepo

目前主流的monorepo管理工具主要是Lerna(https://lerna.js.org/).但由于我这个项目主要是前后端代码,不是组件化的项目,因此暂不使用Lerna。主要还是完成前后端代码的合并。

image-20241111041031268

Reference

https://www.sonarsource.com/learn/monorepo/
https://juejin.cn/post/7215886869199896637