GithubHelp home page GithubHelp logo

deflock / rush-monorepo-boilerplate-example Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 27 KB

Rush monorepo example (boilerplate)

License: MIT License

JavaScript 77.80% Shell 13.55% Handlebars 8.66%
monorepo monorepository monorepo-example monorepo-boilerplate rush rushjs pnpm pnpm-workspace typescript eslint

rush-monorepo-boilerplate-example's Introduction

Rush monorepo example

Rush — a professional solution for consolidating all your Javascript/TypeScript projects in one repository. It can install, link, and build projects, generate changelogs, publish, and bump versions. It comes from Microsoft. It's free and open source.

pnpm — fast, disk space efficient package manager for Node.js. It's strict, deterministic, has built-in support for workspaces. It works great for monorepositories. And it works everywhere: Windows, Linux, macOS.

Features

  • Customizable ESLint configs
  • Customizable Prettier configs
  • Optional TypeScript configs
  • Some base scripts to make monorepo work

Usage

The only thing you need to start is Node.js 12 or higher.

  1. Clone or download (recommended) this repository.
  2. Find and replace all myscope occurrences to your scope (e.g. organization name). Of course you can also remove myscope for any project.
  3. Just run ./scripts/setup.sh.
  4. That's it.

Now you have a monorepository you can start to work with.

Base scripts to use

  • ./scripts/monorepo/rush - uses locally-installed version of Rush. This way all developers will use the same version. It's highly recommended to use this one instead of globally-installed Rush.
  • ./scripts/monorepo/pnpm - Rush-aware runner for pnpm. Some pnpm commands are not compatible with Rush, some of them require Rush's update command.

To make these scripts handy you can use a tool like direnv. By adding ./scripts/monorepo/ directory to $PATH it will be possible to use more convenient short rush and pnpm commands.

Repository structure

This structure is a default one. You are able to modify it as you wish.

<repo-root>/
|
╰- apps/
|  ╰- <app-name>/
|     |- src/
|     |- ...
|     ╰- package.json
|
╰- common/
|  |- config/
|  |  ╰- rush/
|  ╰- git-hooks/
|
╰- libs/
|  ╰- <lib-name>/
|     |- src/
|     |- ...
|     ╰- package.json
|
╰- scripts/
|  ╰- monorepo/
|  |  |- ...
|  |  ╰- package.json
|  ╰- shared/
|     |- ...
|     ╰- package.json
|
╰- tools/
|
╰- rush.json

Adding new project to monorepo

For now there is no automated way for doing this.

Instead you can:

  1. Copy-paste scripts-shared project into apps/ or libs/.
  2. Change its package name in package.json.
  3. Optionally add dependencies.
  4. Add this new project to projects in ./rush.json.
  5. Run ./scripts/monorepo/rush update.

License

MIT

rush-monorepo-boilerplate-example's People

Contributors

deflock avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

supuna97

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.