From 4862ac1b31ae165cb0e1b1d3acb391ae914cde7d Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sun, 7 Jan 2018 09:11:05 -0500 Subject: [PATCH] fixing build script --- gulpfile.js | 48 ++++++++++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 69f4c58d..68343b0f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -83,25 +83,33 @@ gulp.task('build-release', function (done) { }); }); +var simpleBuild = function (isProd) { + return function (done) { + var dirCont = fs.readdirSync("./frontend/locale"); + var files = dirCont.filter(function (elm) { + return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig); + }); + var languages = files.map(function (f) { + return f.split(".")[1] + }); + var tasks = []; + var cmd = "ng build "; + if (isProd) { + cmd += " -prod " + } + createFornendTask('build-frontend-dev default', cmd + "--output-path=./dist --no-progress"); + tasks.push('build-frontend-dev default'); + for (var i = 0; i < files.length; i++) { + createFornendTask('build-frontend-dev ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning"); + tasks.push('build-frontend-dev ' + languages[i]); + } + tasks.push(function () { + done(); + }); -gulp.task('build-dev', function (done) { - var dirCont = fs.readdirSync("./frontend/locale"); - var files = dirCont.filter(function (elm) { - return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig); - }); - var languages = files.map(function (f) { - return f.split(".")[1] - }); - var tasks = []; - createFornendTask('build-frontend-dev default', "ng build --prod --output-path=./dist --no-progress"); - tasks.push('build-frontend-dev default'); - for (var i = 0; i < files.length; i++) { - createFornendTask('build-frontend-dev ' + languages[i], "ng build --prod --output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning"); - tasks.push('build-frontend-dev ' + languages[i]); - } - tasks.push(function () { - done(); - }); + runSequence.apply(this, tasks); + }; +}; - runSequence.apply(this, tasks); -}); +gulp.task('build-dev', simpleBuild(false)); +gulp.task('build-prod', simpleBuild(true)); diff --git a/package.json b/package.json index efc18b73..cbb4aac1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "main": "./backend/index.js", "bin": "./backend/index.js", "scripts": { - "install": "tsc && ng build -prod", + "install": "tsc && gulp build-prod", "build-release": "gulp build-release", "pretest": "tsc", "test": "ng test --single-run && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration",