Skip to content

CatsMiaow/node-monorepo-workspaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

28b416f · Jan 2, 2025

History

10 Commits
Feb 21, 2023
Jan 2, 2025
Jan 2, 2025
Oct 16, 2023
Dec 28, 2022
Jan 2, 2025
Dec 28, 2022
Apr 3, 2024
Dec 28, 2022
Oct 16, 2023
Apr 3, 2024
Jan 2, 2025
Jan 2, 2025
Apr 3, 2024

Repository files navigation

node-monorepo-workspaces

Node.js Monorepo example with npm Workspaces

Introduction

Monorepo structure of TypeScript and NestJS project using Lerna and npm Workspaces

Continuous Integration

npm ci
npm run lint
npm run test
npm run build
# The above command can also be used like this:
npx lerna run lint,test,build
#= npx nx run-many --target=build

# Run tasks affected
npx lerna run build --since=main
#= npx nx affected --target=build

Development

# package manage to a specific workspace
npm i -w sample-nestjs-app install-package
npm uninstall -w sample-nestjs-app uninstall-package
npm ci -w sample-nestjs-app

# launch the development process
npx lerna run dev --scope=sample-nestjs-app
#= npx nx run sample-nestjs-app:dev

# execute npm tasks
npx lerna run any-task --scope=workspace-name
npx lerna exec npm run any-task --scope=workspace-name
#= npx nx run workspace-name:any-task
npm run any-task -w workspace-name

Production

# https://docs.npmjs.com/cli/v9/commands/npm-ci#omit
npm ci -w sample-nestjs-app --omit=dev

Create a new workspace (apps or packages)

Apps

Packages

Folders

+-- apps
|   +-- sample-app // TypeScript simple sample-app
|   +-- sample-nestjs-app // NestJS server sample-app
+-- packages
|   +-- sample-lib // TypeScript simple sample-package
|   +-- sample-nestjs-lib // NestJS module sample-package
+-- .eslintrc // ESLint common configuration
+-- jest.config.ts // Jest common configuration
+-- lerna.json // Lerna configuration
+-- nx.json // Nx task pipeline configuration

Links

Releases

No releases published

Packages

No packages published