Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@economist/design-system
Advanced tools
This is the repository for The Economist Design System.
npm install @economist/design-system --save
React components for the design system are simple to use in your project:
import React, { Component } from 'react'
import { Button } from '@economist/design-system/common'
export default class extends Component {
render() {
return (
<Button>Example Button</Button>
)
}
}
Using the ES6 module export is the recommended way to use the design system with React.
The easiest way to use ES6 modules with React - and to take advantage of features such tree shaking of both JavaScript and CSS and Server Side Rendering - is to use Next.js.
If you have a Next.js project (which is recommended) you can let the design system manage your webpack configuration for you, which will also allow you to load and optimize CSS and SVG files without additional configuration in your application.
With a Next.js additional dependencies need to be specified in a project when using the design system - everything you need is included.
i.e. all a project needs to have in it's dependencies is something like this:
"dependencies": {
"@economist/design-system": "0.0.17",
"next": "^8.1.0",
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
For next.config.js
(to configure webpack) you can use a helper function:
const withDesignSystem = require('@economist/design-system/next');
module.exports = withDesignSystem();
For postcss.config.js
(to configure PostCSS) you can also use a helper function:
const withPostCSS = require('@economist/design-system/postcss');
module.exports = withPostCSS();
Both of these helper functions take custom options which override the default values. You don't need to use these helper files, but you may find it's easier than keeping the configuration in these files up to date yourself.
You do not need to use Next.js at all to use the design system, the helper methods for Next.js projects are provided for convenience.
If you have a different build system, you might find it helpful to access access the suggest webpack config for the design system:
const webpackConfig = require('@economist/design-system/webpack.config.js')
If using ES6 modules isn't practical in your project, you can also use the components via UMD module, which should work for any project.
To see how to use the design system in a projects, checkout the example projects in the ./examples/
directory.
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 up the Next.js configuration.
Add a Babel plugin for SVG files to your devDependencies:
npm i babel-plugin-inline-react-svg -D
Configure your babel.config.js
to load the plugin (and the Next.js preset):
module.exports = {
plugins: ['inline-react-svg'],
presets: ['next/babel'],
};
jest.react.config.js
to work with the design system module:transformIgnorePatterns: [
'/node_modules/(?!@economist/design-system).+\\.js$',
],
Run npm run build
to run all the build steps.
This will run steps to compile JavaScript and CSS.
There are build
and deploy
commands defined in package.json
.
A build is triggered automatically when publishing.
To publish a canary (preview/testing) release you need to be a member of the @economist organization on NPM.
version
in package.json
to add the suffix -canary.
followed by a canary release number - e.g. '0.0.1-canary.0' or '0.0.1-canary.1' (etc…)npm publish --tag canary
@TODO Document how publishing a release to production works with our CD/CI pipeline
FAQs
Economist Design System
The npm package @economist/design-system receives a total of 3,189 weekly downloads. As such, @economist/design-system popularity was classified as popular.
We found that @economist/design-system demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.