1.0.8 • Published 9 months ago

generate-templates v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Link to git-hub

Example config

{
  "templates": {
    "comp": {
      "template": "templates/comp",
      "generate": "generated/Components"
    }
  }
}

Template structure

~/Root Directory
│
├─ src
│   ├─ Components
│   │  └── AnyComponent
│   │      └─ AnyComponent.tsx 
│   │
│   └ index.ts
│
└── templates
    └── comp
        ├─ FileName.tsx
        └─ FileName.module.scss
    

Data in FileName.tsx

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)

Script

npx gen-template config/generate.json comp TestComponents

After script run

Components

import { FC } from 'react'

import style from './FileName.module.scss'

interface TestComponentsProps {
}

export const TestComponents: FC<TestComponentsProps> = ({}) => {
	return <div className={style.wrap}>TestComponents</div>
}

Directory

~/Root Directory
│
├─ src
│   ├─ Components
│   │  ├─ AnyComponent
│   │  │   └─ AnyComponent.tsx 
│   │  └─ TestComponents
│   │     ├─ TestComponents.tsx
│   │     └─ TestComponents.module.scss
│   │
│   └ index.ts
│
└── templates
    └── comp
        ├─ FileName.tsx
        └─ FileName.module.scss
    

You can generate multiple files at once

npx gen-template config/generate.json comp TestComponents AnotherComponent
1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

10 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago