import { resolve } from 'path' ; import { createPort } from '..' ; import { getAllFiles } from 'core/modules/file-system/get-all-files' ; import { debugService } from 'services' ; import { emojis , folders } from 'shared/constants' ; import { joinReplacements } from './join-replacements' ; async param { DocumentCompiler } props returns { Promise < void > } example export async function createReadme ( props ) { const [ portName ] = props . template . replace ( `${ folders . portsFolder }/` , '' ) . split ( '/' ) ; const debug = debugService ( 'create-readme' , portName ) ; debug ( `${ emojis . dna } compiling README.md` ) ; const sharedTemplateFolder = resolve ( 'src' , folders . sharedFolder , 'templates' , 'readmes' ) ; const documentsPath = await getAllFiles ( sharedTemplateFolder ) ; for ( const documentPath of documentsPath ) { await joinReplacements ( documentPath , props ) ; } await createPort ( { ... props , showDebugLogs : false } ) ; debug ( `${ emojis . shine } done!` ) ; }