62 lines
1.8 KiB
Markdown
62 lines
1.8 KiB
Markdown
# TypeScript NPM Package Template
|
|
|
|
This is a boilerplate to jumpstart one's next TypeScript npm package development. It utilizes various tools to streamline development, testing, and publishing processes.
|
|
|
|
## Features
|
|
|
|
**TypeScript**: For powerful type safety and improved code maintainability.
|
|
**tsup**: A fast and efficient TypeScript bundler for streamlined development.
|
|
**pnpm**: A package manager with features like workspaces and faster install times. (Optional, can be replaced with npm or yarn)
|
|
**Commitizen**: Standardizes commit messages following the Conventional Commits specification.
|
|
**ESLint**(_New flat config!_) & **Prettier**: Enforces code style and formatting consistency.
|
|
**Jest**: A popular testing framework for unit and integration tests.
|
|
**Husky**: Executes pre-commit hooks to ensure code quality and formatting before commits.
|
|
**Semantic Release**: Automates versioning and changelog generation based on commit messages.
|
|
|
|
## Getting Started
|
|
|
|
### Clone it via bash or in git\* web ui
|
|
|
|
```sh
|
|
git clone https://git.mattmor.in/Madmin/ts-npm-package-template.git $name
|
|
cd $name
|
|
sudo rm -rf .git
|
|
git init
|
|
```
|
|
|
|
### Install dependencies:
|
|
|
|
```sh
|
|
pnpm install # (or npm install or yarn install if you wish)
|
|
pnpm i -g commitizen cz-gitmoji
|
|
|
|
|
|
```
|
|
|
|
### initialize your project to use the cz-conventional-changelog adapter by typing:
|
|
|
|
```sh
|
|
# pnpm otherwise go here for more pms https://github.com/commitizen/cz-cli
|
|
commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact
|
|
```
|
|
|
|
### set Landish/cz-gitmoji as default adapter globally
|
|
|
|
```sh
|
|
echo '{ "path": "cz-gitmoji" }' > ~/.czrc
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Building:
|
|
|
|
```sh
|
|
pnpm run build # (or npm run build or yarn build)
|
|
```
|
|
|
|
This creates a production-ready build of your package.
|
|
|
|
### Committing:
|
|
|
|
Use `git commit` to generate standardized commit messages with cz thanks to this config:
|