import { pipeline } from 'stream' ; import { promisify } from 'util' ; import vfs from 'vinyl-fs' ; import { BuildContext } from '../build_context' ; const asyncPipeline = promisify ( pipeline ) ; export async function writePublicAssets ( { log , plugin , sourceDir , buildDir } ) { if ( ! plugin . manifest . ui ) { return ; } log . info ( 'copying assets from `public/assets` to build' ) ; await asyncPipeline ( vfs . src ( [ 'public/assets/**/*' ] , { cwd : sourceDir , base : sourceDir , buffer : true , allowEmpty : true , } ) , vfs . dest ( buildDir ) ) ; }