Skip to content

Latest commit

 

History

History
260 lines (202 loc) · 7.69 KB

README.md

File metadata and controls

260 lines (202 loc) · 7.69 KB


node-ts-monorepo

A feature-rich Node.js TypeScript monorepo designed for a reproducible and isolated development environment.
Ideal for managing multiple packages within a single repository.

Report Bug · Request Feature


Table of Contents

Features

Feature Description
Devbox A command-line tool that lets you easily create an isolated, reproducible development environment. See the Devbox section for more info.
pnpm A fast and efficient package manager for JavaScript and Node.js that uses a content-addressable filesystem to store files.
Turborepo A high-speed build system optimized for monorepos, making it faster to build and test code.
Changesets A tool that offers a way to manage versions and changelogs while optimizing the publishing process for multi-package repositories.
Vitest A Jest compatible testing utility with better performance.
tsup A fast, easy-to-configure Node.js and browser bundler that supports TypeScript, ES Modules, CommonJS, and more.
ESLint A tool to identify and report on patterns found in ECMAScript/JavaScript code. Configured with the comprehensive @phi.school/eslint-config to align with organization coding standards.
Prettier An opinionated code formatter that supports multiple languages and integrates with most editors. Configured with @phi.school/prettier-config, to adhere to the organization's preferred code style.
commitlint A tool to enforce conventional commit messages, ensuring consistency and automated versioning compatibility.
husky A tool to improve Git hooks, making it easier to enforce quality checks, using linters, and more.
lint-staged A tool that runs linters against pre-committed code in Git, helping to ensure that you're only committing files that meet your linting criteria.
dotenv A zero-dependency module that loads environment variables from a .env file into process.env, enhancing the application's configuration management.

Prerequisites

Devbox

Devbox is a Nix-based environment and package manager that standardizes development environments across teams. By ensuring every developer has the same tool versions locally, collaboration becomes smoother. Some key features include:

  • Generating a devcontainer for use with VSCode.
  • Creating a Dockerfile to build a production image with the identical development tools.
  • Integration with direnv, auto-loading the isolated shell upon entering the project directory.
  • Compatibility with the Devbox GitHub Action, enabling recreation of your development environment in workflows.

Installing Devbox:

Installation is straightforward, and Devbox is compatible with macOS, Linux, and Windows. See the Devbox docs for detailed instructions.

degit

To install this template efficiently, utilize degit. You can globally install degit with your preferred package manager:

pnpm install -g degit
# OR
npm install -g degit
# OR
yarn global add degit
# OR
nix-env -iA nixpkgs.nodePackages.degit

Installation

Once degit is installed, initiate your project with the following command, substituting <YOUR_PROJECT_NAME> with your project's name:

degit phi-school/project-templates/node-ts-monorepo <YOUR_PROJECT_NAME>
cd <YOUR_PROJECT_NAME> && devbox shell

For an automated devbox shell load upon entering the project directory, install & configure direnv.

Note:
Upon entering the project directory for the first time after setting up direnv, you will be prompted with a security notification. You must run direnv allow to grant permission. Once allowed, your development environment will auto-load every time you enter the directory.

Post-Installation Checklist

After the template installation, follow these steps to tailor and set up your project:

  • Update the project license.
  • If necessary, create a .env file following the .env.example structure.
  • Personalize the README.md file, removing or updating template-specific instructions.
  • Review and modify the default configuration files if required.

Usage

The template includes several handy scripts:

  • build: Compile the TypeScript project with tsup.
  • format: Prettify the codebase using Prettier.
  • lint: Conduct code linting via ESLint.
  • test: Launch tests with Vitest.
  • type-check: Check code types using TypeScript.
  • create-package: Instantiate a new package in the packages directory, fully integrated with the monorepo.

Contributing

Contributions are welcome! For a detailed guide on how to contribute, please refer to the Contributing & Development section in the repository root.

License

This project is released under the MIT License. © 2023-Present phi school