1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing build script

This commit is contained in:
Patrik J. Braun 2018-01-07 09:11:05 -05:00
parent 3124b3be64
commit 4862ac1b31
2 changed files with 29 additions and 21 deletions

View File

@ -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) { runSequence.apply(this, tasks);
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); gulp.task('build-dev', simpleBuild(false));
}); gulp.task('build-prod', simpleBuild(true));

View File

@ -8,7 +8,7 @@
"main": "./backend/index.js", "main": "./backend/index.js",
"bin": "./backend/index.js", "bin": "./backend/index.js",
"scripts": { "scripts": {
"install": "tsc && ng build -prod", "install": "tsc && gulp build-prod",
"build-release": "gulp build-release", "build-release": "gulp build-release",
"pretest": "tsc", "pretest": "tsc",
"test": "ng test --single-run && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration", "test": "ng test --single-run && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration",