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

cnj-example-design-system-test

v1.0.16

Published

<h1 align="center"> Use this boilerplate when creating a new Storybook based design system for React applications </h1>

Downloads

37

Readme

This boilerplate includes an example React component with its story and unit tests. Accessability tests are enabled through addon: @storybook/addon-a11y.

A base tailwind build is also included, add custom tailwind.config.js if needed.

The boilerplate is intended to be used as a seperate project (design system) and should only contain React components, stories, tests and documentation. The contents of this project are meant to be distributed by releasing them as an npm package (explained below). Storybook also builds a static app which can be deployed to Vercel, Chromatic,...

Run locally

yarn storybook

Deploy to Vercel

Deploying to Vercel or another platform is required as we are going to be accessing the design system in other apps via url. Apart from that, having our storybook accessible online is great for the whole team. Override Vercels build command with:

yarn test && yarn build-storybook

Set output directory to: storybook-static Set ENV variable: SKIP_PREFLIGHT_CHECK=true

Distribute the design system as an NPM package

  1. export components & extras:

    React components and extras (styles,...) should be exported in file: /src/index.js

  2. build design system as a package:

    yarn build

    Builds contents of /src folder into /dist

  3. Add NPM package metadata:

    yarn init
  4. Get GitHub & NPM tokens:

    • generata GitHub personal token with repo access
    • generate NPM token: https://www.npmjs.com/settings/your-username/tokens with Publish permission
    • Add both tokens in .env file: name them GH_TOKEN and NPM_TOKEN
  5. Create GitHub labels:

    yarn auto create-labels
  6. Create a release:

    yarn release

    Troubleshooting error: npm ERR! code ENEEDAUTH when npm adduser doesn't work: Make sure your package.json includes:

"publishConfig": {
  "registry": "https://registry.npmjs.org/"
}

Publish releases automatically

  1. Add NPM & GitHub tokens to GitHub Secrets:

    • Create new secret named NPM_TOKEN and save the token from .env (the token will be available through: secrets.NPM_TOKEN)
    • You don't need to setup another secret for your GitHub token. All GitHub users automatically get a secrets.GITHUB_TOKEN associated with their account.
  2. Automate releases with GitHub Actions: Uncomment file .github/workflows/push.yml

Import the design system in an app

  1. Import live storybook site via url: The app that is accessing our design system should have the base storybook set up. In the apps .storybook/main.js file reference our design system via url:
// .storybook/main.js

module.exports = {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
  refs: {
    'design-system': {
      title: 'Our design system',
      //👇 The url provided by Vercel when it was deployed
      url: 'https://published-url.com',
    },
  }
};

Adding this reference will combine the apps local storybook with our design system.

  1. Include our design system as a dependency
yarn add <name-of-the-npm-package-that-holds-our-design-system>

Learn Storybook

Official documentation at Storybook.