import { ITaskFunction } from "./GulpHelpers" ; const ansiColors = require ( "ansi-colors" ) ; const fancylog = require ( "fancy-log" ) ; const fs = require ( "fs" ) ; const glob = require ( "glob" ) . Glob ; const cleanTypedoc = async ( ) => { const pattern = "docs/typedoc/**/*.html" ; fancylog ( "Looking for:" , ansiColors . yellow ( pattern ) ) ; const infoToRemove = "https://github.com/gizafoundation/brightside" ; try { const typedocFolder = glob ( pattern , { mark : true , sync : true } ) ; if ( typedocFolder . found . length === 0 ) { throw new Error ( `We could not find ${ pattern }. Use "npm run typedoc" before executing this task` ) ; } typedocFolder . found . forEach ( ( filename , fileIndex ) => { fancylog ( `Cleaning file ${ fileIndex + 1 }/${ typedocFolder . found . length } : ${ ansiColors . blue ( filename ) }` ) ; fs . writeFileSync ( filename , fs . readFileSync ( filename ) . toString ( ) . replace ( new RegExp ( infoToRemove , "g" ) , "***REMOVED***" ) ) ; } ) ; } catch ( err ) { throw new Error ( ansiColors . red ( err . message ) ) ; } } ; cleanTypedoc . description = "Clean the generated typedoc" ; exports . cleanTypedoc = cleanTypedoc ;