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-single-component

v0.1.14

Published

generate basic settings for writing and publishing a single react component in ES6

Downloads

16

Readme

generator-react-single-component

GitHub issues

NPM

This is a light-weight generator for developing single reusable react component. Hope you could enjoy coding with react with this package.

  1. supports ES6 syntax and has webpack-dev-server set for development.
  2. supports postcss if you want to style your component in an advanced way.
  3. provide a convenient way to publish your component to npm.

Install

If you don't have Yeoman installed yet, you should installed that first.

npm install -g yo

then install this generator

npm install -g generator-react-single-component

next, make a directory wherever you think it should be, better with the lower-case name (npm unique) of the component you are going to develop. In that directory, run the following cli

yo react-single-component

The rest steps are self-explained.

Usage

After the codes generated, you may...

  • reinstall ghooks due to some unknown reason, see Note#3
npm uninstall ghooks && npm install ghooks
  • start our webpack-dev-server
npm run dev
  • open your browser and visit http://localhost:3000. The port number is configurable in webpack.config.js

  • start coding ES6 in src/YourComponent.jsx and src/YourComponent.css, and you will see result on the spot.

  • if you want to do test-driven develpment, feel free to write test code in test/YourComponent.spec.js.

  • after finish the component, run the following script to compile your ES6 code to ES5.

npm run compile
  • after commit all changes, you can tag a release by git tag -a your-version. for example:
git tag -a v0.0.1
  • then you can publish your package both in npm npm publish and github git push --tags.

Note

  1. don't name your component as 'App'
  2. make a new directory before run yo react-single-component
  3. for unknown reason, you have to uninstall and reinstall ghooks before the ghooks can work.
  4. new Issues are welcomed!!

Example Projects

feel free to read the source code.

license

MIT