@economist/design-system

中文文档
7.42.1发布于 2026/06/08CommonJS近 30 天下载 5526

Economist Design System

原始使用文档
文档目录8 节
  1. Table of contents
  2. Overview
  3. Directory structure
  4. Example usage
  5. Other configuration options
  6. Jest and Babel configuration
  7. Contributing
  8. Maintainers

The Economist Design System

Table of contents

Overview

This is the repository for The Economist Design System.

npm install @economist/design-system

Directory structure

  • src/ - The components for the design system (JavaScript and CSS modules)

Example usage

Due to issues with @zeit/css, the recommended way to import the Design System currently is using UMD - see the Engagement repo for an example of a component implementation.

We are aware this makes it so the Design System is not tree shakeable. We will be resolving this with Marber, the new version of the Design System.

import React, { Component } from 'react';
import { Button } from '@economist/design-system/dist/umd/common';
import '@economist/design-system/dist/umd/common.css';

export default class extends Component {
  render() {
    return <Button>Example Button</Button>;
  }
}

You can include CSS either by adding a CSS loader to your webpack configuration and loading the CSS in React component (as in the example above) or simply in a stylesheet used on your site.

Other configuration options

You do not need to use Next.js to use the design system, the helper methods for Next.js projects are merely provided for convenience.

If you have a different build system, you may find it helpful to refer to the suggested webpack and postcss configuration files, which are bundled along with the module:

const webpackConfig = require('@economist/design-system/webpack.config.js');
const postcssConfig = require('@economist/design-system/postcss.config.js');

Checkout the Engagement repo for the way we would recommend implementing the Design System at this point in time.

Jest and Babel configuration

If you are using the popular Jest testing framework, you may need to do some additional configuration in your project as Jest won't pick them up automatically.

  1. Configure babel.config.js to load the Next preset (if using Next.js):
module.exports = {
  presets: ['next/babel'],
};
  1. Configure transformIgnorePatterns in jest.react.config.js:
transformIgnorePatterns: [
  '/node_modules/(?!@economist/design-system).+\\.js$',
],

Contributing

To create or modifiy a component, open a pull request following the steps outlined in CONTRIBUTING.md and following the FE-GUIDELINES.md.

Maintainers

See MAINTAINERS.md.

版本与发布记录

@economist/design-system 共发布 664 个版本,首次发布于 2019/05/17;过去 12 个月发布了 5 个版本。

版本发布日期距今
7.42.1latest2026/06/085 个月前
7.42.02026/06/055 个月前
7.41.12026/01/209 个月前
7.41.02025/12/0911 个月前
7.40.02025/11/2611 个月前
7.39.02025/10/221.1 年前

其他发布通道:next → 7.0.0-rc1,previous-v5 → 5.142.1,previous-v6 → 6.12.1,previous → 6.25.0。

关于 @economist/design-system 的常见问题

@economist/design-system 是什么?

Economist Design System

如何安装 @economist/design-system?

在项目目录运行 npm install @economist/design-system,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.11.0 || ^17.0.0-0 || ^18.0.0 || 19.x)、react-dom(^16.11.0 || ^17.0.0-0 || ^18.0.0 || 19.x)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@economist/design-system 支持 TypeScript 吗?

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

@economist/design-system 支持 ESM 还是 CommonJS?

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

@economist/design-system 需要什么版本的 Node.js?

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

@economist/design-system 可以商用吗?

@economist/design-system 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@economist/design-system 的下载量有多少?

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

@economist/design-system 还在维护吗?

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