Skip to content

Simple way to create a monorepo with Yarn and TypeScript.

Notifications You must be signed in to change notification settings

rootsher/monorepo-yarn-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple way to create a monorepo with Yarn and TypeScript.

Topics

Resources

Stars

Watchers

Forks