@camunda/c4-connectors

中文文档
1.10.3发布于 2026/07/21Apache-2.0TypeScriptCommonJS近 30 天下载 5.5万

Camunda Composite Components

原始使用文档
文档目录13 节
  1. Storybook
  2. Design system compatibility mode
  3. Breaking changes
  4. Dev
  5. 🔧 Preparation
  6. 💻 Installation
  7. ▶️ Running with Console SM
  8. 🎁 Release
  9. Official release
  10. Local release
  11. 🧪 Testing
  12. Unit and interaction tests
  13. Visual regression tests (VRT)

C4 Connectors

Storybook

When opening a PR, a version of storybook with the changes is deployed automatically and can be accessed by clicking on the link in the PR.

Design system compatibility mode

Every exported component supports an opt-in mode prop, set via C4ConnectorsContextProvider:

import "@camunda/c4-connectors/index.scss" // existing Carbon styles
import "@camunda/design-system/styles.css" // required only if you use mode="ds"

<C4ConnectorsContextProvider apiBaseUrl={...} organizationId={...} mode="ds">
  <C4InboundConnectorsTable onClick={...} />
</C4ConnectorsContextProvider>
  • mode="carbon" (default) — renders with Carbon Design System, unchanged from previous versions.
  • mode="ds" — renders with @camunda/design-system. Consumers must additionally import @camunda/design-system/styles.css once at their app root — this library does not import it for you, the same way it doesn't import its own index.scss for you.

A handful of components have no design-system equivalent yet and always render as Carbon, in both modes: the Grid/Column layout in C4Page, Layer and Section in the executable details view, and toast notifications. This library's Storybook has a "Design system" toolbar toggle to preview both modes for any story.

Breaking changes

React 19 required — as of v1.7.0, this library requires React 19 (^19.0.0). React 18 is no longer supported.

Dev

🔧 Preparation

There are a few npm packages only available to Camundis, so you first need to create a personal access token on GitHub. To create this token, follow the steps below:

  1. Go to https://github.com/settings/tokens.
  2. Click Generate new token.
  3. Select at least read:packages.
  4. Generate the token.
  5. Keep the generated token in a safe place (e.g. the Camunda secrets management) because you will never see it again.
    Important: Enable SSO to allow the token to access the camunda-cloud artifacts.
  6. Add the generated token to your environment. See the example below for Linux:
    export NPM_TOKEN=ghp_imiJmvG46E6wo7V4ANwurstbrotXafCg
  7. Next, run the following:
    yarn

NOTE: It is highly suggested you add the export-statement to your .profile so it is added to your environment automatically.

💻 Installation

# install
yarn

# start storybook
yarn storybook

# build components
yarn build

▶️ Running with Console SM

See this documentation for more information.
TLDR; Use the following environment variables to get a minimal setup running:

#build the project, go to the root directory (camunda-cloud-management-apps)
pnpm build

# camunda-cloud-management-apps/apps/console-sm-backend
NODE_ENV=local SERVICE_NAME=console-sm-backend CAMUNDA_CONSOLE_DISABLE_AUTH=true pnpm run start

# camunda-cloud-management-apps/apps/console-sm-frontend
pnpm run start:local

Navigate to localhost:4200 to open Console. Since the configmap content is just dummy information, fetching of all external data will fail (metrics for telemetry from webapps, ...).

💡 The environment variable CAMUNDA_CONSOLE_DISABLE_AUTH disables login for Console. That setup simplifies a local instance because there's no dependency that needs to be set up.

💡 The configmap content for the local instance is available in application.yaml.

🎁 Release

Official release

Both RC and final releases use the same publish-rc workflow. Run it from the GitHub Actions tab and select the release_type input.

The recommended two-step process:

  1. Release candidate — run the workflow with release_type = RC. This publishes a prerelease to npm (tagged rc) and opens a PR named chore: bump version to X.Y.Z-rc.N. Due to branch-protection restrictions you must merge this PR manually.

  2. Final release — once the RC is validated, run the workflow again with release_type = Final. This publishes the final package to npm, creates a GitHub release, and updates the changelog. Again, merge the resulting chore: bump version to X.Y.Z PR manually.

Local release

You can use YALC to deploy the package locally. Then you can use the package in another project by adding workspace: to the dependency version in the package.json.

🧪 Testing

Unit and interaction tests

Unit tests use Vitest and Storybook interaction tests use @storybook/test with a11y checks enabled.

yarn test:unit          # Vitest unit tests
yarn test:storybook     # Storybook interaction + a11y tests (requires a running Storybook)
yarn test:ci            # TypeScript check + unit tests + Storybook tests (used in CI)

These run automatically in CI on every push. New logic must have a *.test.ts unit test; new component states or user interactions must have a Storybook play function in the corresponding story.

Visual regression tests (VRT)

We use Playwright screenshot tests to be aware of any visual changes introduced by dependency updates or changes in the component code.

Running VRT locally

We run VRT inside a docker container to avoid different results caused by different platforms. Simply run:

yarn start:docker-storybook

then

yarn test:visual-regression:docker

The commands above will:

  1. Build storybook.
  2. Start a Playwright docker container with the name c4-visual-regression.
  3. Serve storybook within the docker container.
  4. Run the visual regression tests within the docker container.

When developing, it might not always be helpful to run all of these steps at once. You can find more granular scripts in the package.json.

Running VRT in the CI

There is a Visual regression tests workflow that is triggered automatically on push. You can also trigger it manually in the Actions tab.

If the workflow fails, you can find the test report by navigating to the workflow run summary, then scrolling down to the Artifacts section. Click on the artifact called Playwright report to download it, go to your downloads folder, then open the index.html file of the test report in your browser to view the report.

How to deal with failing tests

When a VRT fails, this can have two reasons:

  1. A change was introduced unknowingly. In this case, have a look at the test report and check if the change was intended. If it is, proceed with 2.
  2. You made a change to the UI on purpose. In this case you need to update the screenshot as follows.

Make sure you have the c4-visual-regression docker container running, or start it like described here. Then, have a look at the test report:

yarn report:visual-regression

Double-check that you don't apply any unwanted changes by looking at the difference that is highlighted in the failed test's report.

To update all screenshots, run:

yarn update:visual-regression:docker

The tests should now pass locally and in the CI. Commit and push the updated screenshot(s).

版本与发布记录

@camunda/c4-connectors 共发布 49 个版本,首次发布于 2025/02/25;过去 12 个月发布了 27 个版本。

版本发布日期距今
1.10.3latest2026/07/213 个月前
1.10.3-rc.0rc2026/07/213 个月前
1.10.22026/07/183 个月前
1.10.2-rc.02026/07/183 个月前
1.10.12026/07/103 个月前
1.10.1-rc.02026/07/103 个月前

关于 @camunda/c4-connectors 的常见问题

@camunda/c4-connectors 是什么?

Camunda Composite Components

如何安装 @camunda/c4-connectors?

在项目目录运行 npm install @camunda/c4-connectors,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.0.0)、react-dom(^19.0.0)、@carbon/react(^1.91.0)、styled-components(5.x || 6.x)、event-source-polyfill(1.0.x)、@camunda/design-system(^0.32.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@camunda/c4-connectors 支持 TypeScript 吗?

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

@camunda/c4-connectors 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@camunda/c4-connectors 可以商用吗?

@camunda/c4-connectors 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@camunda/c4-connectors 的下载量有多少?

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

@camunda/c4-connectors 还在维护吗?

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