class RemoveTask extends BalmJS . BalmTask { constructor ( ) { super ( 'remove' ) ; } #getFiles = ( input ) : string | string [ ] => { let files = BalmJS . file . absPaths ( input ) ; files = BalmJS . utils . isArray ( input ) ? ( files as string [ ] ) . map ( ( file ) => file . replace ( /\\/g , '/' ) ) : ( files as string ) . replace ( /\\/g , '/' ) ; return files ; } ; recipe ( input ) { const balmRemove = async ( callback ) : Promise < void > => { const canDel = ! ! ( ( BalmJS . utils . isString ( input ) && ( input as string ) . trim ( ) ) || ( BalmJS . utils . isArray ( input ) && input . length ) ) ; if ( canDel ) { const files = this . #getFiles ( input ) ; BalmJS . logger . debug ( `${ this . name } task` , { files } , { pre : true } ) ; const deletedPaths = await require ( 'del' ) ( files , { force : true } ) ; BalmJS . logger . warn ( `${ this . name } task` , { deletedPaths } , { pre : true } ) ; } else { BalmJS . logger . error ( `${ this . name } task` , 'Invalid input' ) ; } callback ( ) ; } ; return balmRemove ; } fn ( callback ) { callback ( ) ; } } export default RemoveTask ;