barlowm/mono_repo_template

Template for a Mono Repository maintained by Lerna

★ 0Forks 0GitHub ↗Compare

README

Monorepo Starter (WIP)

Airbnb-standard-style MIT License Monorepo Maintained With Lerna tested with mocha

Description

Template for creating a Mono Repository using Lerna, (a tool for managing JavaScript projects with multiple packages/applications/components). This template was originally created for a project that I was working on that consisted of a graphical user interface (GUI) and several interconnected node js microservices Rather than put everything into a single application path I created a repository that had each component in it's own "package". This way each microservice could be developed independently as could the GUI.

Uses Lerna to manage the mono repository

To start a new project clone this repo then do a

npm install

Then, to create a new package, use "lerna"

npx lerna create <Package Name>

Add package specific scripts to the root package.json file:

"test_pkg1": "npx lerna run test --scope pkg1",
"lint_pkg1": "npx lerna run lint --scope pkg1"

Add matching scripts to individual package package.json files:

"test": "npx mocha \"__tests__/*.test.js\" --reporter mochawesome --reporter-options reportDir=reports,reportFilename=test_report,reportTitle=\"test_report\",reportPageTitle=\"Test-Report\"",
"lint": "eslint lib/*.js -f html -o 'reports/lint_report.html"

Include an env_template.env as a sample for any .env file needed. The template should only show what variables are needed not any specific data.