From b21f9c97efa0a4cfde33d862a6e818e71c4dab3c Mon Sep 17 00:00:00 2001 From: opus1269 Date: Wed, 22 May 2019 08:25:48 -0500 Subject: [PATCH] fix prod build --- gulpfile.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4e245e24..5d60c5e2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -104,16 +104,33 @@ const REP_CP = ''; // copy a directory - Windows only // preconditions: srcDir and destDir set -function copyDir(done) { - const child = require('child_process'); +function copyDirWindows(done) { const from = srcDir.replace(/\//gim, '\\'); const to = destDir.replace(/\//gim, '\\'); - const command = `xcopy /y /q /s "${from}\\*" "${to}\\"`; - console.log(command); + const command = 'xcopy'; + console.log(`copying ${from} to ${to} ...`); - child.exec(command); + const args = [ + '/y', + '/q', + '/s', + `${from}\\*`, + `${to}\\`, + ]; + const copy = spawn(command, args); + + copy.stdout.on('data', (data) => { + console.log(data.toString()); + }); - done(); + copy.stderr.on('data', (data) => { + console.log(`stderr: ${data.toString()}`); + }); + + copy.on('exit', (code) => { + console.log(`${command} exited with code ${code.toString()}`); + done(); + }); } // Development build @@ -148,8 +165,8 @@ function buildProd(done) { zipDirectory = 'build/prod'; manifestDest = 'build/prodTest/app'; - return gulp.series(jsLint, tsLint, tsCompile, polyBuildProd, - copyDir, manifest, jsDelete, zipBuild, prodTestDelete, docs)(done); + return gulp.series(jsLint, tsLint, tsCompile, polyBuildProd, manifest, + copyDirWindows, docs, jsDelete, zipBuild, prodTestDelete)(done); } // watch for file changes