@luanroger/ts-package-template
v1.0.3
Published
A TypeScript package template
Maintainers
Readme
ts-package-template
A future proof TypeScript package template, using good alternative (kind of) tools. It includes everything you need to get started quickly, including a basic project structure, build scripts, and configuration files.
You can delete the content of this README and add your own information about your package.
Tools
- 📘 TypeScript - A typed superset of JavaScript that compiles to plain JavaScript.
- ⬇️ Rolldown with tsdown - A modern JavaScript bundler that focuses on simplicity and ease of use. With
tsdown, it provides seamless TypeScript integration. - 🌿 Biome - An all-in-one code linter and formatter.
- ⚡ Vitest - A blazing fast unit test framework.
- 📋 git-cliff - A changelog generator based on conventional commits.
- 🚀 np - A better
npm publish. - 📦 pnpm — Already used in this project.
Directory Structure
./
├── ./.vscode/
│ └── settings.json
├── ./src/
│ └── index.ts
├── ./test/
│ └── index.test.ts
├── biome.json
├── CHANGELOG.md
├── cliff.toml
├── tsconfig.json
├── tsconfig.build.json
└── tsdown.config.tsThis is just the most important files and folders. Not every file is shown in this structure.
./- The root directory of the project../.vscode/- Contains VSCode-specific settings for the project../src/- The source code of the package. Used by the bundler to create the final output, also, in thedevmode, the files here will be watched for changes../test/- The test files for the package. Used by Vitest to run unit tests.
biome.json- Configuration file for Biome, the code linter and formatter. Check the Biome documentation for more details.CHANGELOG.md- The changelog file generated bygit-cliff.cliff.toml- Configuration file forgit-cliff. Check the git-cliff documentation for more details.tsconfig.json- The main TypeScript configuration file.tsconfig.build.json- TypeScript configuration file used specifically for the build process.tsdown.config.ts- Configuration file fortsdown. Check the tsdown documentation for more details.
NPM Scripts
Run with:
pnpm <script>or
npm run <script>dev- Starts the bundler in watch mode over./src.build- Bundles the package using Rolldown and outputs to the./distfolder.check- Runs Biome to lint and format the code.check:write- Runs Biome to automatically fix linting and formatting issues.test- Runs Vitest to execute the unit tests.test:watch- Runs Vitest in watch mode for continuous testing during development.changelog- Generates or updates theCHANGELOG.mdfile usinggit-cliff.publish- Publishes the package to NPM usingnp.publish:all- Builds before publishing it to NPM.
How to use
- Clone this repository. Alternatively, you can use this template when creating a new repository on GitHub by selecting the "Use this template" option. This will create a new repository with the same structure and files as this template.
- Run
pnpm installto install the dependencies. - Modify the
package.jsonfile to set your packagename,version,description,author, and other relevant information. - You are ready to start coding your TypeScript package!
License
This project is licensed under the MIT License - see the LICENSE file for details.
