mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 18:02:05 +02:00
- Added gulp build task the: - Bundles Vendor JS files - Bundles ONOS JS Files - Bundles ONOS CSS Files - Added SourceMaps to JS bundles - Helps with debugging during development - Added Bundles to index.js and removed old references - Git Ignored any generated files - Ensured the build step is able to build without a local copy of node installed - Added BUCK genrules (provided by Viswa) - Added BUCK Dependency to GUI - Buck Rule to run when src changes - Node/NPM downloaded using BUCK remote_file Change-Id: Ia6ca3b952ff801850ade7469c23aac76c8520400
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import gulp from 'gulp';
|
|
import concat from 'gulp-concat';
|
|
import strip from 'gulp-strip-comments';
|
|
import uglyfy from 'gulp-uglify';
|
|
import sourceMaps from 'gulp-sourcemaps';
|
|
import BundleResources from '../helpers/bundleResources';
|
|
|
|
|
|
const GUI_BASE = '../../web/gui/src/main/webapp/';
|
|
const bundleFiles = [
|
|
// NOTE: Bundle the important files first
|
|
'app/directives.js',
|
|
'app/fw/util/util.js',
|
|
'app/fw/mast/mast.js',
|
|
'app/fw/nav/nav.js',
|
|
'app/fw/svg/svg.js',
|
|
'app/fw/remote/remote.js',
|
|
'app/fw/widget/widget.js',
|
|
'app/fw/layer/layer.js',
|
|
|
|
// NOTE: bundle everything else
|
|
'app/fw/**/*.js',
|
|
'app/view/**/*.js'
|
|
];
|
|
|
|
const vendor = [
|
|
'tp/angular.js',
|
|
'tp/angular-route.js',
|
|
'tp/angular-cookies.js',
|
|
'tp/d3.js',
|
|
'tp/topojson.v1.min.js',
|
|
'tp/Chart.min.js',
|
|
'tp/lodash.min.js',
|
|
];
|
|
|
|
function bundle(files, exportName) {
|
|
return gulp.src(BundleResources(GUI_BASE, files))
|
|
.pipe(sourceMaps.init())
|
|
.pipe(strip())
|
|
.pipe(uglyfy())
|
|
.pipe(concat(exportName))
|
|
.pipe(sourceMaps.write('source-map'))
|
|
.pipe(gulp.dest(GUI_BASE + '/dist/'));
|
|
}
|
|
|
|
const tasks = function () {
|
|
gulp.task('bundle-vendor', () => bundle(vendor, 'vendor.js'));
|
|
gulp.task('bundle-js', () => bundle(bundleFiles, 'onos.js'));
|
|
};
|
|
|
|
export default tasks(); |