面向 Node 工具库开发与 npm 发布的 TypeScript 启动器模板
vite-vanilla-ts-module — Vite 启动器模板
作者 entwurfhaus
基于 Vite 的 vanilla-ts 扩展启动器模板,用于在 TypeScript 中编写 Node 工具库并发布到 npm。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
内置并配置 husky、vitest、vitest ui、vite、vite-plugin-dts、vite-plugin-eslint、eslint、prettier
commitlint、vite-plugin-progress、@trivago/prettier-plugin-sort-imports 为可选依赖,可按需移除
提供 yarn dev、yarn test、yarn test:coverage、yarn build 等脚本流程
README 说明可集成到 turborepo 与 nx 等 monorepo 框架
采用 MIT 许可,仓库中附有许可证文件
模板详细介绍
该模板是 entwurfhaus 维护的 vanilla-ts 扩展版启动器,最初从 Vite 3.x 起步,目标场景是在 TypeScript 中编写 Node 工具库,并快速完成开发与发布到 npm 的流程。仓库同时使用 vite-vanilla-ts-template-extended 与 vite-vanilla-ts-module 两个名称。
模板内置并配置了 husky、vitest、vitest ui、vite、vite-plugin-dts、vite-plugin-eslint、eslint、prettier 等依赖;commitlint、vite-plugin-progress、@trivago/prettier-plugin-sort-imports 被标注为可选,可按需移除。README 说明引入这些依赖的目的包括:快速构建自定义 Node 库、便于集成到 turborepo 与 nx 等 monorepo 框架、减少依赖管理开销、提供 lint 与自动排序等效率功能,以及改善开发体验。
使用流程上,先执行 yarn 与 yarn prepare 安装依赖并初始化 husky,再通过 npx husky add 添加 pre-commit 钩子(执行 yarn build 与 yarn prettier),并可用 commitlint 约束 conventional commit 消息。测试使用 yarn test 或 yarn test:coverage 生成覆盖率报告;yarn dev 会在 http://localhost:5174 打开 index.html,其中包含指向 stats.html 与覆盖率 index.html 的快捷链接;yarn build 输出到 dist 目录。发布时执行 npm login 与 npm publish。README 提到项目使用 typedoc 生成 docs 目录,并给出示例站点链接。
需要注意的限制:README 未给出具体的框架版本号,也未说明性能或生产就绪程度;构建或类型报错时,README 建议检查 package.json 的 main、module、typings、files 等字段、tsconfig.json(如 allowJs)以及依赖版本(尤其是 vite)。演示图片、字体、图标等第三方素材需按各自许可核对。
适合你的项目吗?
适用场景
- 在 TypeScript 中编写 Node 工具库并准备发布到 npm
- 为自定义 Node 包配置 husky pre-commit、eslint、prettier 等开发流程
- 使用 vitest 与 vitest ui 编写测试并生成覆盖率报告
- 将构建产物集成到 turborepo 或 nx 等 monorepo 框架中
- 通过 vite-plugin-dts 生成类型声明并输出到 dist 目录
适合人群
- 需要快速搭建 Node 工具库项目骨架的 TypeScript 开发者
- 希望统一 lint、格式化与提交规范的团队
- 计划将自建包发布到 npm 的个人或团队
- 使用 turborepo 或 nx 管理多包仓库的开发者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
执行 yarn 安装依赖,再执行 yarn prepare 初始化 husky
- 2
用 npx husky add .husky/pre-commit "yarn build" 与 npx husky add .husky/pre-commit "yarn prettier" 添加 pre-commit 钩子
- 3
如需约束提交信息,创建 commitlint.config.js 并继承 @commitlint/config-conventional
- 4
yarn dev 在 http://localhost:5174 打开 index.html,yarn build 输出到 dist 目录
- 5
发布前执行 npm login 与 npm publish;构建或类型报错时检查 package.json、tsconfig.json 与依赖版本
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 发布到 npm 需要拥有 npm 账号并登录,属于外部服务账号要求;模板本身不提供 npm 发布服务。
- 集成到 turborepo 或 nx 属于可选使用场景,需自行安装并配置这些外部 monorepo 工具,模板不包含它们。
- commitlint 为可选依赖,若不需要强制 conventional commit 规范可自行移除。
- vite-plugin-progress 为可选依赖,若不需要终端进度条可自行移除。
- @trivago/prettier-plugin-sort-imports 为可选依赖,用于自动排序 import,需自行设定排序规则。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
npm login npm publish
README 原文
Easily integrate the built custom `node` library, into any monorepo framework - primarily `turborepo` and `nx`.
README 原文
commitlint](https://commitlint.js.org/guides/getting-started.html) - optional, remove if yourself / team does not require enforcing conventional commits.
README 原文
vite-plugin-progress](https://github.com/jeddygong/vite-plugin-progress) - optional, remove if yourself / team does not require
README 原文
https://github.com/entwurfhaus/vite-vanilla-ts-module/blob/develop/LICENSE.mdhttps://github.com/entwurfhaus/vite-vanilla-ts-module/blob/develop/README.md@trivago/prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports) - optional, auto-sort your import order in each file, set your own "sort rules".
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 86 / 100
- 技术栈
- Vite · HTML
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2024-10-13
- 截图检查日期
- 2026-10-03
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Vite。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: 2e7c59254fbfad2aeec8ed25448a80756d2b43d999147ace0137672c015f8573
2026-10-03T18:54:38.898Z
来源文件 / 仓库# vite-vanilla-ts-template-extended (AKA `vite-vanilla-ts-module`)
<p align="center">
<img alt="license" src="https://img.shields.io/github/license/entwurfhaus/vite-vanilla-ts-module?style=flat-square" />
<img alt="release" src="https://img.shields.io/github/v/tag/entwurfhaus/vite-vanilla-ts-module?label=release&style=flat-square" />
<img alt="github stars" src="https://img.shields.io/github/stars/entwurfhaus/vite-vanilla-ts-module?style=flat-square" />
<img alt="GitHub Workflow Status (with event)" src="https://img.shields.io/github/actions/workflow/status/entwurfhaus/vite-vanilla-ts-module/develop.yml?style=flat-square" />
</p>
<p align="center">
<img alt="bundlephobia" src="https://img.shields.io/bundlephobia/min/@entwurfhaus/vite-vanilla-ts-module?style=flat-square" />
<img alt="vulnerabilities" src="https://img.shields.io/snyk/vulnerabilities/npm/@entwurfhaus/vite-vanilla-ts-module?style=flat-square" />
</p>
> Update: If you prefer a minimalist vite-vanilla-ts-template, check out https://github.com/entwurfhaus/vite-vanilla-ts-template.
A starter `vanilla-ts` (extended) template that began with Vite 3.x, prepared for writing `node` utility libraries in `typescript`. This starter is meant to provide rapid `node` package development and publishing onto `npm`.
## What is in this template?
Below are notable dependencies bundled (and configured) in this library template:
1. [husky](https://typicode.github.io/husky/get-started.html)
1. [vitest](https://vitest.dev/)
1. [vitest ui](https://vitest.dev/guide/ui.html)
1. [vite](https://vitejs.dev/guide/)
1. [vite-plugin-dts](https://github.com/qmhc/vite-plugin-dts)
1. [vite-plugin-eslint](https://github.com/gxmari007/vite-plugin-eslint)
1. [eslint](https://eslint.org/)
1. [prettier](https://prettier.io/)
### Optional dependencies
And notable optional dependencies, great to use for improved DX etc:
1. [commitlint](https://commitlint.js.org/guides/getting-started.html) - optional, remove if yourself / team does not require enforcing conventional commits.
1. [vite-plugin-progress](https://github.com/jeddygong/vite-plugin-progress) - optional, remove if yourself / team does not require :sparkles: fancy :sparkles: progress bar in terminal.
1. [@trivago/prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports) - optional, auto-sort your import order in each file, set your own "sort rules".
### Goal of included dependencies
Know that the above dependencies are (mostly) optional, and you may extend or remove them to your preference. The goal of introducing these dependencies as part of the template, is to:
1. Easily build a custom `node` library, fast (with some style).
1. Easily integrate the built custom `node` library, into any monorepo framework - primarily `turborepo` and `nx`.
1. Reduce overhead management of dependencies. For example, you can add [taze](https://github.com/antfu/taze) library.
1. Providing comfort in utilising efficient (linting, auto-sort, etc) productivity features.
1. Improving the overall developer experience (DX) with this template.
## Getting Started
Let's install our dependencies, then pre-setup our `husky` pre-commits:
```bash
yarn
yarn prepare
npx husky add .husky/pre-commit "yarn build"
npx husky add .husky/pre-commit "yarn prettier"
```
Then, your `.husky/pre-commit` file should look like below:
```bash
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn build
yarn prettier
```
And since we introduced [commitlint](https://commitlint.js.org/guides/getting-started.html), we can enforce "conventional commit" messages with `husky`:
```bash
echo "export default { extends: ["@commitlint/config-conventional"] };" > commitlint.config.js
```
## Testing with Vitest
Run `yarn test` or `yarn test:coverage` to produce code coverage report.
The code coverage report will indicate, if all test cases are 100% covered, flawed logic and so on.
## Running `vite`
Run `yarn dev` to open `index.html` via `http://localhost:5174`.
It contains some quick links, to the `stats.html` and coverage `index.html` files.
## Build your package
Run `yarn build`, and check the `dist` folder for the final build output.
> If there are issues with the package, check `package.json` (props `main`, `module`, `typings`, `files` and etc), `tsconfig.json` (such as `allowJs`) and dependency versions (especially `vite`) to narrow down the build or typings errors you're experiencing.
## Publishing
And when ready to publish to `npm`:
```
npm login
npm publish
```
Also, since `typedoc` is used here - this is an example of the generated `docs` folder, see https://vite-vanilla-ts-template-extended.vercel.app.
If you would like to preview an example of how your NPM package is published, take a look at https://entwurfhaus-demo-react-app.vercel.app/ that have this template installed & used.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

react-starter-kit
Modern React starter kit with Bun, TypeScript, Tailwind CSS, tRPC, Stripe, and Cloudflare Workers. Production-…
Vite · SaaS

cove
The Cove Stack: 🏝️ minimal TanStack Start template with Vite+, Better Auth, Drizzle ORM, shadcn/ui
Vite · SaaS

vite-react-boilerplate
A production ready, scalable starter template for Vite + React
Vite · 启动器

react-vite-admin
This Starter utilizes React, Recoil, React Query, React Hooks, Typescript, Axios And Vite. 全新技术栈的后台管理系统
Vite · 后台

typescript-react_best_practices-vite_template
<⚡⚛️> Start your React project with Vite following code best practices (TypeScript, Linting, testing, CI/CD…)
Vite · 启动器

cloudflare-starter-kit
Template (boilerplate) repository for scaffolding Cloudflare Workers projects
Vite · 启动器
