gerco
Version:
Easy way to generate the React component
95 lines • 2.09 kB
JSON
{
"component": {
"files": {
"jsx": {
"imports": [
"import React from 'react';",
"import block from 'bem-cn';",
"import PT from 'prop-types';"
],
"style-imports": [
"import './%name%.scss';"
],
"constants": [
"const b = block('%style-name%');"
],
"main": [
"const %name% = () => {};"
],
"additional": [
"%name%.propTypes = {};"
],
"export": [
"export default %name%;"
]
},
"scss": {
"imports": [
"@import 'shared/style/var%style-imports-name%.scss';"
],
"main": [
".%style-name% {}"
]
}
},
"includeIndex": true,
"indexData": {
"filename": "index.js",
"data": [
"import %name% from './%name%';",
"export default %name%;"
]
}
},
"ts-component": {
"files": {
"tsx": {
"imports": [
"import React from 'react';",
"import block from 'bem-cn';"
],
"additional-imports": [
"import type { I%name%Props } from './%name%Types.ts'"
],
"style-imports": [
"import './%name%.scss';"
],
"constants": [
"const b = block('%style-name%');"
],
"main": [
"const %name%: React.FC<I%name%Props> = () => {};"
],
"export": [
"export default %name%;"
]
},
"scss": {
"imports": [
"@import 'shared/style/var%style-imports-name%.scss';"
],
"main": [
".%style-name% {}"
]
},
"Types.ts": {
"main": [
"interface I%name%Props {}"
],
"exports": [
"export type {",
" I%name%Props,",
"}"
]
}
},
"includeIndex": true,
"indexData": {
"filename": "index.ts",
"data": [
"import %name% from './%name%';",
"export default %name%;"
]
}
}
}