npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

design-system-test

v1.0.0

Published

LiveChat Design System React components with css styles

Downloads

10

Readme

LiveChat Design System

React components and css styles library for use in Livechat products. By creating a uniform system, we want to deliver a harmonious experience to our customers. For someone who’s already used one of our products, the transition to another one would be smooth and intuitive.

Table of Contents

  1. Installation
  2. Contribution
    1. Getting started
    2. NPM Scripts
    3. Developing a Component
    4. NPM Link
    5. Document a Component
    6. Tests with Jest
    7. Check tests coverage
    8. Try the bundle
  3. Changelog

Installation

To install LiveChat Design System Components Library with npm, run the following command:

npm install --save @livechat/design-system

Libary has separate css file with components styles. You need to import it in your app as well. You can find it in node-modules/@livechat/design-system/dist/design-system.css

Contribution

Getting started

  • Install Node6 or Node8, preferably using nvm
  • Clone this repository: git clone https://github.com/livechat/design-system (or download zip)
  • CD to project directory: cd design-system
  • Install dependencies: npm install

NPM Scripts

  • styleguide: run styleguidist server with eslint at http://localhost:6060
  • styleguide:build: run styleguidist build
  • start: bundles the library with watch flag, usefull for development with external app instead of styleguidist
  • build: bundles the library with rollup to the dist dir
  • prebuild: removes build directory (before build script)
  • prepare: runs both before the package is packed and published and on local npm install
  • predeploy: runs before deploying design system guide to github pages
  • deploy: deploy design system guide to github pages
  • test: runs tests
  • test:coverage: runs tests with coverage report
  • test:watch: runs tests in watch mode

Developing a Component

A typical UI component should comply with the following guidelines:

  • If it has no state, it should be declared as a Dumb Component.
  • Unless having another team member approval, all components should have className and style props declared.
  • It should have tests.
  • It should have Styleguidist examples about its usage.
  • All code must follow the configured code style.
  • For any design concept, follow styles from Zeplin.
  • Component example file should contain html markup for aplications/websites which doesn't use React
  • Component should use scss style file
  • Css should be inspired by BEM, but doesn't need to follow it strickly
  • Style file should use defined sass variables, mixins etc.
  • Component should have typescript typings

You can view and test your component in two ways:

  • use styleguidist as development enviroment for your component
  • use npm link feature to see it in your app

NPM Link

You should start with executing these two commands:

  • design-system library root directory -> run npm link
  • app root directory -> run npm link @livechat/design-system

You can run build script after new changes (or use npm start) or if you are using webpack just add to webpack.config.js few lines to see changes without unnecessary bundling library:

const designSystemComponentsPath = fs.realpathSync(
  path.resolve(__dirname, '../node_modules/@livechat/design-system/src')
);
const designSystemDistPath = fs.realpathSync(
  path.resolve(__dirname, '../node_modules/@livechat/design-system/dist')
);
...
  resolve: {
    alias: Object.assign({}, {
      '@livechat/design-system/dist': designSystemDistPath,
      '@livechat/design-system': designSystemComponentsPath
    }),
  },
...

That way you will need to install classnames and configure css modules for library (in example new webpack config which runs dev server after command npm start:ds:

  rules: [
    {
      test: /\.css$/,
      include: [designSystemComponentsPath],
      use: ExtractTextPlugin.extract({
        fallback: 'style-loader',
        use: [
          {
            loader: 'css-loader',
            query: {
              modules: true,
              localIdentName: 'lc_[local]'
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              ident: 'postcss',
            }
          },
        ],
      }),
    },
  ]

If you want to learn more about npm link read this basic article

Document a component with styleguidist

  • npm run-script styleguidist
  • Open a browser at http://localhost:6060

Styleguidist monitors the <root-dir>/src/components directory for components. Nevertheless, examples are user-defined in a <Component-name>.md file within the subdirectory of the component. Remember to add your new component in setup.js to see it in docs.

Running tests

Unit and snapshot tests, uses Jest as test runner.

  • npm run test or npm run test:watch for run the test optional with watching mode

Check tests coverage

Istanbul is used for code coverage and reporting, so:

  • npm run coverage and check your testing skills

Try the bundle

  • npm run build for bundle library