All Projects → michaljach → Modern Monorepo Boilerplate

michaljach / Modern Monorepo Boilerplate

Modern Monorepo Boilerplate with Lerna, TypeScript, React/CRA, HMR, Jest, ESLint/TypeScript.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Modern Monorepo Boilerplate

Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (+58.27%)
Mutual labels:  lerna, jest, monorepo
Eslint Plugin Monorepo
ESLint Plugin for monorepos
Stars: ✭ 56 (-55.91%)
Mutual labels:  lerna, eslint, monorepo
React Pages Boilerplate
Deliver react + react-router application to gh-pages
Stars: ✭ 134 (+5.51%)
Mutual labels:  eslint, jest, hot-reload
react-component-library-lerna
Build your own React component library managed with lerna, presented with storybook and published in private npm registry.
Stars: ✭ 55 (-56.69%)
Mutual labels:  eslint, jest, monorepo
Entria Fullstack
Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
Stars: ✭ 434 (+241.73%)
Mutual labels:  lerna, jest, monorepo
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-10.24%)
Mutual labels:  lerna, jest, monorepo
ng-mono-repo-starter
Angular Mono Repo Starter
Stars: ✭ 79 (-37.8%)
Mutual labels:  jest, lerna, monorepo
react16-seed-with-apollo-graphql-scss-router4-ssr-tests-eslint-prettier-docker-webpack3-hot
Seed to create your own project using React with Apollo GraphQL client
Stars: ✭ 19 (-85.04%)
Mutual labels:  eslint, jest, hot-reload
Simple React App
Simple base app using react, react-router v4, hot-reload & sass.
Stars: ✭ 263 (+107.09%)
Mutual labels:  eslint, jest, hot-reload
Opensource
Delivering delightful digital solutions. Open Source packages with combined ~85M/month downloads, semantically versioned following @conventional-commits. Fully powered by Jest, @Babel TypeScript, @Airbnb @ESLint + @Prettier, @YarnPKG + @Lerna independent versioning, GH @Actions & automated dep updates with @RenovateBot.
Stars: ✭ 459 (+261.42%)
Mutual labels:  eslint, jest, monorepo
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+261.42%)
Mutual labels:  lerna, jest, monorepo
Angular6 Monorepo Experiment
A monorepo experiment using Angular-CLI and Lerna
Stars: ✭ 15 (-88.19%)
Mutual labels:  lerna, monorepo
React Ssr Starter
All have been introduced React environment
Stars: ✭ 20 (-84.25%)
Mutual labels:  eslint, jest
Eslint Import Resolver Jest
🃏 Jest import resolution plugin for eslint-plugin-import
Stars: ✭ 29 (-77.17%)
Mutual labels:  eslint, jest
Pectin
Rollup-related tools for incremental transpilation of packages in Lerna-based monorepos
Stars: ✭ 50 (-60.63%)
Mutual labels:  lerna, monorepo
Thinkful Workshop React Redux Node Mongodb Webpack2
Stars: ✭ 12 (-90.55%)
Mutual labels:  eslint, jest
Express React Boilerplate
🚀🚀🚀 This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-74.8%)
Mutual labels:  eslint, jest
Node Typescript Boilerplate
Minimalistic project template to jump start a Node.js back-end application in TypeScript. ESLint, Jest and type definitions included.
Stars: ✭ 1,061 (+735.43%)
Mutual labels:  eslint, jest
React Redux Saga Starter
Basic, Opinionated starter kit for React+Redux+Redux Saga with support for SCSS CSS Modules, Storybook, JEST testing, and ESLint
Stars: ✭ 12 (-90.55%)
Mutual labels:  eslint, jest
Starter React Flux
Generate your React PWA project with TypeScript or JavaScript
Stars: ✭ 65 (-48.82%)
Mutual labels:  eslint, jest

Modern Monorepo Boilerplate

CircleCI

Usage

Running this project should be very easy, quick and automatic using monorepo apporach.

  • Install lerna first: yarn global add lerna
  • Run yarn bootstrap to install all dependencies and setup monorepo symlinks using lerna.
  • Run yarn start to start development server with all packages included, by default you'll run @namespace/react-app.
  • Run yarn test to test all packages simultaneously.

Setup explained

Tooling

  • Monorepo is done using npm and lerna.

    • Packages are automatically linked together, meaning you can do cross-package work within the repo with hot module reloading and without any building.
    • Commonly used dependencies are hoisted from root, and only appear in the root package.json.
    • All shared dependencies appear only as peerDependecies in each package.
    • Running yarn build makes production-ready builds of all packages.
    • Running yarn test runs tests for all packages at once.
    • Each package has its own scripts and dependencies keys. They are being installed in the root node_modules and you can still run standalone commands within each package from its scripts.
    • Adding new packages is as simple as dropping an existing package in the packages folder, and re-running yarn bootstrap.
  • Sources and tests are written in strict TypeScript.

    • We use a single, common, tsconfig.json, from which all other tsconfig.json files inherit (using "extends").
    • Each project has src folder, each with their own tsconfig.json. This allows us to define which @types packages are accessible on a per-folder basis (src should not have access to test globals).
  • Testing is done using jest and enzyme.

    • Light, battle-tested, projects with few dependencies.
    • Components are snapshot-tested.
    • All tests are written in TypeScript and linted via ESLint

Included sample packages

  • @namespace/components

    • React components library.
    • Built as cjs (Node consumption) and esm (bundler consumption).
    • All componenents are linked dynamically without rebuilding or compiling.
  • @namespace/react-app

    • React application.
    • Built with minimal CRA setup.
    • Uses the @namespace/components package (also inside monorepo).

Basic structure and configurations

packages/
    some-package/
        src/
            some-folder/
            index.ts         // combined exports
        tsconfig.json        // extends ./tsconfig.json
        package.json         // package-specific deps and scripts
        README.md            // docs are important

README.md         // docs are important
.gitignore        // github's default node gitignore with customizations
.npmrc            // internal npm repository config
lerna.json        // lerna configuration
LICENSE           // root license file. picked up by github
package.json      // common dev deps and workspace-wide scripts
setupTests.ts     // enzyme and all tests setup file
tsconfig.json     // common typescript configuration

Dependency management

Traditionally, working with projects in separate repositories makes it difficult to keep versions of devDependencies aligned, as each project can specify its own devDependency versions. Monorepos simplify this, because devDependencies are shared between all packages within the monorepo. Taking this into account, we use the following dependency structure:

  • shared dependencies and devDependencies are placed in the root package.json
  • dependencies and devDependencies are placed in the package.json of the relevant package requiring them, as each package is published separately
  • commonly used dependencies are placed in peerDependencies

New dependencies can be added to the root package.json using npm:

yarn add <package name> -W [-D]

Some packages depend on sibling packages within the monorepo. For example, in this repo, @namespace/react-app depends on @namespace/components. This relationship is just a normal dependency, and can be described in the package.json of @namespace/react-app like so:

"dependencies": {
  "@namespace/components": "<package version>"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].