Created
August 29, 2019 09:38
-
-
Save qfox/764e5ad976ee2e0b1f98240b9e79b9e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const args = process.argv.slice(2); | |
const cell = { | |
block: args[0], | |
mod: { | |
name: args[1], | |
val: args[2], | |
} | |
}; | |
// cell | |
const ModVal = args[3] || `${PascalCase(cell.mod.name)}${PascalCase(cell.mod.val)}`; | |
const BlockModVal = args[4] || `${cell.block}${ModVal}`; | |
function PascalCase(s) { return s[0].toUpperCase() + s.slice(1); } | |
console.log(`import { withBemMod } from '@bem-react/core'; | |
import { cn${cell.block} } from '../${cell.block}'; | |
import './${cell.block}_${cell.mod.name}_${cell.mod.val}.css'; | |
export interface I${BlockModVal}Props { | |
/** | |
* Внешний вид кнопки. | |
*/ | |
${cell.mod.name}?: '${cell.mod.val}'; | |
} | |
/** | |
* Модификатор, отвечающий за внешний вид. | |
* @param {I${BlockModVal}Props} props | |
*/ | |
export const with${ModVal} = withBemMod<I${BlockModVal}Props>(cn${cell.block}(), { ${cell.mod.name}: '${cell.mod.val}' });`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment