Deployment as WAR - mgechev/angular-seed GitHub Wiki
- Define a destination directory in
/tools/config/project.config.ts
WAR_DEST = `${this.DIST_DIR}/`;
- Install gulp-war and gulp-zip
npm install --save-dev gulp-war
npm install --save-dev gulp-zip
- Create a task
tools/tasks/project/build.war.ts
:
import * as gulp from 'gulp';
var war = require('gulp-war');
var zip = require('gulp-zip');
import {
APP_DEST, WAR_DEST
} from '../../config';
export = () => {
return gulp.src(APP_DEST + '/**')
.pipe(war({
welcome: 'index.html',
displayName: 'THE NAME OF MY APPLICATION',
}))
.pipe(zip('theNameOfMyApplication.war'))
.pipe(gulp.dest(WAR_DEST));
};
-
Define in project.tasks.json your new gulp task script
'build.war'
named e.g.'build.prod.war'
and base it off of build.prod.
{
"build.prod.war": [
"initialize",
"check.tools",
"clean.prod",
"tslint",
"build.assets.prod",
"build.html_css",
"copy.prod",
"build.js.prod",
"build.bundles",
"build.bundles.app",
"minify.bundles",
"build.index.prod",
"sw.manifest.static",
"minify.index",
"build.war"
]
}
-
In package.json, add the new npm script command in scripts:
"build.prod.war": "gulp build.prod.war --color --env-config prod --build-type prod",