@@ -5,23 +5,12 @@ let FileFinder = require("faucet-pipeline-core/lib/util/files/finder");
55let readFile = promisify ( require ( "fs" ) . readFile ) ;
66let stat = promisify ( require ( "fs" ) . stat ) ;
77
8- module . exports = ( pluginConfig , assetManager , { watcher } ) => {
9- let copyAll = buildCopyAll ( pluginConfig , assetManager ) ;
10-
11- // Run once for all files
12- copyAll ( ) ;
13-
14- if ( watcher ) {
15- watcher . on ( "edit" , copyAll ) ;
16- }
17- } ;
18-
19- function buildCopyAll ( copyConfigs , assetManager ) {
20- let copiers = copyConfigs . map ( copyConfig =>
8+ module . exports = ( pluginConfig , assetManager ) => {
9+ let copiers = pluginConfig . map ( copyConfig =>
2110 buildCopier ( copyConfig , assetManager ) ) ;
2211
23- return files => copiers . forEach ( copier => copier ( files ) ) ;
24- }
12+ return files => Promise . all ( copiers . map ( copier => copier ( files ) ) ) ;
13+ } ;
2514
2615function buildCopier ( copyConfig , assetManager ) {
2716 let source = assetManager . resolvePath ( copyConfig . source ) ;
@@ -32,11 +21,10 @@ function buildCopier(copyConfig, assetManager) {
3221 skipDotfiles : true ,
3322 filter : copyConfig . filter
3423 } ) ;
35-
3624 let { fingerprint } = copyConfig ;
3725
3826 return files => {
39- Promise . all ( [
27+ return Promise . all ( [
4028 ( files ? fileFinder . match ( files ) : fileFinder . all ( ) ) ,
4129 determineTargetDir ( source , target )
4230 ] ) . then ( ( [ fileNames , targetDir ] ) => {
0 commit comments