typescript-mono-repo-template

Open in Github Open in Github Page Open Tag

A project template for building mono repos with TypeScript.

Usage

Follow these instructions to clone this template and start a new project with a clean Git history.

1. Clone and Checkout the Template

Clone the repository and replace YOUR_PROJECT_NAME with your desired project name. Then, navigate into the directory and check out the latest stable tag to ensure you have a clean starting point.

# Clone the template
git clone https://github.com/JamesRobertHugginsNgo/typescript-mono-repo-template.git YOUR_PROJECT_NAME

# Navigate into your new project's folder
cd YOUR_PROJECT_NAME

# Checkout the stable tag
git checkout 1.1.8

2. Prepare the Project

Remove the template’s Git history and reset the package.json file to begin your new project.

# Remove the old Git repository
# Choose the command based on your operating system:

# MacOS/Linux
rm -rf .git
rm -rf dist
rm package.json package-lock.json

# Windows
rmdir /s /q .git
rmdir /s /q dist
del package.json package-lock.json

3. Reconfigure Your Project

Run these commands to generate a new package.json file and reinstall the core dependencies for your new project.

# Run these commands for all operating systems:
npm init -y
npm install --save-dev @types/node parcel typescript
npm pkg delete main
npm pkg set license="MIT"
npm pkg set scripts.build="tsc --build"
npm pkg set scripts.watch="tsc --watch"
npm pkg set scripts.parcel:build="parcel build src/parcel/index.html --no-optimize --dist-dir dist/parcel"
npm pkg set scripts.parcel:watch="parcel src/parcel/index.html --dist-dir dist/parcel"
npm pkg set type="module"

Build & Cleanup

If you manually delete the dist folder, you must also delete the .parcel-cache folder before re-running the build command (npm run parcel:build or npm run parcel:watch) to ensure all files (like index.html) are correctly recreated.