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

plop-react-ts

v0.0.2

Published

A set of plop generators for creating React components

Downloads

6

Readme

plop-react-ts

A plop generator for creating React components with specific structure. It allows to create 2 kind of React components:

  • React Component: Simple component with the following folder structure:
    • <Component name>.{jsx|tsx}
    • <Component name>.{scss|css}
    • <Component name>.test.{jsx|tsx}
    • index.{jsx|tsx}
  • React Container (or View): Component with the boilerplate for mapping application state to component's props by using Redux (mapStateToProps & mapDispatchToProps).
    • <Component name>.container.{jsx|tsx}
    • <Component name>.{jsx|tsx}
    • <Component name>.test.{jsx|tsx}
    • index.{jsx|tsx}

For each one of these 2 kind of component, you can choose:

  • which React component to use: PureComponent Class, Component Class and Stateless Function
  • to use ReactI18n or not (multilingualism)
  • to use Typescript or not (Type checker)
  • to use Storybook or not (Component Explorer)

See Examples

Get Started

Installation

  1. Add Plop to your project
$ npm install --save-dev plop
  1. Add Plop-react to your project
$ npm install --save-dev @daz2345/plop-react-ts
  1. Create a plopfile.js at the root of your project
module.exports = function(plop) {
  // Load plop react here
  plop.load("plop-react");

  // You can load other plop module or define your own plop generators or helpers, here
};
  1. Add script inside your package.json, for running plop generator
"plops":"plop --plopfile plopfile.js"
  1. Now you can use it, by running
yarn plops

yarn plop-react

Configuration

Default confguration

By default, Plop-react has default configurations:

{
  componentsPath: './source/components',    		// default location for components
  containersPath: './source/containers',    		// default location for containers
  defaultComponentName: 'Button',           		// default name for component
  defaultContainerName: 'Icon',             		// default name for containers
  defaultComponentType: 'PureComponent Class',  	// use PureComponent Class by default
  useReactI18nByDefault: true,              		// use ReactI18n by default
  useTypescriptByDefault: true,                   	// use Typescript by default
  useRedux: false,					// use Redux files by default
  useScss: true,					// use SCSS files by default
};

How to overwrite default configuration

You can overwrite the whole default configuration (or only some properties) by yours when you load plop-react inside your plop-file.js.

module.exports = function(plop) {
  // Load plop react here and overwrite default configuration
  plop.load("plop-react", {
    componentsPath: "./src/components",
    containersPath: "./src/views",
    defaultComponentName: "Component",
    defaultComponentType: "PureComponent Class",
    useTypescriptByDefault: false
  });
};