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 🙏

© 2025 – Pkg Stats / Ryan Hefner

bitsherpa-rope

v1.0.11

Published

A collection of custom bootstrap components.

Readme

Rope

A collection of custom bootstrap components

How to publish a react component to the npm directory

Open your project folder with a CLI.

Initialize a new npm project.

npm init

Answer the prompts and finish the initialization. Make sure the name of the project is unique in the npm directory.

Next install react.

npm install react --save

We will use ES6 und JSX to write the react components.

These standards are not supported by default. We will use babel and its presets to transpile ES6 and JSX code into pure vanilla JavaScript.

npm install babel-cli babel-preset-es2015 babel-preset-react --save-dev

Next we tell babel how to convert the code. For this create a .babelrc file in the root with this content:

{
  "presets": ["es2015", "react"]
}

To publish and transpile our react component code add two scripts to the package.json file.

"scripts": {
  "prepublish": "npm run build",
  "build": "babel ./src --out-dir ./dist"
},

If you run npm build babel will compile everything from /src to /dist.

Create the /src folder and add a react component like HelloWorld.jsx:

import React from 'react';

export default class JelloWorld extends React.Component {
  render() {
    return (
      <div>Hello world!!</div>
    )
  }
}

Before publishing this hello world component run npm run build just to see how babel transpiles the scripts.

To let npm know which files are part of the npm package create a index file /src/index.jsx.

import HelloWorld from './HelloWorld';

export { HelloWorld };

Make sure to update the main attribute in the package.json file.

"main": "./dist/index.js",

When running npm publish it will automatically transpile the scripts and publish it to the npm repository.

But before doing so you have to login with an npm Account.

npm login
npm publish

If everything went well you can start adding this component as dependency in your app.

npm install your-pojrect-name --save

In your react app import the component as showed below.

import { HelloWorld } from 'your-project-name';

When updating you project and republish it again make sure to increment the semantic version of the project.

npm version patch

This will increment the version from 1.0.0 to 1.0.1.

In case you do not want to publish the JSX source add and .npmignore file.

/src
.babelrc

In case you are using git to host your project add a .gitignore file.

/node_modules

Source

http://rajasekarm.com/publishing-react-component-npm/

http://jamesknelson.com/the-six-things-you-need-to-know-about-babel-6/

http://tstringer.github.io/npm/npmjs/2015/10/29/npm-incrementing-version.html