tanstack-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTanStack Config
TanStack Config
Overview
概述
TanStack Config provides opinionated tooling to build, version, and publish JavaScript/TypeScript packages with minimal configuration and consistent results. It uses Vite for library builds with automatic dual ESM/CJS output and type generation, plus automated publishing with conventional-commit-based versioning.
When to use: Building TanStack libraries or packages that follow TanStack conventions, contributing to TanStack open-source projects, setting up dual ESM/CJS library builds with Vite, automating package publishing with conventional commits.
When NOT to use: Application builds (use framework-specific tooling), non-library projects, projects not using pnpm, projects that need non-Vite build pipelines.
TanStack Config 提供约定式工具,可通过最少配置实现JavaScript/TypeScript包的构建、版本化与发布,并保证结果一致性。它采用Vite进行库构建,自动生成ESM/CJS双格式输出及类型定义,同时支持基于约定式提交的自动化版本管理与发布。
适用场景:构建遵循TanStack惯例的TanStack库或包,为TanStack开源项目做贡献,使用Vite搭建ESM/CJS双输出的库构建流程,通过约定式提交实现包发布自动化。
不适用场景:应用构建(请使用框架专属工具),非库类项目,不使用pnpm的项目,需要非Vite构建流水线的项目。
Quick Reference
快速参考
| Pattern | API / Package | Key Points |
|---|---|---|
| Vite build config | | Merge with |
| Entry point | | Single file or array of entry files |
| Source directory | | Used for declaration file generation |
| CJS output | | Generates |
| External deps | | Auto-detected from |
| Bundled deps | | Bundle instead of externalize |
| Exclude from types | | Patterns to skip during type generation |
| Custom tsconfig | | Override default tsconfig for builds |
| Declaration hook | | Transform |
| Publish automation | | Conventional commits drive versioning |
| Branch configs | | Control prerelease and stable channels |
| Package list | | Monorepo package definitions |
| Build script | | Standard build with strict linting |
| 模式 | API / 包 | 关键点 |
|---|---|---|
| Vite构建配置 | | 通过 |
| 入口文件 | | 单个文件或多个文件组成的数组 |
| 源码目录 | | 用于生成声明文件 |
| CJS输出 | | 在ESM输出之外同时生成 |
| 外部依赖 | | 从 |
| 打包依赖 | | 打包进库而非标记为外部依赖 |
| 类型排除文件 | | 类型生成过程中需要跳过的文件模式 |
| 自定义tsconfig | | 覆盖构建使用的默认tsconfig |
| 声明文件钩子 | | 在写入 |
| 发布自动化 | | 基于约定式提交驱动版本管理 |
| 分支配置 | | 控制预发布和稳定版本渠道 |
| 包列表 | | 单仓库多包(Monorepo)的包定义 |
| 构建脚本 | | 带严格检查的标准构建流程 |
Common Mistakes
常见错误
| Mistake | Correct Pattern |
|---|---|
Missing | Set |
Using | Use |
Forgetting | Both are required for |
Missing | Define |
Not awaiting | Handle with |
| Using npm or yarn instead of pnpm | pnpm is the only supported package manager |
Omitting | Add |
Setting | Manual version tags must start with |
| Wrong commit type for release level | |
| 错误做法 | 正确方式 |
|---|---|
| 对于ESM优先的构建,设置 |
单独使用 | 使用 |
遗漏 | 这两个配置项是 |
| 定义包含类型的 |
未等待 | 使用 |
| 使用npm或yarn而非pnpm | pnpm是唯一支持的包管理器 |
构建脚本中省略 | 在 |
设置 | 手动版本标签必须以 |
| 提交类型与发布版本级别不匹配 | |
Requirements
依赖要求
- Node.js v18.17+
- pnpm v8+
- Git CLI
- GitHub CLI (pre-installed on GitHub Actions)
- Vite (peer dependency for build config)
- publint (recommended for build validation)
- Node.js v18.17+
- pnpm v8+
- Git CLI
- GitHub CLI(GitHub Actions中已预装)
- Vite(构建配置的对等依赖)
- publint(推荐用于构建验证)
Delegation
任务委托
- Build configuration review: Use agent to verify Vite config and
Taskexportspackage.json - Publishing workflow setup: Use agent to check CI/CD integration patterns
Explore - Package validation: Run after builds to catch packaging issues
publint --strict
- 构建配置审核:使用代理验证Vite配置和
Task的exports字段package.json - 发布工作流设置:使用代理检查CI/CD集成模式
Explore - 包验证:构建后运行以捕获打包问题
publint --strict
References
参考资料
- Configuration and Vite plugin setup
- Publishing and version management
- 配置与Vite插件设置
- 发布与版本管理