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

create-react-ds

v0.48.0

Published

React Design System scaffolding tool

Downloads

26

Readme

Create React DS

CLI for bootstrapping your own awesome React design system / components library!

NPM

Create React DS provides a simple command line interface for generating a new project with a set of predefined components and styles. This tool helps to automate the process of creating a design system, which can save a lot of time and effort for developers. The tool also provides a set of options that can be configured to customize the design system to suit the specific needs of the project or organization.

Features

Table of contents

Usage

This package requires node >=18.12.1

  • Standalone mode - Bootstrap a new library to be developed and maintained as a project of it's own
  • Local mode - Inject the components library files and dependencies into an already existing react project

Standalone mode

This is de default (and recommended) way of using this library. It will bootstrap a new library to be developed and maintained as a project of it's own

npx create-react-ds my-design-system-name

Development

npm run storybook

This will start storybook in localhost

Bundle your library for publishing

npm run build

Test you bundle locally before publishing

npm pack

This will create a .tar file (with the exact same content that would be published to npm) which you can npm install in any react / next / remix application of yours. You will be able to consume the library from that application as if it was coming from a published package.

Publish your library to npm

npm publish

Just make sure the name of your library is available in npm

Update your published library

npm version major / minor / patch
npm publish

This will bump your library's version according to the semver standards

Using your newly created components library

Once your library is published or packed, you can install it into your react application and start using it!

Install the component library and its peer dependencies

npm install path-to-your-library styled-components themed-props

Import ThemeProvider in the root of your app

It will typically be in the App component, or in the _app.tsx file if it's a next app. Wrap your main component in ThemeProvider so that you can leverage the theming functionality across your library's components in your app.

import { ThemeProvider } from 'your-library';
...

return (
  <ThemeProvider>
    <App />
  </ThemeProvider>
);

Local mode

If you prefer to just develop your component library within your app instead of maintaining a separate project for it, then you can use this mode. It will inject the components files and dependencies into an already existing react project.

This mode assumes a typical frontend react / next.js app folder structure, so run the following command in the root of your app:

npx create-react-ds my-design-system-name --mode=local

The resulting folder structure should look something like this:

  myApp
  - scripts
  - - generate-component <----
  - - ...
  - src
  - - my-component-library <----
  - - ... 
  ...  

Also, some changes will have happened in your package.json file:

  • All necessary dependencies installed: styled-components, themed-props

For more info on how to leverage the usage of the Theme and Styled Props, please refer to Styled Components and Styled System docs respectively.

Made with Love!! ❤️