Giter VIP home page Giter VIP logo

my-monorepo's Introduction

lerna+yarn workspace+monorepo总结:

简单完整周期:

  • 全局安装 npm i -g lerna
  • 初始化项目 lerna init
  • 创建npm包 lerna create @gk/xxx
  • 添加依赖模块 lerna add xxx or lerna add A --scope B (把A添加到B)
  • 发布 lerna publish

其他:

  • 把依赖包提升到根目录 lerna bootstrap --hoist (可以在lerna.json配置)
  • 清除package依赖 lerna clean

lerna + Monorepo 最佳实践

  • 搭建环境 clone 下来项目 yarn install

  • 清理环境 lerna clean # 清理所有node_modules yarn workspace run clean # 执行所有package的clean操作

  • 安装 | 删除依赖 yarn workspace packageA add packageB # 把B添加到A yarn workspace add lodash #给所有package安装lodash yarn add -W -D typescript #根目录安装ts

    yarn workspace packageA remove packageA yarn workspace remove lodash yarn remove -W -D typescript

  • 项目构建 lerna run --stream --sort build

  • git代码提交 | 代码风格 规范化

  • 发布 lerna publish

  • 添加测试用例 jest

使用

  • git clone xx # 远程拉取代码
  • yarn install # 安装依赖
  • git add . # 添加到暂存区
  • yarn run commit # 改动说明
  • lerna publish # 版本发布

问题

OpenSSL SSL_read: Connection was reset, errno 10054 git config --global http.sslVerify "false"

my-monorepo's People

Contributors

gk7261234 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.