@equinor/fusion-framework-cli

中文文档
15.7.3发布于 2026/11/12ISCTypeScriptES Module近 30 天下载 1.1万
原始使用文档
文档目录22 节
  1. Features
  2. Installation
  3. Usage
  4. Create a new application
  5. Local development
  6. Build and publish
  7. Authentication
  8. Command overview
  9. API Reference
  10. @equinor/fusion-framework-cli (root)
  11. @equinor/fusion-framework-cli/app
  12. @equinor/fusion-framework-cli/portal
  13. @equinor/fusion-framework-cli/bin
  14. @equinor/fusion-framework-cli/utils
  15. Configuration
  16. Application manifest ( app.manifest.ts )
  17. Application config ( app.config.ts )
  18. Dev-server config ( dev-server.config.ts )
  19. Local mock services ( mocks/<service>.mock.ts )
  20. CLI plugins ( fusion-cli.config.ts )
  21. Request identification headers
  22. Documentation

@equinor/fusion-framework-cli

Command-line toolkit for developing, building, and publishing Fusion Framework applications and portal templates. Provides a unified developer experience from local development to production deployment.

Features

  • Application scaffolding — generate new Fusion apps from predefined templates
  • Development server — hot-reload dev server with service discovery and authentication
  • Build & bundle — Vite-based production builds with manifest generation
  • Publish & tag — upload bundles and configs to the Fusion app/portal service
  • Snapshot versions — timestamped preview builds for PRs and CI (--snapshot)
  • Portal templates — build, bundle, and deploy portal configurations
  • Service discovery — resolve Fusion service endpoints from any environment
  • Authentication — Azure AD login, token management, CI/CD token support
  • Plugin system — extend the CLI with optional plugin packages

Installation

pnpm add -D @equinor/fusion-framework-cli

The package exposes two binary aliases: fusion-framework-cli and ffc.

Usage

Create a new application

# Interactive template selection
pnpm fusion-framework-cli app create my-app

# Use a specific template
pnpm fusion-framework-cli app create my-app --template react-app

Local development

# Start the dev server (app)
pnpm fusion-framework-cli dev

# Start the dev server (portal)
pnpm fusion-framework-cli portal dev

Build and publish

# Build an application
pnpm fusion-framework-cli app build

# Bundle into a zip archive
pnpm fusion-framework-cli app pack

# Publish bundle + config to an environment
pnpm fusion-framework-cli app publish --env ci --config

# Snapshot build for a PR
pnpm fusion-framework-cli app pack --snapshot pr-123

Authentication

# Interactive login
pnpm fusion-framework-cli auth login

# Retrieve a token
pnpm fusion-framework-cli auth token

# CI/CD: set FUSION_TOKEN environment variable instead

Command overview

CommandDescription
app createScaffold a new Fusion application from a template
app buildBuild the application with Vite
app packBundle the build into a zip archive
app publishBuild, pack, and upload in one step
app uploadUpload a pre-built bundle
app configGenerate or publish app configuration
app tagTag a published version (e.g. latest)
app checkVerify app registration in the app store
app devStart the application dev server
app servePreview a production build locally
portal buildBuild a portal template
portal packBundle the portal into a zip archive
portal publishBuild, pack, and upload a portal
portal uploadUpload a pre-built portal bundle
portal configGenerate or publish portal configuration
portal tagTag a published portal version
portal devStart the portal dev server
auth loginAuthenticate with Azure AD
auth logoutClear stored credentials
auth tokenPrint or acquire an access token
disco resolveResolve a Fusion service endpoint

Run pnpm fusion-framework-cli <command> --help for detailed options.

API Reference

The package exposes several sub-path exports for programmatic use:

@equinor/fusion-framework-cli (root)

  • defineDevServerConfig / defineFusionCli — type-safe config definition helpers
  • loadDevServerConfig — load and merge dev-server configuration files
  • resolvePackage / resolveEntryPoint — package and entry-point resolution
  • RuntimeEnv — runtime environment type used across the CLI

@equinor/fusion-framework-cli/app

  • defineAppManifest / defineAppConfig — type-safe manifest and config helpers
  • loadAppManifest / loadAppConfig — load and validate app manifest/config files
  • createAppManifestFromPackage — generate a manifest from package.json
  • mergeAppManifests / mergeAppConfig — deep-merge manifest/config objects
  • ApiAppConfigSchema — Zod schema for app config validation

@equinor/fusion-framework-cli/portal

  • definePortalManifest / definePortalConfig / definePortalSchema — type-safe helpers
  • loadPortalManifest / loadPortalConfig / loadPortalSchema — load and validate files
  • createPortalManifestFromPackage — generate a portal manifest from package.json
  • validatePortalManifest — validate a manifest against the Zod schema

