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

@repodog/storybook-config

v8.0.4

Published

The Repodog Storybook config module.

Downloads

102

Readme

@repodog/storybook-config

The Repodog Storybook config.

npm version License: MIT

Install package and peer dependency

# terminal
npm install @repodog/storybook-config storybook --save-dev

Install optional peer dependencies

# terminal
npm install @chanzuckerberg/axe-storybook-testing @storybook/test-runner chromatic --save-dev
# with babel
npm install @repodog/babel-preset --save-dev
# or swc
npm install @repodog/swc-config --save-dev

Use package

// package.json
{
  "scripts": {
    "build-storybook": "storybook build",
    // Requires optional peer chromatic
    "chromatic": "chromatic --project-token <CHROMATIC_TOKEN>",
    "storybook": "storybook dev -p <PORT>",
    // Requires optional peer @chanzuckerberg/axe-storybook-testing
    "test-axe": "npm run build-storybook && axe-storybook",
    // Requires optional peer @storybook/test-runner and `concurrently`, `serve` and  `wait-on` npm packages.
    // It is better to build storybook and serve that rather than running storybook dev for performance reasons.
    "test:storybook": "npm run build-storybook && concurrently --kill-others --success first \"serve ./storybook-static\" \"wait-on tcp:<PORT> && test-storybook --url http://localhost:<PORT>"
  }
}
// .storybook/preview.ts
import { preview as repodogPreview } from '@repodog/storybook-config/preview';

export default {
  ...repodogPreview,
};

With Babel

// .storybook/main.ts
import babelPreset from '@repodog/babel-preset';
import { config as storybookConfig } from '@repodog/storybook-config';

export default {
  ...storybookConfig({ compiler: ['babel', babelPreset()] }),
};

With SWC

// .storybook/main.ts
import { config as storybookConfig } from '@repodog/storybook-config';
import swcConfig from '@repodog/swc-config';

export default  {
  ...storybookConfig({ compiler: ['swc', swcConfig.ts] })
  // or
  ...storybookConfig({ compiler: ['swc', swcConfig.js] })
};

Coverage reporting

Below is a script configuration for running unit tests and storybook tests and merging their respective coverage reports. It requires installing additional dev dependencies.

// package.json
{
  "scripts": {
    "build-storybook": "storybook build",
    // Requires `nyc` npm package
    "generate-coverage": "nyc report --reporter=lcov -t coverage --report-dir coverage && open ./coverage/lcov-report/index.html",
    // Requires `istanbul-merge` npm package
    "merge-coverage": "istanbul-merge --out coverage/coverage.json coverage/unit/coverage-final.json coverage/storybook/coverage-storybook.json",
    "storybook": "storybook dev -p <PORT>",
    // Requires `del-cli` npm package
    "test": "del-cli ./coverage && npm run test:storybook && npm run test:unit && pnpm run merge-coverage && pnpm run generate-coverage",
    // Requires optional peer @storybook/test-runner and `concurrently`, `serve` and  `wait-on` npm packages.
    // Also includes saving coverage to "coverage/storybook"
    "test:storybook": "npm run build-storybook && concurrently --kill-others --success first \"serve ./storybook-static\" \"wait-on tcp:<PORT> && test-storybook --url http://localhost:<PORT> --coverage --coverageDirectory coverage/storybook\"",
    // Includes saving coverage to "coverage/unit"
    "test:unit": "node --require=suppress-experimental-warnings --experimental-vm-modules node_modules/jest/bin/jest.js --coverageDirectory coverage/unit",
  }
}