用途:以偏好化方式初始化现代前端项目,用快速工具链替代常见工具。
主要能力与替代关系:Bun 用作包管理器与运行时,替代 npm/yarn/pnpm;Oxfmt 作格式化器替代 Prettier;Oxlint 作 linter 替代 ESLint;tsdown 作库打包器替代 tsup、rollup;tsgo 作类型检查器替代 tsc。
使用方式:先执行 bun init my-project 并进入目录;按项目类型安装工具,应用执行 bun add -d oxlint oxfmt,库额外加 tsdown @typescript/native-preview;用 bunx oxlint --init 初始化配置,并在 package.json 添加 lint、lint:fix、format、format:check、typecheck 等脚本。库项目需配置入口、exports 与 tsdown.config.ts。React 项目用 bun init my-react-app --template react,并在 .oxlintrc.json 加入 react、react-hooks 插件。配置涉及 .oxlintrc.json、可选 .oxfmtrc.json、tsconfig.json 和 .gitignore;编辑器可设置默认格式化器为 oxc.oxc-vscode,CI 可用 oven-sh/setup-bun@v2 后依次运行 lint、format:check、typecheck、build。
适用场景:新前端应用、npm 库与 React 项目的快速搭建和统一工具链。
限制:Bun、Oxlint、tsdown 稳定,Oxfmt 处于 alpha,tsgo 处于 preview;从已有项目迁移需删除 node_modules 与 lockfile、重新安装、移除 eslint/prettier 配置并更新脚本。具体功能、收费、平台与效果资料未提供。