@equinor/fusion-framework-cli/bin

  • buildApplication / buildPortal — programmatic Vite builds
  • bundleApp / bundlePortal — build + pack into zip
  • uploadApplication / uploadPortalBundle — upload bundles to the service
  • tagApplication / tagPortal — tag published versions
  • initializeFramework / configureFramework — set up the Fusion Framework for CLI operations
  • FusionEnv — enum of supported Fusion environments

@equinor/fusion-framework-cli/utils

  • assert / assertFileExists / assertObject — assertion helpers
  • fileExists / fileExistsSync — file-existence checks
  • writeFile — write files with automatic directory creation
  • resolveAnnotations — resolve CI/CD build annotations
  • generateSnapshotVersion — create timestamped snapshot versions

Configuration

Application manifest (app.manifest.ts)

import { defineAppManifest } from '@equinor/fusion-framework-cli/app';

export default defineAppManifest((env, { base }) => ({
  ...base,
  // override manifest fields here
}));

Application config (app.config.ts)

import { defineAppConfig } from '@equinor/fusion-framework-cli/app';

export default defineAppConfig((env, { base }) => ({
  environment: { MY_VAR: 'value' },
  endpoints: {
    api: { url: 'https://api.example.com', scopes: ['api://scope/.default'] },
  },
}));

Dev-server config (dev-server.config.ts)

import { defineDevServerConfig } from '@equinor/fusion-framework-cli';

export default defineDevServerConfig((env, { base }) => ({
  ...base,
  // override dev-server options here
}));

Local mock services (mocks/<service>.mock.ts)

Use executable service modules instead of handwritten routes in dev-server.config.ts. Install @equinor/fusion-framework-cli-plugin-mock-server, define each service with defineService, and run ffc mock-server in a separate foreground terminal.

See Develop with mock services for normal discovery overlays, isolated --mock development, and discovery modes.

CLI plugins (fusion-cli.config.ts)

import { defineFusionCli } from '@equinor/fusion-framework-cli';

export default defineFusionCli(() => ({
  plugins: ['@equinor/fusion-framework-cli-plugin-ai'],
}));

Request identification headers

Every request the CLI itself sends to Fusion services identifies the tool and its version, so service operators can tell Fusion Framework traffic apart from other callers when investigating unexpected requests (for example in Fusion Discovery logs).

HeaderValue
X-Fusion-CLI-Namefusion-framework-cli
X-Fusion-CLI-VersionThe installed CLI version, e.g. 15.5.3
User-Agentfusion-framework-cli/<version>

This covers service discovery lookups and every other client created by configureFramework, publish, upload, check and tag calls, and the AI model, embedding and search index calls. It uses the same X-Fusion-CLI-* convention as the other Fusion CLIs, so one filter on x-fusion-cli-name finds all of them.

Requests forwarded by the dev server (ffc app dev, ffc app serve, ffc portal dev) are not CLI calls. They identify the dev server instead with X-Fusion-Dev-Server-Name and X-Fusion-Dev-Server-Version, plus X-Fusion-Mock: true|false; see the dev server README.

  • Diagnostics only. The values can be faked, so never use them for access control. They never contain tokens, secrets, or personal information.
  • Caller headers win. A header already set on a request is never overwritten.
  • Programmatic use. defaultHeaders is exported from @equinor/fusion-framework-cli/bin, and configureFramework registers it on the framework HTTP client for you.

Documentation

版本与发布记录

@equinor/fusion-framework-cli 共发布 477 个版本,首次发布于 2022/11/04;过去 12 个月发布了 112 个版本。

版本发布日期距今
15.7.3latest2026/11/121 天前
15.7.3-next.0next2026/11/112 天前
15.7.22026/11/112 天前
15.7.2-next.22026/10/2915 天前
15.7.2-next.12026/10/2816 天前
15.7.2-next.02026/10/2816 天前

其他发布通道:apploader → 10.7.5-apploader-be21a6b60eb13eee8bf869e75002d8634e9c50a9,cli-search-index → 13.0.0-cli-search-index.5,msal-v5 → 13.1.2-msal-v5.1,trusted-publishing-20261015 → 15.6.1-trusted-publishing-20261015-9dfe7602cd2a49a8a9df00d62c26e7304a82a85a,next → 15.7.3-next.0。

关于 @equinor/fusion-framework-cli 的常见问题

如何安装 @equinor/fusion-framework-cli?

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

@equinor/fusion-framework-cli 支持 TypeScript 吗?

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

@equinor/fusion-framework-cli 支持 ESM 还是 CommonJS?

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

@equinor/fusion-framework-cli 需要什么版本的 Node.js?

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

@equinor/fusion-framework-cli 可以商用吗?

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

@equinor/fusion-framework-cli 的下载量有多少?

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

@equinor/fusion-framework-cli 还在维护吗?

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