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-structure-cli

v1.0.1

Published

A small cli for react that generates a default or custom module and components structure.

Downloads

6

Readme

[react-structure-cli]

A small cli for react that generates a default module and components structure. You can also create your own module structure.

Install

Run

npm install -g react-structure-cli

You may need to sudo it.

Why?

If you often create default structure for your modules manually then you know that it's tiring all the time to create it. The react-structure-cli is going to help you automate the process.

Module

Default module structure

default_module
└─ assets
│   └─ Component.scss
└─ components
│   └─ Component.js
└─ containers
│   └─ Container.js
└─ index.js

Module options

Generate module. In case your own module was initialized then the system will use it, otherwise the system will use the default one.

rsc module [ModuleName] -g

Init your own module

rsc module [ModuleName] -i

Reset to default module structure

rsc module [ModuleName] -r

Generate Module

You need to go to the folder where you want to create a module structure.

Then run:

rsc module [ModuleName] -g

rsc module [ModuleName] --generate

Init custom module structure

rsc module -i

rsc module --init

Firstly you need to create an empty folder and then move your own module structure to it.

You can pass className to your .js files. Then when you generate a module the className will be replaced automatically with ModuleName which you provided.

For example:

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

class classNameComponent extends PureComponent {
  render() {
    return (
      <div>
        
      </div>
    );
  }
}

classNameComponent.propTypes = {

};

export default classNameComponent;

After init your own module structure you can generate a module

rsc module TestModule -g

and the result will be:

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

class TestModuleComponent extends PureComponent {
  render() {
    return (
      <div>
        
      </div>
    );
  }
}

TestModuleComponent.propTypes = {

};

export default TestModuleComponent;

Reset to default module structure

If you initialized custom module and something needs to be changed or a default structure should be used you can reset custom module to a default one:

rsc module -r

rsc module --reset

Component

Create normal component

rsc component [ComponentName] -n

rsc component [ComponentName] --normal

Create pure component

rsc component [ComponentName] -p

rsc component [ComponentName] --pure

Create stateless component

rsc component [ComponentName] -s

rsc component [ComponentName] --stateless