An open API service indexing awesome lists of open source software.

https://github.com/jellydn/typescript-mini-starter

A streamlined and efficient TypeScript starter kit, supporting both ESM and CJS, for quick and versatile project setups.
https://github.com/jellydn/typescript-mini-starter

cjs esm starter typescript

Last synced: 7 months ago
JSON representation

A streamlined and efficient TypeScript starter kit, supporting both ESM and CJS, for quick and versatile project setups.

Awesome Lists containing this project

README

          

# Welcome to typescript-mini-starter ๐Ÿ‘‹

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#License)
[![Twitter: jellydn](https://img.shields.io/twitter/follow/jellydn.svg?style=social)](https://twitter.com/jellydn)

**A streamlined and efficient TypeScript starter kit, supporting both ESM and CJS, for quick and versatile project setups.**

[![IT Man - Seamless Transition: Migrating from #CommonJS to #ESM in JavaScript [Vietnamese]](https://i.ytimg.com/vi/VVPFDCyeNyY/hqdefault.jpg)](https://www.youtube.com/watch?v=VVPFDCyeNyY)

## ๐Ÿš€ Introduction

`typescript-mini-starter` is designed to be a robust and minimalistic starting point for TypeScript development, catering to the modern JavaScript ecosystem. This starter kit uniquely supports both ECMAScript Modules (ESM) and CommonJS (CJS) formats, ensuring compatibility and flexibility for various use cases and environments. Whether you are building a library, an application, or a service, this starter kit provides a quick and easy setup, enabling developers to jump straight into coding with TypeScript's best practices and the versatility of module systems in mind.

## ๐Ÿ“ฆ Install

Easily set up the project with the following command:

```sh
yarn install
```

This will install all the necessary dependencies to get you started.

## ๐Ÿ”จ Usage

To compile your TypeScript code:

```sh
yarn build
```

This command will build your project, preparing it for execution or deployment.

## ๐ŸŒŸ Example

Run an example to see `typescript-mini-starter` in action:

```sh
yarn example
```

This is a great way to understand how the project works and can be extended.

## ๐Ÿงช Run tests

Ensure the reliability of your code by running tests:

```sh
yarn test
```

This helps in maintaining code quality and catching bugs early.

## ๐Ÿšš Using `npx degit` to Scaffold Your Project

Easily scaffold a new TypeScript project with `typescript-mini-starter` using `npx degit`. This method is especially handy for integrating the starter into monorepos or initializing a standalone project quickly.

### For Standalone Projects

1. **Create a new project directory and navigate into it:**

```sh
mkdir my-new-project
cd my-new-project
```

2. **Use `degit` to download the mini-starter template:**

```sh
npx degit jellydn/typescript-mini-starter
```

3. **Install dependencies and get started:**

```sh
yarn install
```

### For Monorepos (e.g., with [Turbo](https://turbo.build/repo))

1. **Navigate to your monorepo's packages directory:**

```sh
cd path/to/your/monorepo/packages
```

2. **Create a new package folder:**

```sh
mkdir my-new-package
cd my-new-package
```

3. **Download the mini-starter template into the new package:**

```sh
npx degit jellydn/typescript-mini-starter
```

4. **Proceed with your monorepo's workflow to integrate the new package.**

This approach is efficient and reduces the time to set up a new TypeScript project, allowing you to focus more on development.

## Pre-commit

This project uses [Pre-Commit](https://pre-commit.com/) to run checks before committing changes. This ensures that the codebase is clean and consistent, maintaining high quality and readability.

```sh
pre-commit install
```

## ๐Ÿ™Œ Credits

Special thanks to the following projects and their maintainers for their invaluable contributions:

- [privatenumber/tsx](https://github.com/privatenumber/tsx): โšก๏ธ TypeScript Execute: Node.js enhanced to run TypeScript & ESM.
- [privatenumber/pkgroll](https://github.com/privatenumber/pkgroll): ๐Ÿ“ฆ ๐Ÿฃ Next-gen package bundler for TypeScript & ESM.
- Alternatively, consider [egoist/tsup](https://github.com/egoist/tsup): The simplest and fastest way to bundle your TypeScript libraries. It offers additional customization options if you're looking for a different approach from pkgroll.

Their tools and libraries have significantly contributed to the development and functionality of `typescript-mini-starter`.

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

## โœ๏ธ Author

๐Ÿ‘ค **Huynh Duc Dung**

- Website: [productsway.com](https://productsway.com/)
- Twitter: [@jellydn](https://twitter.com/jellydn)
- GitHub: [@jellydn](https://github.com/jellydn)

Feel free to reach out if you have any questions or suggestions!

## ๐ŸŒŸ Show your support

Liked the project? Give it a โญ๏ธ on [GitHub](https://github.com/jellydn/typescript-mini-starter) to show your support and appreciation!

[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/dunghd)
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/dunghd)
[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/dunghd)