@tealink/ui-generators
Global CLI generators for scaffolding ui based on https://plopjs.com/
Install
npm install --save-dev @tealink/ui-generators
Add the following scripts in package.json:
"scripts": {
"generate": "ui-generators",
"g": "npm run generate"
},
Generate!
npm run g c
Commands
Create component
npm run g c
or
npm run generate component
This will create a react functional component in /components folder and export it
Create page
npm run g p
or
npm run generate page
This will create a react functional component including portals in /pages folder and export it. It will also generate a navigation entrance in the sidebar and add routing.
Create sub-page
npm run g sp
or
npm run generate subpage
This will create a react functional component in /pages/ROOT/ folder and export it, where root is an already exisiting page. It will also add routing under /ROOT/name.
Create hook
npm run g h
or
npm run generate hook
Creates a hook in /hooks folder
Create service
npm run g s
or
npm run generate service
Creates a service in /services folder
Development
cd example
npm install ../
npm run g c
Publish
By versioning the library, it will automatically be pushed to your remote branch. The library is published automatically to npm when merged to master.
npm version patch