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

generator-react-component-dev-kit

v0.0.6

Published

A scaffolding tool allowing developers create react component with demo page, dev page with hot reloading, testing with coverage check.

Downloads

4

Readme

generator-react-component-dev-kit

A scaffolding tool allowing developers create react component with demo page, dev page with hot reloading, testing with coverage check.

features

  • build: powered by webpack. Bundle your source code into umd library.
  • testing: set up the jest testing suites with coverage check.
  • demo: set up a simulator site to load your component as a child in the mini application.
  • dev page: hot reloading dev page with source mapping. Enjoy the debugging process.
  • eslint: linting the code while webpack processes.
  • jsdoc: generate jsdoc files from your jsdoc comments.

Usage

  • Make sure "yo" is available on your machine: http://yeoman.io/learning/

  • install the generator:

npm install -g generator-react-component-dev-kit
  • Change working directory to your project code base. And run yarn to install the dependencies. You may want to mannually modify the dependencies/devDependencies in package.json if you wish.

  • yo react-component-dev-kit

    • You need to type in your component name in the prompting dialog.
    • The generator will transform it to PascalCase as component export name, and param-case as package name.

Work on your new component:

component entry point:

src/index.js

build

npm run build

By default, your new component will produce an UMD library with react as external library. The bundled file will be put into dist/index.js. If that is not your case, you can manually update the package.json.

output: {
  path: __dirname + '/dist',
  filename: 'index.js',
  publicPath: '/',
  libraryTarget: 'umd',
  library: 'YourComponentName',
},

linting

Linting will happen before every build execution as well as demo/dev.

You can also run bash npm run eslint in your command line to execute linting.

Customize your linting rule in .eslintrc.yaml. I believe I have set up very restrict rules.

demo page

npm run demo

Then open "/demo/default/index.html" to inspect the demo. The demo code is index.js under the same directory. It simulates how consumers use your component. It points to the dist/index.js.

dev page

npm run dev

You can visit your dev page at localhost:9001. It is hot-reloading powered by webpack-dev-server.

Testing

npm test

The test is based on Jest

customize your jest configuration under package.json "jest" field.

Converage check

Coverage report will be placed in /coverage-report. You can modify coverage threashold in your package.json:

    "coverageThreshold": {
      "global": {
        "branches": 100,
        "functions": 100,
        "lines": 100,
        "statements": 100
      }
    }

jsdoc

If you have jsdoc comments. Run bash npm run jsdoc will generate the docs under 'jsdoc'.

Custom your jsdoc config at "jsdoc.config.json"

prepublish

By default it puts "webpack" and "jsdoc" as the prepublishOnly script.