@well-do-it-too/node-typescript-starter
v1.0.12
Published
A comprehensive TypeScript Node.js starter project with essential tools and configurations
Downloads
3
Maintainers
Readme
TypeScript Node.js Starter
A comprehensive starter template for TypeScript Node.js projects, equipped with essential tools and configurations to jumpstart your development process.
Features
- TypeScript configuration
- ESLint for code linting
- Prettier for code formatting
- Husky for Git hooks
- Nodemon for development
- Automatic version updating
- Automatic Git tag updating
- Minification of distribution files
- Pre-commit hooks
- Make commands for easier project management
Prerequisites
- Node.js (v20 or later)
- pnpm (v6 or later)
- GNU Make
Installation
Clone the repository:
git clone https://github.com/Well-do-it-too/node-typescript-starter.git cd node-typescript-starter
Install dependencies:
pnpm install
Usage
You can use either pnpm scripts or Make commands to manage the project.
Using pnpm scripts
To run tests:
pnpm test
To start the development server with hot-reloading:
pnpm run dev
To compile TypeScript to JavaScript:
pnpm run build
For production build with minification:
pnpm run build:prod
To lint your code:
pnpm run lint
To format your code:
pnpm run format
To start the compiled application:
pnpm start
Using Make commands
Run these commands with make <command>
:
make
ormake help
: Shows all available Make commands.make rmdist
: Removes the dist folder.make build
: Builds the project (includes removing dist folder).make build-prod
: Builds the project for production (includes minification).make dev
: Starts the development server.make run
: Runs the compiled application.make test
: Runs the test suite.make version-up
: Updates the project version.make pre
: Runs pre-commit checks.
Git Tag Management
The project includes additional commands for managing Git tags:
make tag
: Displays the latest Git tag.make tag-new
: Displays the next Git tag that would be created.make tag-up
: Creates and pushes a new Git tag. Note: This command can only be run from the 'main' branch.
Scripts
prepare
: Sets up Huskyclean
: Removes dist folder, node_modules, and pnpm-lock.yamlbuild
: Compiles TypeScript to JavaScriptbuild:prod
: Compiles and minifies for productiondist:minify
: Minifies distribution filesdev
: Starts development server with hot-reloadingstart
: Runs the compiled applicationtest
: Runs the test suitelint
: Lints the codebaseformat
: Formats the codebaseversion-up
: Updates the project versionpre-commit
: Runs linting and formatting before commit
Version Management
This project uses semantic versioning (SemVer) for its Git tags. The tag.mk
file provides utilities to manage these tags:
- Tags follow the format
vX.Y.Z
where X is the major version, Y is the minor version, and Z is the patch version. - The
make tag-up
command automatically increments the patch version when creating a new tag. - New tags can only be created from the 'main' branch to ensure version consistency.
When contributing to the project, please be aware of these versioning practices and use the provided commands to manage tags and versions.
License
This project is licensed under the ISC License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Remember to run make pre
or pnpm run pre-commit
before committing your changes to ensure code quality and consistency.