ts-rollup-npm-vite-boilerplate
v1.0.2
Published
Boilerplate for building a TypeScript + Rollup + Vite module that can be published to NPM.
Downloads
2
Maintainers
Readme
ts-rollup-npm-vite-boilerplate
Boilerplate for building a TypeScript + Rollup + Vite module that can be published to NPM.
⭐️ Included Packages
| Package Name | Version | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | TypeScript | | | Preact | | | Htm | | | Jest | | | Rollup | | | Rollup-plugin-dts | | | Rollup-plugin-typescript2 | | | Rollup-plugin-uglify | | | @rollup/plugin-node-resolve | | | Vite | | | Eslint | | | Prettier | |
🚀 Installation
1. Fork this Repo
After visiting this link, Fork the repository.
2. Clone your Repo
git clone https://github.com/<YOUR_GITHUB_NAME>/ts-rollup-npm-vite-boilerplate
cd ts-rollup-npm-vite-boilerplate
3. Edit the Package name, Version and Description
4. Set CODECOV_TOKEN
(Optional)
If you don't need CodeCov CI, you should delete the .github/workflows/ci.yml file.
Step 1: Visite CodeCov CI and get CODECOV_TOKEN
for your repository.
Copy the Upload Token
text.
Step 2: Enter the token with the name CODECOV_TOKEN
in the Secrets of your GitHub repository.
5. Set NPM_TOKEN
(Optional)
If you don't need to Deploy with NPM, you should delete the .github/workflows/publish.yml file.
Step 1: Visite NPM and get NPM_TOKEN
for your repository.
Click the Generate New Token
Button
When generating a token, it must be created as an automation
token.
Copy the NPM Token
text.
Step 2: Enter the token with the name NPM_TOKEN
in the Secrets of your GitHub repository.
Step 3: Edit the NPM account name in the publish.yml file
Don't forget the @
.
🛠 Usage
Scripts
pnpm install # or (yarn|npm) install
pnpm test # unit tests
pnpm lint
pnpm build # production build
pnpm build:watch # for debug modules only
pnpm build:sandbox # for debug modules with sandbox (alias `pnpm start`)
CodeCov CI
If you have successfully set up CodeCov, if you push or PR to the main
branch, CodeCov Coverage is automatically updated.
Publish to NPM
First, you need to deploy module with a Tag on GitHub using the npm version patch
command.
# Update module version (This command changes `package.json`)
npm version patch
# Push to GitHub
git push origin main
git push origin <VERSION> # <VERSION> = vX.X.X
Then Create and Publish a new release on GitHub.
After completing the above process, you will see the NPM module deploy to @npm-account-name/<PACKAGE_NAME>
like this: