Generates code that is compliant with the Frontend Architecture Guidelines. It simplifies creation of modules, components, pages and other code.
Use it by installing yarn add @toptal/davinci-code
in your project.
-
module
: create a new module -
stories
: create a new Storybook stories file -
new page
: create a new page -
new component
: create a new component
To use a custom template from your project to generate components, pages or other files you just need to create those templates following the next format and file paths:
/your-project-root
/_templates
/templateName
/new
...hygen template files
Important! You have to keep the structure and the folder names _templates
and new
are important. templateName
will be replaced with your template name, ex. SearchPage
, ContentComponent
, etc. new
folder is a required directory for storing template files.
All the hygen template files have a format of hygen templates.
To create a component from your custom template execute the command:
davinci-code templateName componentName moduleName
Arguments:
-
templateName
- name of the custom template -
moduleName
- name of the destination module -
componentName
- name of the React component
This package can be used directly in your IDE through these extensions