https://github.com/maxgfr/typescript-swc-starter
A minimalist typescript swc starter that generate cjs and esm package
https://github.com/maxgfr/typescript-swc-starter
boilerplate cjs dotenv eslint esm jest node nodejs nodemon prettier rust-compiler starter starter-kit swc typescript unbuild
Last synced: 2 months ago
JSON representation
A minimalist typescript swc starter that generate cjs and esm package
- Host: GitHub
- URL: https://github.com/maxgfr/typescript-swc-starter
- Owner: maxgfr
- License: mit
- Created: 2022-03-06T15:12:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T17:53:33.000Z (about 1 year ago)
- Last Synced: 2025-04-07T18:44:16.810Z (about 1 year ago)
- Topics: boilerplate, cjs, dotenv, eslint, esm, jest, node, nodejs, nodemon, prettier, rust-compiler, starter, starter-kit, swc, typescript, unbuild
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/typescript-swc-starter
- Size: 3.5 MB
- Stars: 31
- Watchers: 1
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# typescript-swc-starter
[](https://github.com/maxgfr/typescript-swc-starter/actions/workflows/build.yml)
[](https://github.com/maxgfr/typescript-swc-starter/actions/workflows/test.yml)
[](https://opensource.org/licenses/MIT)
A minimalist TypeScript boilerplate using [SWC](https://swc.rs/) for blazing-fast compilation. Generates both `cjs` and `esm` modules.
## โจ Features
- โก **SWC** - Super-fast TypeScript/JavaScript compiler
- ๐ฆ **Dual package** - Outputs both CommonJS and ES Modules
- ๐งช **Jest** - Testing with SWC for speed
- ๐จ **Biome** - Fast linting and formatting
- ๐ **Nodemon** - Hot reload during development
- ๐ **Semantic Release** - Automated versioning and publishing
- ๐ **Husky + lint-staged** - Pre-commit hooks
## ๐ Prerequisites
- Node.js >= 24
- pnpm
## ๐ Getting Started
```sh
# Clone the repository
git clone https://github.com/maxgfr/typescript-swc-starter
cd typescript-swc-starter
# Install dependencies
pnpm install
```
## ๐ Scripts
### Development
```sh
pnpm dev # Run in development mode with hot reload
pnpm develop # Run source code with SWC register
```
### Testing
```sh
pnpm test # Run tests
pnpm test:watch # Run tests in watch mode
pnpm test:coverage # Run tests with coverage
```
### Linting & Formatting
```sh
pnpm lint # Lint code with Biome
pnpm lint:fix # Lint and fix issues
pnpm format # Check formatting
pnpm format:fix # Format code
pnpm check # Run both lint and format checks
pnpm check:fix # Fix both lint and format issues
```
### Building
```sh
pnpm build # Compile with SWC
pnpm bundle # Bundle for distribution (cjs + esm)
pnpm clean # Clean build artifacts
```
### Running Built Code
```sh
pnpm start:cjs # Run CommonJS build
pnpm start:esm # Run ES Module build
```
## ๐ฆ Publishing to npm
This project uses OIDC for npm publishing - no `NPM_TOKEN` required!
1. Go to your npm package's access page: `https://www.npmjs.com/package//access`
2. Set your details and trust publisher

## ๐ Usage
```ts
import { sayHello } from 'typescript-swc-starter';
sayHello();
```
## ๐ License
MIT ยฉ [maxgfr](https://github.com/maxgfr)