@equinor/ioc-common-frontend

中文文档
22.0.0发布于 2026/11/02MITTypeScriptESM + CJS近 30 天下载 2127

NPM library for shared frontend code to be used by applications maintained by the IOC Prevent Breakdowns (PB) team

原始使用文档
文档目录9 节
  1. Preview
  2. How to use
  3. Local development with Condition Adviser
  4. Dependency resolutions
  5. Dependency maintenance
  6. Dependency resolutions
  7. Links
  8. Contributing
  9. Licensing

IOC Common Frontend · NPM npm

NPM library for shared frontend code to be used by applications maintained by the IOC Prevent Breakdowns (PB) team

Preview

To preview the components in this package in storybook, please head to our Storybook.

How to use

For installing this package

yarn add @equinor/ioc-common-frontend

or using npm.

npm install @equinor/ioc-common-frontend

Then use the components or functions by named imports

import { Button } from "@equinor/ioc-common-frontend"

...

export const YourComponent = () => {

    ...

    return {
        <div>
            <Button />
        </div>
    }
}

Local development with Condition Adviser

Use yalc to test an unpublished Common Frontend build in Condition Adviser. The two repositories have independent dev containers and share only the Docker volume named ioc-yalc-store.

  1. Open Common Frontend in its dev container and run Yalc: Watch & Push from VS Code's task picker. This builds the complete package, including declarations, and publishes it whenever Common Frontend source changes. (You can also use Yalc: Push Once, to manually push changes on demand, to avoid a rebuild on every file save)
  2. Open Condition Adviser in its dev container and run Yalc: Run with Common Frontend. This links Common Frontend from the shared store, watches for updates, and starts the Condition Adviser frontend.
  3. Run Common Frontend tests and exercise the affected workflow in Condition Adviser.
  4. Stop the Condition Adviser run task when finished. It restores the published dependencies automatically.

If a task is interrupted before cleanup completes, run Yalc: Restore Published Frontend Libraries. Yalc changes the Condition Adviser package manifest and lockfile temporarily; Do not commit those local file:.yalc/ references.

Dependency resolutions

Keep the resolutions field in package.json absent whenever possible. A resolution globally overrides transitive dependency selection and can hide an incompatible parent dependency, so it is a temporary exception rather than a normal dependency-management mechanism.

Before adding one, prefer upgrading the direct parent and refreshing yarn.lock. If an override is still required, add it to package.json and add the same package to approvedResolutions in scripts/check-resolutions.mjs. Its entry must explain:

  • why normal dependency resolution is insufficient;
  • the issue, advisory, or upstream change that requires the override;
  • an objective removal condition, such as the parent package version or native dependency range that makes the override redundant.

yarn build runs this check and rejects undocumented resolutions. Review every approved resolution during dependency upgrades. Remove it once its removal condition is true, then run install, audit, typecheck, tests, and build without the override.

Dependency maintenance

Use the predefined VS Code tasks from Command Palette (Cmd+Shift+P) > Tasks: Run Task:

  1. Run Audit Dependencies to record the current vulnerabilities. This uses yarn npm audit; its results may differ from GitHub security alerts because the tools can use different advisory data and dependency analysis.
  2. Run Yarn: Upgrade Dependencies to update transitive dependencies within the version ranges already declared in package.json.
  3. Optionally run Yarn: Dedupe Dependencies to reduce duplicate resolutions in yarn.lock.
  4. Run Audit Dependencies again and compare the result with the baseline.
  5. Investigate any remaining vulnerability before changing version ranges. Upgrade the affected direct dependency with Yarn: Upgrade Single Package or Yarn: Upgrade Dependencies Interactively, review its release notes for breaking changes, and then repeat the audit. A major upgrade or a temporary resolutions entry may be required for vulnerable transitive dependencies.
  6. Run Yarn: Install Dependencies to verify that package.json and yarn.lock are consistent. This task uses yarn install --immutable and must not modify the lockfile.
  7. Run Test, Build, and Storybook: Build to verify the updated dependency tree.
  8. Review the package.json and yarn.lock changes before committing them.

Dependency resolutions

Keep the resolutions field in package.json absent whenever possible. A resolution globally overrides transitive dependency selection and can hide an incompatible parent dependency, so it is a temporary exception rather than a normal dependency-management mechanism.

Before adding one, prefer upgrading the direct parent and refreshing yarn.lock. If an override is still required, add it to package.json and add the same package to approvedResolutions in scripts/check-resolutions.mjs. Its entry must explain:

  • why normal dependency resolution is insufficient;
  • the issue, advisory, or upstream change that requires the override;
  • an objective removal condition, such as the parent package version or native dependency range that makes the override redundant.

yarn build runs this check and rejects undocumented resolutions. Review every approved resolution during dependency upgrades. Remove it once its removal condition is true, then run install, audit, typecheck, tests, and build without the override.

Useful links:

Contributing

As of writing, this package is open for use internally and externally through npmjs.

Repository is however only available for internal equinor for posting PR's.

Licensing

The code in this project is licensed under MIT license.

版本与发布记录

@equinor/ioc-common-frontend 共发布 328 个版本,首次发布于 2022/11/15;过去 12 个月发布了 26 个版本。

版本发布日期距今
22.0.0latest2026/11/0211 天前
21.1.32026/10/2618 天前
21.1.22026/10/2618 天前
21.1.12026/10/2222 天前
21.1.02026/09/281 个月前
21.0.12026/09/082 个月前

其他发布通道:beta → 12.0.0-beta.1。

关于 @equinor/ioc-common-frontend 的常见问题

@equinor/ioc-common-frontend 是什么?

NPM library for shared frontend code to be used by applications maintained by the IOC Prevent Breakdowns (PB) team

如何安装 @equinor/ioc-common-frontend?

在项目目录运行 npm install @equinor/ioc-common-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19.0.0)、lexical(>=0.53.0)、react-dom(>=19.0.0)、@types/react(>=19.0.0)、@types/react-dom(>=19.0.0)、styled-components(>=5.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@equinor/ioc-common-frontend 支持 TypeScript 吗?

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

@equinor/ioc-common-frontend 支持 ESM 还是 CommonJS?

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

@equinor/ioc-common-frontend 可以商用吗?

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

@equinor/ioc-common-frontend 的下载量有多少?

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

@equinor/ioc-common-frontend 还在维护吗?

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