@fluid-app/fluid-cli-portal

中文文档
0.1.1136发布于 2026/11/15TypeScriptES Module近 30 天下载 18.7万

Fluid CLI plugin for building portal applications

原始使用文档
文档目录9 节
  1. Create a portal project
  2. One-time setup
  3. Authenticate
  4. Pull a definition
  5. Edit & preview
  6. Push changes back
  7. Publish portal versions (only when you want manifest change…
  8. Publish widget runtime artifacts
  9. Handy commands

Fluid Portal CLI — Pull & Push App Manifests

The Fluid CLI lets you pull a Fluid OS definition (your app manifest — screens, themes, navigations, profiles) into local JSON files, edit them, and push them back to production.

Create a portal project

fluid portal create my-portal

Creation uses the bundled canonical starter by default. Pass --remote-template only when you intentionally want the GitHub mirror, or --skip-install when you want scaffold-only output. A current scaffold uses createPortal({ customPages }), keeps company widget packages in src/widgets.config.ts, and does not contain iframe preview entries.

One-time setup

  • Build the CLI (from the repo root):

    pnpm --filter @fluid-app/fluid-cli --filter @fluid-app/fluid-cli-portal build
    
  • The fluid binary is then at packages/cli/core/dist/bin/fluid.mjs. Optionally alias it:

    alias fluid="node /path/to/repo/packages/cli/core/dist/bin/fluid.mjs"
    

    (All examples below assume this alias. Without it, replace fluid with node packages/cli/core/dist/bin/fluid.mjs.)

Authenticate

  • Email + MFA flow:

    fluid login
    
  • Or skip MFA with an API token:

    FLUID_TOKEN="<your-api-token>" fluid login
    

Pull a definition

fluid portal pull
  • Interactive picker, or target one directly: fluid portal pull --app "<definition name>"
  • Writes portal/ (screens/, themes/, navigations/, profiles/, definition.json) plus a .portal-sync/ folder that tracks sync state.
  • Switching to a different definition with unpushed local changes? Add --force to overwrite.

Edit & preview

  • Edit the JSON files under portal/.

  • Preview locally (serves the manifest from your local files):

    fluid portal dev
    

Push changes back

fluid portal push
  • Shows a diff and asks for confirmation (add --yes to skip).
  • Push does NOT publish — it updates the definition's working/draft state. End users keep seeing the currently-active published version.
  • For a verified non-interactive release, fluid portal push --yes --activate pushes the draft and creates/activates a live version only when every push phase succeeds. Partial pushes exit non-zero and are never activated.

Publish portal versions (only when you want manifest changes live)

fluid portal version create --activate     # snapshot current state + make it live
fluid portal version list                  # see all versions
fluid portal version activate <version-id> # promote a specific version

Publish widget runtime artifacts

Portal widget packages are published separately from the hosted portal shell. Create a Remote DOM widget and register it in the single source package:

fluid portal widget create stock-ticker

The scaffold writes the widget under src/widgets/ and creates or updates src/widgets.config.ts using defineWidget and defineWidgetPackage from the worker-safe Portal SDK entry. portal.config.ts, customWidgets, and legacy manifest endpoints are not part of widget discovery.

The portal CLI publishes company-owned portal widget packages:

fluid portal deploy
  • Builds defineWidgetPackage into widget.js, scoped CSS, manifest.json, and publish-manifest.json under .fluid/widget-dist by default.
  • manifest.json uses the canonical Remote DOM descriptor. Its workerEntryUrl and CSS URLs are package-local artifact paths; the catalog resolves them to absolute public URLs before hosts consume the descriptor. Company and droplet package IDs remain fully qualified (company.* or droplet.*). The publish manifest records the artifact inventory and hashes.
  • Publishes a company-owned portal widget package for Fluid OS usage.
  • Defaults to --environment production (an output/reporting label) and --out-dir .fluid/widget-dist.
  • Add --dry-run to build and print the upload payload without creating an upload session.
  • This publishes widget runtime artifacts only; it does not deploy the hosted portal shell.

For droplet-owned marketplace widget packages, use the dedicated widget CLI (@fluid-app/fluid-cli-widget) instead:

fluid widget create my-widget --droplet <uuid>
fluid widget link --droplet <uuid>
fluid widget publish

Droplets are managed outside the widget CLI and must already exist before you link or publish a droplet-owned widget package.

Handy commands

  • fluid whoami — show the active profile
  • fluid switch — switch between profiles
  • fluid logout — clear stored credentials
  • fluid portal doctor — diagnose portal project issues

版本与发布记录

@fluid-app/fluid-cli-portal 共发布 1,137 个版本,首次发布于 2026/03/07;过去 12 个月发布了 1137 个版本。

版本发布日期距今
0.1.1136latest2026/11/15今天
0.1.11352026/11/15今天
0.1.11342026/11/15今天
0.1.11332026/11/15今天
0.1.11322026/11/15今天
0.1.11312026/11/15今天

关于 @fluid-app/fluid-cli-portal 的常见问题

@fluid-app/fluid-cli-portal 是什么?

Fluid CLI plugin for building portal applications

如何安装 @fluid-app/fluid-cli-portal?

在项目目录运行 npm install @fluid-app/fluid-cli-portal,或使用 pnpm add / yarn add / bun add。

@fluid-app/fluid-cli-portal 支持 TypeScript 吗?

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

@fluid-app/fluid-cli-portal 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fluid-app/fluid-cli-portal 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fluid-app/fluid-cli-portal 可以商用吗?

@fluid-app/fluid-cli-portal 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@fluid-app/fluid-cli-portal 的下载量有多少?

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

@fluid-app/fluid-cli-portal 还在维护吗?

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