@berun/runner-fuse-box
Version:
BeRun runner for fuse-box, a webpack alternative
21 lines (15 loc) • 632 B
text/typescript
import * as path from 'path'
export default berun => {
const staticDirs = berun.options.paths.appPublic
const watchPaths = Array.isArray(staticDirs)
? staticDirs.map(pathPublic => `${pathPublic}/**/*`)
: `${staticDirs}/**/*`
const publicArray = Array.isArray(staticDirs) ? staticDirs : [staticDirs]
return berun.sparky.src(watchPaths).file(``, file => {
const root = publicArray.find(
element => file.root.substr(0, element.length) === element
)
const relativePath = root ? path.relative(root, file.root) : ''
return file.copy(path.join(berun.options.paths.appBuild, relativePath))
})
}