# `@toptal/davinci-code`

Generates code that is compliant with the [Frontend Architecture Guidelines](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/1211334831/Frontend+Architecture+Guidelines). It simplifies creation of modules, components, pages and other code.

## Usage

Use it by installing `yarn add @toptal/davinci-code` in your project.

#### Commands

- [`module`](./docs/module.md): create a new module
- [`stories`](./docs/stories.md): create a new Storybook stories file
- [`new page`](./docs/new-page.md): create a new page
- [`new component`](./docs/new-component.md): create a new component

## Custom templates

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:

```js
/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](http://www.hygen.io/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

### IDE Tooling

This package can be used directly in your IDE through these extensions

- [IntelliJ Suite (WebStorm, RubyMine, IDEA)](https://github.com/zaguiini/intellij-davinci-plugin)
- [VSCode](https://github.com/borisyordanov/vscode-supercharge-react)
