Coder Social home page Coder Social logo

do-once / cbb Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 33.34 MB

一个基于RushStack的monorepo CBB实践;A common building block power on RushStack

License: MIT License

JavaScript 12.38% Shell 1.05% TypeScript 69.53% HTML 10.69% Vue 4.92% CSS 1.42%
lib monorepo rush rushstack vite vue

cbb's Introduction

cbb

Common building block(CBB) monorepo powered by RushStack

Monorepo principle with RushStack

  • minimizing "boilerplate" files. In other words, consolidating files and settings that would otherwise get copy+pasted into every single project folder in the monorepo. Boilerplate is a nuisance because it's difficult to keep in sync. When a fix is needed, if you have hundreds of projects, you would need to reapply the same fix hundreds of times.
    • 尽量减少 "模板 "文件。换句话说,合并那些在 monorepo 中需要复制粘贴到每个项目下的配置文件。让模板保持同步是个麻烦事。一旦需要变动,如果你有百个项目,你需要数百次重复操作。
  • principle of project isolation: Each project should build independently and should not become entangled with other projects (for example, by referencing files using relative paths like ../../other-project). This discipline facilitates Rush features like subset builds and incremental builds. It also makes it very easy to move Rush project folders around, to migrate projects between monorepos, and even to stop using Rush later if you change your mind. For this reason, we discourage practices such as putting a centralized .eslintrc.js file in the root of the monorepo and invoking ESLint globally for all projects.
    • 项目隔离原则。每个项目都应该独立构建,而不应该与其他项目纠缠在一起(例如,通过使用诸如 .../.../other-project 的相对路径引用文件)。这条原则有助于实现 Rush 的子集构建和增量构建功能,甚至当你不想使用 Rush 后,它也可以非常轻易地在 monorepo 间迁移项目。出于这个原因,我们不鼓励在 monorepo 仓库的根目录下放一个 .eslintrc.js 文件并让所有项目都借此调用 ESLint.

Directory Structure

Organizational Principles

  • organized with two level, like Categary/Project
# good
.
├── rush.json
├── Categary1
│   ├── ProjectA
│   └── ProjectB
├── Categary2
│   └── ProjectC
├── Categary3
│   ├── ProjectD
│   └── ProjectE

Categary

  • assets
    • Assets package,svgimgiconfont etc
    • reviewCategories:published
  • cli
    • Cli package build with NodeJs
  • common
    • Common project config rush configgit-hooks etc
  • components
    • Components package build with vue2 and vue3 or other
    • Output esm and umd format
  • libraries
    • Library package build with es6 or ts
    • Only output esm format and do not any degrade,so you need transform it to other format and polyfill for other browser
  • run-control
    • Shared config package,.prettierrc.eslintrc.stylelintrc etc
  • tools
    • A NodeJS build tool used to compile the other projects
  • apps
    • A application build with vue3 and vite

Review Categories

  • production
    • need deploy to production environment
  • published
    • need published to npm registry
  • internal
    • no need to publish,just use in internal

How to add a new project?

  • Just run rush init-project to make it happen.

TODO

  • use vite to bundle components and libraries
    • 2022-1113 now build and test script use heft,vite just use as development server for libraries .components no adjustment.
  • use vite output .d.ts for components
  • add tools template
  • add components template
  • add libraries template
  • add assets template
  • use vitest replace @heft/jest
    • 2022-1113 switch back to @heft/jest in libraries project
  • enable phase_build
  • make project treat js as esm instead of cjs
    • add "type":"module" in package.json
  • Integrate vue-demi
    • add integrate vue-demi project template

How to publish a package

cbb's People

Contributors

bryanadamss avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.