import * as path from 'path' ; import { CreateUtil } from '../utils' ; import { ApexClassOptions } from '../utils/types' ; import { SfdxGenerator } from './sfdxGenerator' ; export default class ApexClassGenerator extends SfdxGenerator < ApexClassOptions > { constructor ( args , options ) { super ( args , options ) ; this . sourceRootWithPartialPath ( 'apexclass' ) ; } public validateOptions ( ) { CreateUtil . checkInputs ( this . options . template ) ; CreateUtil . checkInputs ( this . options . classname ) ; } public writing ( ) { const { template , outputdir , classname , apiversion } = this . options ; this . fs . copyTpl ( this . templatePath ( `${ template }.cls` ) , this . destinationPath ( path . join ( outputdir , `${ classname }.cls` ) ) , { apiName : classname } ) , this . fs . copyTpl ( this . templatePath ( '_class.cls-meta.xml' ) , this . destinationPath ( path . join ( outputdir , `${ classname }.cls-meta.xml` ) ) , { apiName : classname , apiVersion : apiversion } ) ; } }