@fluixi/cli

中文文档
1.0.0-alpha.108发布于 2026/11/07MITTypeScriptESM + CJS近 30 天下载 2222

The fluixi command-line tool — dev/build/start (via @fluixi/start) and, later, scaffolding + generators.

原始使用文档
文档目录7 节
  1. ✨ Overview
  2. 📦 Installation
  3. 🧱 generate
  4. JSX or html``
  5. Using a component without importing it
  6. 🆕 New project
  7. 📄 License

Fluixi

@fluixi/cli

The fluixi command-line tool: dev / build / start + code generators.

License: MIT TypeScript npm


✨ Overview

@fluixi/cli provides the fluixi binary: a thin dispatcher over @fluixi/start (the framework runtime) plus generators. A scaffolded app already includes it.

fluixi dev                    # SSR dev server (Vite middleware + HMR)
fluixi build                  # client + server bundles → dist/client, dist/server
fluixi start                  # production SSR server (after build)
fluixi generate <kind> <name> # scaffold into the current app (alias: g)
fluixi check [--strict]       # env and auth rules over the project; exit 1 on an error
fluixi env                    # env.public set or not, .env.example drift, secrets that would ship
fluixi doctor                 # duplicate @fluixi/* copies, ts-plugin missing from tsconfig
fluixi info                   # versions, adapter, modules, pages, API routes

📦 Installation

pnpm add -D @fluixi/cli

🧱 generate

fluixi g component Button       # → src/components/Button.tsx
fluixi g route about            # → src/routes/about.tsx        (file route)
fluixi g route "blog/[id]"      # → src/routes/blog/[id].tsx    (dynamic segment)
fluixi g middleware             # → src/middleware.ts
fluixi g env                    # → src/config/env.ts           (pickEnv over env.public)
fluixi g module billing         # → src/services/billing/billing.module.ts, listed in src/app.config.ts
fluixi g service Orders         # → src/services/orders.ts       (class, token, module)
fluixi g service Mailer --server  # → src/services/mailer.server.ts, listed in src/app.config.server.ts
fluixi g api "users/[id]"       # → src/api/users/[id].ts
fluixi g api admin/stats --role admin  # → guarded route + src/services/verify.server.ts
fluixi g server-fn getUser      # → src/server/getUser.ts        ("use server")
fluixi g auth oauth2 --provider keycloak --tokens server
                                # → config/env.ts, services/auth.ts, login route, auth.server.ts,
                                #   env.public and .env.example entries
fluixi g auth better-auth       # → auth.config + auth.client + middleware + src/api/auth route

New files are written unless a file with the same name already exists, in which case the process stops with an error. Edits are limited to app.config.ts, app.config.server.ts (adding an import and entry), env.public in fluixi.config.ts, and appending to .env.example; the original layout of each file is preserved, and when imports are not a plain list the command prints the lines for manual pasting. Multi-file OAuth2 generation keeps any existing files unchanged.

JSX or html``

The extension follows the project: an app whose tsconfig.json configures jsx gets .tsx, one authored with html `` templates gets .ts. Override with --jsx or --html.

fluixi g component Button --html   # → src/components/Button.ts

Using a component without importing it

After generating a component, the CLI prints how to make the tag resolve with no import, if the project has no rule for it yet:

✓ created src/components/Card.tsx
to use <Card /> without importing it, add to vite.config.ts:
  resolve: [{ match: /^([A-Z]\w+)$/, module: '/src/components/$1.tsx' }]

One pattern covers the whole folder, so you paste it once and every component after that works. Apps scaffolded with npm create fluixi already have it.

The CLI reads your config to decide whether to say this, and never writes to it. A config is ordinary TypeScript, it can spread a shared object or call a resolver function, so editing it would mean reprinting your file, and I'd rather print a line you paste than risk mangling it.

Importing the component works too, including with a load: directive:

import { Card } from './components/Card';

<Card load:visible="200px" />   // still splits into its own chunk

🆕 New project

Scaffolding a whole app is create-fluixi, not the CLI:

npm create fluixi my-app      # or: pnpm create fluixi my-app

The dev/build/start logic + config live in @fluixi/start: see its README for conventions (src/entry-server.ts, src/routes/, index.html, fluixi.config.ts).

📄 License

MIT © Fluixi

版本与发布记录

@fluixi/cli 共发布 56 个版本,首次发布于 2026/07/10;过去 12 个月发布了 56 个版本。

版本发布日期距今
1.0.0-alpha.108latest2026/11/078 天前
1.0.0-alpha.1072026/11/0511 天前
1.0.0-alpha.1062026/11/0213 天前
1.0.0-alpha.1052026/11/0115 天前
1.0.0-alpha.1042026/11/0115 天前
1.0.0-alpha.1032026/10/2620 天前

关于 @fluixi/cli 的常见问题

@fluixi/cli 是什么?

The fluixi command-line tool — dev/build/start (via @fluixi/start) and, later, scaffolding + generators.

如何安装 @fluixi/cli?

在项目目录运行 npm install @fluixi/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 fluixi,可以用 npx fluixi 直接运行。

@fluixi/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fluixi/cli 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fluixi/cli 可以商用吗?

@fluixi/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fluixi/cli 的下载量有多少?

根据 npm 官方下载统计,@fluixi/cli 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,222 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fluixi/cli 还在维护吗?

最新版本 1.0.0-alpha.108 发布于 2026/11/07(8 天前);至今共发布 56 个版本,其中过去 12 个月发布了 56 个;首次发布于 2026/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。