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.
- Host: GitHub
- URL: https://github.com/jellydn/typescript-mini-starter
- Owner: jellydn
- License: mit
- Created: 2023-11-25T07:51:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T13:19:31.000Z (over 1 year ago)
- Last Synced: 2024-05-02T02:29:32.335Z (over 1 year ago)
- Topics: cjs, esm, starter, typescript
- Language: TypeScript
- Homepage:
- Size: 239 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Welcome to typescript-mini-starter ๐
[](#License)
[](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!
[](https://ko-fi.com/dunghd)
[](https://paypal.me/dunghd)
[](https://www.buymeacoffee.com/dunghd)