generating-ui-bundle-features

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

UI Bundle Features

UI Bundle功能

Installing Pre-built Features

安装预构建功能

Always check for an existing feature before building something from scratch. The features CLI installs pre-built, tested packages into Salesforce UI bundles — from foundational UI libraries (shadcn/ui) to full-stack capabilities (authentication, search, navigation, GraphQL, Agentforce AI).
在从零开始构建功能前,请先检查是否已有现成功能。Features CLI会将经过预构建和测试的包安装到Salesforce UI bundles中——从基础UI库(shadcn/ui)到全栈能力(身份认证、搜索、导航、GraphQL、Agentforce AI)。

Workflow

工作流程

  1. Search project code first — check
    src/
    for existing implementations before installing anything. Scope searches to
    src/
    to avoid matching
    node_modules/
    or
    dist/
    .
  2. Search available features — use
    npx @salesforce/ui-bundle-features list
    with
    --search <query>
    to filter by keyword. Use
    --verbose
    for full descriptions.
  3. Describe a feature — use
    npx @salesforce/ui-bundle-features describe <feature>
    to see components, dependencies, copy operations, and example files.
  4. Install — use
    npx @salesforce/ui-bundle-features install <feature> --ui-bundle-dir <name>
    . Key options:
    • --dry-run
      to preview changes
    • --yes
      for non-interactive mode (skips conflicts)
    • --on-conflict error
      to detect conflicts, then
      --conflict-resolution <file>
      to resolve them
If no matching feature is found, ask the user before building a custom implementation — a relevant feature may exist under a different name.
  1. 先搜索项目代码——在安装任何内容前,检查
    src/
    目录是否已有现成实现。将搜索范围限定在
    src/
    ,避免匹配
    node_modules/
    dist/
    目录。
  2. 搜索可用功能——使用
    npx @salesforce/ui-bundle-features list
    命令并加上
    --search <query>
    参数按关键词筛选。使用
    --verbose
    参数查看完整描述。
  3. 查看功能详情——使用
    npx @salesforce/ui-bundle-features describe <feature>
    命令查看组件、依赖项、复制操作及示例文件。
  4. 安装功能——使用
    npx @salesforce/ui-bundle-features install <feature> --ui-bundle-dir <name>
    命令。关键选项:
    • --dry-run
      :预览变更
    • --yes
      :非交互模式(跳过冲突提示)
    • --on-conflict error
      :检测冲突,随后使用
      --conflict-resolution <file>
      解决冲突
如果未找到匹配功能,请先询问用户再构建自定义实现——相关功能可能以其他名称存在。

Conflict Handling

冲突处理

In non-interactive environments, use the two-pass approach: first run with
--on-conflict error
to detect conflicts, then create a resolution JSON file (
{ "path": "skip" | "overwrite" }
) and re-run with
--conflict-resolution
.
在非交互环境中,采用两步法:先运行带
--on-conflict error
参数的命令检测冲突,然后创建一个解析JSON文件(格式为
{ "path": "skip" | "overwrite" }
),再运行带
--conflict-resolution
参数的命令重新执行。

Post-install: Integrating Example Files

安装后:集成示例文件

Features may include
__example__
files showing integration patterns. For each:
  1. Read the example file to understand the pattern
  2. Read the target file (shown in
    describe
    output)
  3. Apply the pattern from the example into the target
  4. Delete the example file after successful integration
功能可能包含
__example__
文件,展示集成模式。针对每个示例文件:
  1. 阅读示例文件以理解集成模式
  2. 阅读
    describe
    输出中显示的目标文件
  3. 将示例中的模式应用到目标文件中
  4. 成功集成后删除示例文件

Hint Placeholders

提示占位符

Some copy paths use
<descriptive-name>
placeholders (e.g.,
<desired-page-with-search-input>
) that the CLI does not resolve. After installation, rename or relocate these files to the intended target, or integrate their patterns into an existing file.
部分复制路径使用
<descriptive-name>
占位符(例如
<desired-page-with-search-input>
),CLI不会自动解析这些占位符。安装完成后,请将这些文件重命名或移动到预期目标位置,或将其模式集成到现有文件中。