Skip to content

WoW-rotfl/component-structure

Repository files navigation

Component Structure

Component Structure is a component creation CLI tool. It created directory with all defined structure(files).

How it works

  1. Define component destination relative path e.g. ./src/components
  2. Define component structure separated by space e.g. index.js .js .scss __tests__/.test.js. Files with component name must start with dot e.g. .js -> ComponentName.js, .test.js -> ComponentName.test.js

Usage

  1. Install the package
npm install component-structure --save-dev
  1. Two ways, direct shell:
./node_modules/.bin/component-structure Button --path ./src/components --structure index.js .js __tests__/.test.js __tests__/.e2e.js

or set in package.json

{
  "scripts": {
    "start": ...,
    "test":  ...,
    "cs": "./node_modules/.bin/component-structure -p ./src/components -s index.js .js __tests__/.test.js __tests__/.e2e.js --"
    "cs:ui": "./node_modules/.bin/component-structure -p ./src/components/ui -s index.js .js __tests__/.test.js __tests__/.e2e.js --"
  }
}

Note Two dashes at the end of the line required(due to yargs api) - for the separating component names from structure.

and run:

npm run cs Accordion Button Link Panel

About

Create component with all predefined files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published