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

@daveawb/create-react-component-folder

v0.2.1

Published

Creates single react component folder structure

Downloads

46

Readme

Create React Component folder

NPM version NPM downloads

About

Create React Component folder works on macOS, Windows, and Linux. It creates React or React Native component folder structure with one command. There is also support for Typescript, React Native, Less and Sass.

Quick Overview

$ npm install --save-dev create-react-component-folder
$ npx crcf myComponent

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

Tutorial

Read the artice on Medium

Installation

$ npm install --save-dev create-react-component-folder

Creating single component

$ npx crcf myComponent
$ npx crcf components/myComponent

Output single

Creating multiple components

$ npx crcf components/header footer button navigation

Output multiple

Component folder structure

myComponent
├── index.js
├── myComponent.js
├── myComponent.css
├── myComponent.test.handlebars

if story book is enable

myComponent
├── index.js
├── myComponent.js
├── myComponent.css
├── myComponent.test.handlebars
├── myComponent.stories.js

Set default config

There is support for setting default config options, so you only have to set you desired config once. This makes creating your components even easier. All you have to do is follow one of these three options.

In your package.json, add a "crcf" property key with array of default config options

"stories" is to enable story book component

"spec" to have the file extensions

"crcf": [
  "scss",
  "proptypes",
  "stories",
  "spec"
]

Create a rc file named .crcfrc in the root of your project and insert a array of default config options in that file

[
  "scss",
  "proptypes",
  "stories"
]

Create a config file named .crcf.config.js in the root of your project and insert a array of default config options

[
  "scss",
  "proptypes"
  "stories"
]

So now all you have to do is type npx crcf componentName and you will get all your default options when you create a component or multiple components. Here below you can see all the options.

[
  "typescript",
  "scss",
  "less",
  "nocss",
  "notest",
  "reactnative",
  "createindex",
  "uppercase",
  "jsx",
  "proptypes",
  "stories",
  "nosemi",
  "cssmodules"
  "namedexports",
]

Creating index.js file for multple component imports

$ npx crcf --createindex

Output in index.js file for multiple component imports

Publishing templates

Publishing the templates allows you to have finer control over the generated components and content.

$ npx crcf publish-templates

The templates will be copied to a directory .crcf/templates relative to the directory you ran the script from.

Options

$ npx crcf --help

  Usage: index [options]

  Options:

    -V, --version       output the version number
    --typescript        Creates Typescript component and files
    --nocss             No css file
    --notest            No test file
    --cssmodules        Creates css/less/scss file with .module extensions. Example 
    --reactnative       Creates React Native components
    --createindex       Creates index.js file for multple component imports
    -f, --functional    Creates React stateless functional component
    -j, --jsx           Creates the component file with .jsx extension
    -l, --less          Adds .less file to component
    -s, --scss          Adds .scss file to component
    -p, --proptypes     Adds prop-types to component
    -u, --uppercase     Component files start on uppercase letter
    -h, --help          output usage information
    -sb, --stories      Add Storie file to component
    -ns, --nosemi       No semicolons
    -x, --namedexports  Creates files using named exports

Author

License

MIT