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:
parent
3124b3be64
commit
4862ac1b31
48
gulpfile.js
48
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));
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user