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

super-react

v0.9.1

Published

Opinionated Command Line Tool for Scaffolding out Nested React Components Into Files

Downloads

6

Readme

#Super React

Opinionated Command Line Tool for Scaffolding out Nested React Components Into Files

##Install

npm install -g super-react

##Usage

super-react "[emmet_string]" [--hybrid|--es5] [--ext=js]

##Scaffold Components From Emmet Syntax

This tool uses Emmet style syntax for scaffolding out components in a nested fashion. In this early version of this module, all components are dumped into a single folder but, the React component calls the nested children we specify.

###Basic Example

super-react "App>components/Description+ListContainer>List"

The > denotes a parent component, + denotes a sibling component, and / denotes a folder.

The command results in the following:

created: ./components/
created: components/Description.js
created: App.js
created: components/List.js
created: components/ListContainer.js

App.js has the following contents:

import React, {PropTypes, Component} from 'react';
import Description from './components/Description'
import ListContainer from './components/ListContainer'

class App extends Component {
  constructor(props) {
    super(props)
    this.state = {};
  }
  render() {
    let styles = {};

    return (
      <div>
        <Description />
        <ListContainer />
      </div>
    );
  }
}

App.propTypes = {
}

export default App;

###Hybrid Mode

super-react "App>components/Description+ListContainer>List" --hybrid

Outputs the following ES6 createClass template.

created: ./components/
created: components/Description.js
created: App.js
created: components/List.js
created: components/ListContainer.js
import React, {PropTypes} from 'react';
import Description from './components/Description';
import ListContainer from './components/ListContainer';

const App = React.createClass({
  propTypes: {
  },
  render() {
    const styles = {};

    return (
      <div>
          <Description />
          <ListContainer />
      </div>
    );
  }
});

export default App;

###ES5 Mode

super-react "App>components/Description+ListContainer>List" --es5

Outputs the following ES5 createClass template.

created: ./components/
created: components/Description.js
created: App.js
created: components/List.js
created: components/ListContainer.js
var React = require('react');
var Description = require('./components/Description');
var ListContainer = require('./components/ListContainer');

var App = React.createClass({
  mixins : [],
  propTypes: {
  },
  render: function() {
    var styles = {};

    return (
      <div>
        <Description />
        <ListContainer />
      </div>
    );
  }
});
module.exports = App;

###Custom Extension

super-react "App>components/Description+ListContainer>List" --ext=jsx --es5

Outputs the following ES5 createClass template with jsx extensions.

created: ./components/
created: App.jsx
created: components/ListContainer.jsx
created: components/Description.jsx
created: components/List.jsx
var React = require('react');
var Description = require('./components/Description.jsx');
var ListContainer = require('./components/ListContainer.jsx');

var App = React.createClass({
  mixins : [],
  propTypes: {
  },
  render: function() {
    var styles = {};

    return (
      <div>
        <Description />
        <ListContainer />
      </div>
    );
  }
});
module.exports = App;

##Changelog

  • v0.9.1 Fix propTypes to PropTypes in import and fix documentation
  • v0.9.0 Simplified API and output ES6 by default. Added folder scaffolding.
  • v0.2.0 Added --es6 and --ext flags

##Roadmap

  • v1.0.0 N-depth nested folders rather than one nested folder per declaration.

##Contribute?

I <3 Pull Requests, suggestions, and Issue reports.