PNPM based monorepo preconfigured with docker, eslint, Jest, esbuild and Typescript
Windows Users Only: I have only tested this on Windows 10 with WSL2. Please create an issue if you encounter any problems using the template.
- Install
pnpm
usingnpm install -g pnpm
- Clone the template
git clone https://github.com/sageil/turbo-esbuild-monorepo-template
- Run
pnpm install
packages:
- "services/**"
- "packages/**"
- "apps/**"
- "tools/**"
Services
is used to build and deploy services. Seeservices/example
Packages
is used to build and deploy packages or components to use in your servicesApps
is used to build and deploy browser based appsTools
is used to host development and build tools esbuild, jest, eslint & prettier
- Adding a package
From the root of your project, execute
cp -frp package-template packages/The_name_of_your_package
- Adding a service
From the root of your project, execute
cp -frp service-template services/The_name_of_your_service
- Adding an App
From the root of your project, execute
cp -frp app-template apps/The_name_of_your_app
- Adding an App
From the root of your project, execute
Note: Please change the name property in your project's package.json
to reflect the new project name
pnpm build
: Builds all services and packages. To bypass turbo cache, usepnpm build --force
pnpm dev
: Starts nodemon in all packages and servicespnpm test
: Start test suites in all projects within the monorepopnpm start
:Starts all packages and components in production modepnpm prod
: Creates a production only deployments for your services and components. This must be followed bypnpm install
in the root directory of the service or component.pnpm lint-all
: Start eslint on all projects within the monorepopnpm format-all
: Start prettier in all projects within the monorepopnpm lint-format
: Start linting and formatting on all projects within the monorepopnpm lint-format:fix
: Apply linting and formating fixing on all projects within the monorepopnpm format-fix
: Apply prettier formating and applying prettier fixes on all projects within the monorepopnpm gendocs
: Start typedoc on all projects within the monorepo in directory calleddocs
in the root of your monorepo
Before using the taskfile to build your services, make sure you have installed docker,and Taskfile in your environment.
task docker
: Used to build the docker image and run the containertask --watch docker
: Used to build, deploy and watch your project for changes in docker.task --watch docker --force
: Used to force build, deploy and watch your project for changes in docker.
- Execute
pnpm viewdocs
in the root of your monorepo to view the generated documentation in your default browser(http://127.0.0.1:57208/docs).
- commit-msg: used to validate commit messages using conventional commits
- pre-commit: used to run lint staged files
- post-merge: used to run pnpm -install and pnpm test-
- post-checkout: used to run pnpm install && pnpm lint-staged
- Add & configure husky
- Add Typedocs
- Add Prettier
- Add Jets
- Add eslint
- Add esbuild with type checking
- Add Development option with watch mode
- Add Docker
- Add taskfile
- Complete browser based apps configuration