Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.08 KB

README.md

File metadata and controls

46 lines (30 loc) · 1.08 KB

monorepo-yarn-typescript

explanation

This repository shows a simple way to create a monorepo (where X applications can use a shared package - e.g. for shared UI, scripts, services, models or whatever).

The solution I built uses Yarn Workspaces, Yarn PnP and Node.js Corepack.

requirements

  • Node.js 18+ (v18.13.0)
  • Yarn 4.0.1 (managed by corepack):
    1. $ npm uninstall -g yarn
    2. $ npm install -g corepack
    3. $ corepack enable

setup

  • install dependencies (generate .pnp.cjs file):
$ yarn
  • run compilation process for shared package (in watch mode):
$ yarn workspace shared watch # tsc --watch
  • run compilation process for app1 package (in watch mode):
$ yarn workspace app1 watch # tsc --watch
  • execute app1 output:
$ yarn workspace app1 node dist/src/index.js

TODO

  1. production build instruction
  2. packages versioning