Repository URL to install this package:
|
Version:
8.1.0-rc.5 ▾
|
https://design-system.doodle-test.com/
React Components, styleguide, component library
echo @doodle:registry=https://npm-proxy.fury.io/tmf/ >> .npmrc yarn add --save --exact @doodle/components
You will need Node 8 to start this application
Install the dependencies
yarn
Start the styleguide app
yarn start
Unfortunately, lib-components is not easily linkable with yarn link. Instead, you can use yalc.
yarn build./dist/library run yalc publishyalc add @doodle/componentsyalc update in the project using lib-componentsSee also this short slidedeck for more info.
Alternatively, you can use yarn add:
yarn buildyarn add file:<path/to/lib-components/dist/library>lib-components in your project, re-run the yarn add file:... command above. This is required because yarn add copies (instead of links) the built files to the node_modules folder of the consuming project.Run the unit tests
yarn test
Tags tab on lib-componentsBuild with parameters, select the correct target environment from the list (i.e production) and click on the Build button in the same pageKeep the version in the package.json file to 0.0.0. We keep track of the version number using tags.
All javascript files must be inside the components folder. When the library is built for production, the components folder is exported in the base path. This means that javascript files outside of the components folder would be unreachable in the production build.
Some components in this library rely on babel-polyfill. This might cause your unit tests to fail with the following error:
ReferenceError: regeneratorRuntime is not defined
To prevent this, add the following to your jest setup file:
import 'babel-polyfill';
Starting from lib-components release 5.0.0, components that support tracking must be used in coordination with lib-tracking version 1.x or above, which should already be setup in the consuming app.
Most tracked components, like the Footer, will need to implement only the declarative form of lib-tracking, i.e. they are distributed with tracking data attributes which encode the tracking intent. That's the preferred way to make a component tracking-aware if you are adding one or modifying an existing to have track support.
However in cases where the component has click handlers that perform a redirect which needs to be tracked, like in Navigation poll menu items, we should provide the component with a trackingClient prop, with a TrackingClientShape proptype validation. Then that prop will have to be informed by the consuming app, by providing its initialized instance of the lib-tracking client. This allows the component's click handlers to call, for instance, await this.props.trackingClient.track({ trackingIntent }), which will avoid race conditions and ensure tracking is complete before redirecting. The advantage of this dependency injection technique is that we leave the responsibility of depending and initializing lib-tracking to the consuming app, while keeping lib-components only weakly coupled.