import { copy as cp } from 'fs-extra' ; import { join , resolve } from 'path' ; const globby = require ( 'globby' ) ; export function copy ( tasks ) { return Promise . all ( tasks . map ( task => copySingle ( task [ 0 ] , task [ 1 ] ) ) ) ; } export function copySingle ( from , dest ) { return globby ( from ) . then ( ( sources ) => Promise . all ( sources . map ( source => cp ( source , resolve ( dest , source ) ) ) ) ) ; }