import * as path from 'path' ; import { CreateUtil } from '../utils' ; import { VisualforceComponentOptions } from '../utils/types' ; import { SfdxGenerator } from './sfdxGenerator' ; export default class VisualforceComponentGenerator extends SfdxGenerator < VisualforceComponentOptions > { constructor ( args , options ) { super ( args , options ) ; this . sourceRootWithPartialPath ( 'visualforcecomponent' ) ; } public validateOptions ( ) { CreateUtil . checkInputs ( this . options . componentname ) ; CreateUtil . checkInputs ( this . options . template ) ; } public writing ( ) { const { template , outputdir , label , apiversion , componentname } = this . options ; this . fs . copyTpl ( this . templatePath ( `${ template }.component` ) , this . destinationPath ( path . join ( outputdir , `${ componentname }.component` ) ) , { } ) , this . fs . copyTpl ( this . templatePath ( '_component.component-meta.xml' ) , this . destinationPath ( path . join ( outputdir , `${ componentname }.component-meta.xml` ) ) , { vfLabel : label , apiVersion : apiversion } ) ; } }