@comicrelief/component-library

中文文档
8.90.0发布于 2026/11/09ISCESM + CJS构建来源已验证近 30 天下载 5021

Comic Relief Component Library --------------

原始使用文档
文档目录5 节
  1. Comic Relief Component Library
  2. Recent Rebuild Notes (June 2026):
  3. General Usage
  4. Develop
  5. Testing

Comic Relief Component Library

GitHub Actions semantic-release

Recent Rebuild Notes (June 2026):

  • No more markdown importing Javascript faff in example files, just simple React component examples.
  • Only exception is the code examples visible below each of the components - they are built using a Vite-specific import feature: import buttonExampleSrc from '../components/Atoms/Button/ButtonExample.jsx?raw';
  • Styled-Components 5 => Styled Components 6 - slight syntax change. Previously usage of nested selector / "&" usage in nested CSS was assumed. It now needs to be explicit (like normal native CSS).
  • Removed _TriggerConfetti.js file. I couldn't find any usage, was likely a private helper no longer needed.

General Usage

Main Dependencies

  • Vite
  • Styled Components

Install the package

$ yarn add @comicrelief/component-library

Wrap your app with the ThemeProvider and crTheme

import { ThemeProvider, crTheme } from '@comicrelief/component-library';

Load fonts in your app's HTML

We use Anton and Montserrat fonts. Add these to your frontend's index.html <head>:

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=Anton&family=Montserrat:wght@400;500;600;700&display=swap"
/>

Import components

import { HeroBanner } from '@comicrelief/component-library';

Develop

To install CR-CL locally, run:

$ yarn install

To start the dev build and server:

$ yarn dev

To test:

$ yarn test:unit

Test will run through all Jest tests and watch for any changes on snapshots.

To update snapshots with desired changes brought in through your work:

$ yarn test:unit:update

To publish

$ yarn publish:npm

Testing

Install Playwright:

yarn playwright install

Run the tests:

yarn test:e2e:local

版本与发布记录

@comicrelief/component-library 共发布 652 个版本,首次发布于 2019/06/28;过去 12 个月发布了 146 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.90.0latest2026/11/09今天
8.89.22026/11/064 天前
8.89.12026/11/045 天前
8.89.02026/11/046 天前
8.88.02026/11/046 天前
8.87.12026/11/036 天前

关于 @comicrelief/component-library 的常见问题

@comicrelief/component-library 是什么?

Comic Relief Component Library --------------

如何安装 @comicrelief/component-library?

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

@comicrelief/component-library 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/comicrelief__component-library 是否存在。

@comicrelief/component-library 支持 ESM 还是 CommonJS?

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

@comicrelief/component-library 可以商用吗?

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

@comicrelief/component-library 的下载量有多少?

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

@comicrelief/component-library 还在维护吗?

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