Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbysiec/vite-vanilla-ts-lib-starter
The starter is built on top of Vite 5.x and prepared for writing libraries in TypeScript. It generates a package with support for ESM modules and IIFE.
https://github.com/kbysiec/vite-vanilla-ts-lib-starter
eslint husky prettier stylelint template typescript vite vitest
Last synced: 5 days ago
JSON representation
The starter is built on top of Vite 5.x and prepared for writing libraries in TypeScript. It generates a package with support for ESM modules and IIFE.
- Host: GitHub
- URL: https://github.com/kbysiec/vite-vanilla-ts-lib-starter
- Owner: kbysiec
- License: mit
- Created: 2022-03-25T22:47:38.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-11T11:16:14.000Z (6 months ago)
- Last Synced: 2025-01-20T08:04:00.410Z (13 days ago)
- Topics: eslint, husky, prettier, stylelint, template, typescript, vite, vitest
- Language: TypeScript
- Homepage:
- Size: 401 KB
- Stars: 301
- Watchers: 5
- Forks: 32
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- fucking-awesome-vite - vite-vanilla-ts-lib-starter - Starter for library (CJS, ESM, IIFE) with TypeScript, ESLint, Stylelint, Prettier, Jest, Husky + lint-staged. (Get Started / Templates)
- awesome-vite - vite-vanilla-ts-lib-starter - Starter for library (CJS, ESM, IIFE) with TypeScript, ESLint, Stylelint, Prettier, Jest, Husky + lint-staged. (Get Started / Templates)
README
# vite-vanilla-ts-lib-starter
The starter is built on top of Vite 5.x and prepared for writing libraries in TypeScript. It generates a package with support for ESM modules and IIFE.
## Features
- ESM modules
- IIFE bundle for direct browser support without bundler
- Typings bundle
- ESLint - scripts linter
- Stylelint - styles linter
- Prettier - formatter
- Vitest - test framework
- Husky + lint-staged - pre-commit git hook set up for formatting## GitHub Template
This is a template repo. Click the green [Use this template](https://github.com/kbysiec/vite-vanilla-ts-lib-starter/generate) button to get started.
## Clone to local
If you prefer to do it manually with the cleaner git history
```bash
git clone https://github.com/kbysiec/vite-vanilla-ts-lib-starter.git
cd vite-vanilla-ts-lib-starter
npm i
```## Checklist
When you use this template, update the following:
- Remove `.git` directory and run `git init` to clean up the history
- Change the name in `package.json` - it will be the name of the IIFE bundle global variable and bundle files name (`.cjs`, `.mjs`, `.iife.js`, `d.ts`)
- Change the author name in `LICENSE`
- Clean up the `README` and `CHANGELOG` filesAnd, enjoy :)
## Usage
The starter contains the following scripts:
- `dev` - starts dev server
- `build` - generates the following bundles: ESM (`.js`) and IIFE (`.iife.js`). The name of bundle is automatically taken from `package.json` name property
- `test` - starts vitest and runs all tests
- `test:coverage` - starts vitest and run all tests with code coverage report
- `lint:scripts` - lint `.ts` files with eslint
- `lint:styles` - lint `.css` and `.scss` files with stylelint
- `format:scripts` - format `.ts`, `.html` and `.json` files with prettier
- `format:styles` - format `.cs` and `.scss` files with stylelint
- `format` - format all with prettier and stylelint
- `prepare` - script for setting up husky pre-commit hook
- `uninstall-husky` - script for removing husky from repository## Acknowledgment
If you found it useful somehow, I would be grateful if you could leave a star in the project's GitHub repository.
Thank you.