Boilerplate for building a TypeScript + Rollup + Vite module that can be published to NPM.
Package Name | Version |
---|---|
TypeScript | |
Preact | |
Htm | |
Jest | |
Rollup | |
Rollup-plugin-dts | |
Rollup-plugin-typescript2 | |
Rollup-plugin-uglify | |
@rollup/plugin-node-resolve | |
Vite | |
Eslint | |
Prettier |
After visiting this link, Fork the repository.
git clone https://github.com/<YOUR_GITHUB_NAME>/ts-rollup-npm-vite-boilerplate
cd ts-rollup-npm-vite-boilerplate
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.
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 @
.
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`)
If you have successfully set up CodeCov, if you push or PR to the main
branch, CodeCov Coverage is automatically updated.
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: