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

react_generator

v0.0.2

Published

A generator for React Component skeletons, to be used with Accio.

Downloads

8

Readme

React Component Generator

An Accio generator that creates a skeleton of a React component using CommonJS imports.

Setting Up

Installation

npm install accio npm install react_generator

Configuration

Example of an accio.config.js that will allow calling the react_generator:

module.exports = {
  aliases: {
    rc: 'react_component'
  },
  generators: {
    react_component: {
      path: '/node_modules/react_generator/react_component.js',
      output: function(name) {
        return ('/src/components/' + name + '.js.jsx');
      },
    }
  }
};

This will allow calling the generator under the name 'react_component' or 'rc' with Accio and will generate component skeletons in the directory 'src/components/' with the extension '.js.jsx'.

Usage

Within the root of your project directory, you should be able to run the either of the following commands to generate a 'to_do_list' component skeleton:

> accio react_component to_do_list

or

> accio rc to_do_list

What it does

The generator will use the command line argument as the name of the generated file, and it will create a component using the camel-cased version of the filename. Given the argument 'to_do_list', it will output the following code into the generated file:

var React = require('react/react');

var ToDoList = React.createClass({
  /**
   * @return {Object}
   */
  render: function() {
    return (
      <p>ToDoList CONTENT HERE</p>
    );
  }
});

module.exports = ToDoList;

Generating multiple components

You may pass multiple component names at the same time:

> accio rc to_do_list to_do_item to_do_form to_do_app

This will generate four separate component skeletons.