Link to git-hub
{
"templates": {
"comp": {
"template": "templates/comp",
"generate": "generated/Components"
}
}
}
~/Root Directory
│
├─ src
│ ├─ Components
│ │ └── AnyComponent
│ │ └─ AnyComponent.tsx
│ │
│ └ index.ts
│
└── templates
└── comp
├─ FileName.tsx
└─ FileName.module.scss
import { FC } from 'react'
import style from './FileName.module.scss'
interface FileNameProps {
}
export const FileName: FC<FileNameProps> = ({}) => {
return <div className={style.wrap}>TemplateName</div>
}
After running the script, "FileName" will be replaced with what you specified in the script as an argument ( TestComponents)
npx gen-template config/generate.json comp TestComponents
import { FC } from 'react'
import style from './FileName.module.scss'
interface TestComponentsProps {
}
export const TestComponents: FC<TestComponentsProps> = ({}) => {
return <div className={style.wrap}>TestComponents</div>
}
~/Root Directory
│
├─ src
│ ├─ Components
│ │ ├─ AnyComponent
│ │ │ └─ AnyComponent.tsx
│ │ └─ TestComponents
│ │ ├─ TestComponents.tsx
│ │ └─ TestComponents.module.scss
│ │
│ └ index.ts
│
└── templates
└── comp
├─ FileName.tsx
└─ FileName.module.scss
npx gen-template config/generate.json comp TestComponents AnotherComponent