Component Structure
Component Structure is a component creation CLI tool. It created directory with all defined structure(files).
How it works
- Define component destination relative path e.g.
./src/components
- 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
- Install the package
npm install component-structure --save-dev
- 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