Stacks Monorepo

Description

The Amido stacks webapp template is a monorepo managed with Lerna

At the moment, the project is comprised of:

  • [Webapp](packages/webapp) - SSR React, Node.js
  • [UI_Library](packages/UILib) - TBC

Sample project directory structure

โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ lerna.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ packages
โ”‚ย ย  โ”œโ”€โ”€ Webapp
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __tests__
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ index.test.tsx
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ pages
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ index.tsx
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ package.json
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ README.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ task -> ../../scripts/task
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Dockerfile
โ”‚ย ย  โ”œโ”€โ”€ [sample Package]
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ README.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __tests__
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ package.json
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ task -> ../../scripts/task
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Dockerfile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ scripts
โ”‚ย ย  โ””โ”€โ”€ task
โ””โ”€โ”€ package-lock.json

Approach

  • npm handles the dependencies.
  • Lerna handles tasks that affect multiple package (compile/test/lint all modules).
  • One folder per package inside packages/.
    • any new package should be added within the packages directory and follow the above structure.
  • All packages share the similar structure.
  • Task script is used to define set of common tasks like test, lint and dev. So any common task should be added in the script at the root level.