Permalink
Browse files

Remove bower (#194)

* remove need for bower
* bump travis to 8.11.3
* add js files to test cases
* remove unnecessary extra npm install from travis config
* Nitpicking html comments.
  • Loading branch information...
jasonk000 committed Jun 28, 2018
1 parent c77bbe7 commit d9373593cf82535a428d836d5040862438ac9ac2
Showing with 119 additions and 138 deletions.
  1. +0 −3 .bowerrc
  2. +1 −0 .nvmrc
  3. +3 −8 .travis.yml
  4. +0 −57 bower.json
  5. +0 −21 e2e/main.spec.js
  6. +22 −4 gulp/build.js
  7. +44 −10 gulp/conf.js
  8. +14 −5 gulp/inject.js
  9. +2 −4 gulp/server.js
  10. +1 −1 gulp/watch.js
  11. +3 −10 karma.conf.js
  12. +23 −5 package.json
  13. +6 −10 src/index.html
View

This file was deleted.

Oops, something went wrong.
View
1 .nvmrc
@@ -0,0 +1 @@
8.11.3
View
@@ -1,14 +1,9 @@
language: node_js
node_js:
- "4.7.2"
before_script:
- npm install -g gulp
- npm install -g bower
- npm install
- bower install
- "8.11.3"
script:
- make test
- make build
- npm run test
- npm run build
services:
- docker
env:
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -3,9 +3,10 @@
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var sort = require('gulp-angular-filesort');
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
pattern: ['gulp-*', 'uglify-save-license', 'del']
});
gulp.task('partials', function () {
@@ -70,12 +71,29 @@ gulp.task('html', ['inject', 'partials'], function () {
// Only applies for fonts from bower dependencies
// Custom fonts are handled by the "other" task
gulp.task('fonts', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{eot,otf,svg,ttf,woff,woff2}'))
return gulp.src(conf.vendorFonts)
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
});
gulp.task('vendor-css', function() {
return gulp.src(conf.vendorCss)
.pipe($.cssnano())
.pipe($.concat('vendor.css'))
.pipe($.rev())
.pipe(gulp.dest(path.join(conf.paths.dist, '/styles/')))
})
gulp.task('vendor-js', function() {
return gulp.src(conf.vendorJs)
.pipe($.sourcemaps.init())
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
.pipe($.concat('vendor.js'))
.pipe($.rev())
.pipe($.sourcemaps.write('../maps/scripts'))
.pipe(gulp.dest(path.join(conf.paths.dist, '/scripts/')))
})
gulp.task('other', function () {
var fileFilter = $.filter(function (file) {
return file.stat.isFile();
@@ -93,4 +111,4 @@ gulp.task('clean', function () {
return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]);
});
gulp.task('build', ['html', 'fonts', 'other']);
gulp.task('build', ['html', 'fonts', 'other', 'vendor-js', 'vendor-css']);
View
@@ -18,16 +18,6 @@ exports.paths = {
e2e: 'e2e'
};
/**
* Wiredep is the lib which inject bower dependencies in your project
* Mainly used to inject script tags in the index.html but also used
* to inject css preprocessor deps and js files in karma
*/
exports.wiredep = {
exclude: [],
directory: 'bower_components'
};
/**
* Common implementation for an error handler of a Gulp plugin
*/
@@ -39,3 +29,47 @@ exports.errorHandler = function(title) {
this.emit('end');
};
};
/**
* Most straightforward way to load dependencies in order with gulp
* Need to move to webpack
*/
exports.vendorCss = [
"node_modules/bootstrap/dist/css/bootstrap.css",
"node_modules/angular-toastr/dist/angular-toastr.css",
"node_modules/animate.css/animate.css",
"node_modules/malhar-angular-dashboard/dist/malhar-angular-dashboard.css",
"node_modules/nvd3/build/nv.d3.css",
"node_modules/font-awesome/css/font-awesome.css"
]
exports.vendorJs = [
"node_modules/jquery/dist/jquery.js",
"node_modules/angular/angular.js",
"node_modules/angular-route/angular-route.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js",
"node_modules/lodash/lodash.js",
"node_modules/angular-toastr/dist/angular-toastr.tpls.js",
"node_modules/moment/moment.js",
"node_modules/jquery-ui-dist/jquery-ui.js",
"node_modules/angular-ui-sortable/dist/sortable.js",
"node_modules/malhar-angular-dashboard/dist/malhar-angular-dashboard.js",
"node_modules/d3/d3.js",
"node_modules/nvd3/build/nv.d3.js",
"node_modules/angular-sanitize/angular-sanitize.js"
]
exports.vendorFonts = [
"node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot",
"node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.svg",
"node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf",
"node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff",
"node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2",
"node_modules/font-awesome/fonts/fontawesome-webfont.eot",
"node_modules/font-awesome/fonts/fontawesome-webfont.svg",
"node_modules/font-awesome/fonts/fontawesome-webfont.ttf",
"node_modules/font-awesome/fonts/fontawesome-webfont.woff",
"node_modules/font-awesome/fonts/fontawesome-webfont.woff2",
"node_modules/font-awesome/fonts/FontAwesome.otf"
]
View
@@ -6,7 +6,6 @@ var conf = require('./conf');
var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream;
var _ = require('lodash');
var browserSync = require('browser-sync');
@@ -15,12 +14,15 @@ gulp.task('inject-reload', ['inject'], function() {
browserSync.reload();
});
gulp.task('inject', ['scripts'], function () {
gulp.task('inject', ['scripts', 'vendor-js', 'vendor-css'], function () {
var injectStyles = gulp.src([
path.join(conf.paths.src, '/app/**/*.css')
], { read: false });
var injectScripts = gulp.src([
var vendorScripts = gulp.src(conf.vendorJs)
var vendorStyles = gulp.src(conf.vendorCss)
var appScripts = gulp.src([
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.js'),
path.join('!' + conf.paths.src, '/app/**/*.spec.js'),
@@ -33,9 +35,16 @@ gulp.task('inject', ['scripts'], function () {
addRootSlash: false
};
var vendorOptions = {
starttag: '<!-- inject:vendor:{{ext}} -->',
ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve'), conf.paths.dist],
addRootSlash: false
};
return gulp.src(path.join(conf.paths.src, '/*.html'))
.pipe($.inject(vendorScripts, vendorOptions))
.pipe($.inject(vendorStyles, vendorOptions))
.pipe($.inject(injectStyles, injectOptions))
.pipe($.inject(injectScripts, injectOptions))
.pipe(wiredep(_.extend({}, conf.wiredep)))
.pipe($.inject(appScripts, injectOptions))
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));
});
View
@@ -16,9 +16,7 @@ function browserSyncInit(baseDir, browser) {
var routes = null;
if(baseDir === conf.paths.src || (util.isArray(baseDir) && baseDir.indexOf(conf.paths.src) !== -1)) {
routes = {
'/bower_components': 'bower_components'
};
routes = { };
}
var server = {
@@ -47,7 +45,7 @@ browserSync.use(browserSyncSpa({
}));
gulp.task('serve', ['watch'], function () {
browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src]);
browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src, '.']);
});
gulp.task('serve:dist', ['build'], function () {
View
@@ -12,7 +12,7 @@ function isOnlyChange(event) {
gulp.task('watch', ['inject'], function () {
gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']);
gulp.watch([path.join(conf.paths.src, '/*.html'), 'package.json'], ['inject-reload']);
gulp.watch(path.join(conf.paths.src, '/app/**/*.css'), function(event) {
if(isOnlyChange(event)) {
View
@@ -4,26 +4,19 @@ var path = require('path');
var conf = require('./gulp/conf');
var _ = require('lodash');
var wiredep = require('wiredep');
var pathSrcHtml = [
path.join(conf.paths.src, '/**/*.html')
];
function listFiles() {
var wiredepOptions = _.extend({}, conf.wiredep, {
dependencies: true,
devDependencies: true
});
var patterns = wiredep(wiredepOptions).js
.concat([
var patterns = conf.vendorJs.concat([
'node_modules/angular-mocks/angular-mocks.js',
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.js'),
path.join(conf.paths.src, '/**/*.spec.js'),
path.join(conf.paths.src, '/**/*.mock.js'),
])
.concat(pathSrcHtml);
]).concat(pathSrcHtml);
var files = patterns.map(function(pattern) {
return {
View
@@ -6,9 +6,29 @@
"main": "src/app/index.html",
"repository": "https://github.com/Netflix/vector",
"license": "Apache-2.0",
"dependencies": {},
"dependencies": {
"angular": "~1.4.10",
"angular-mocks": "~1.4.10",
"angular-route": "~1.4.10",
"angular-sanitize": "~1.4.10",
"angular-toastr": "~1.5.0",
"angular-ui-bootstrap": "^2.5.6",
"angular-ui-sortable": "^0.19.0",
"animate.css": "~3.4.0",
"bootstrap": "~3.3.6",
"d3": "3.5.16",
"font-awesome": "4.6.1",
"jquery": "~2.1.4",
"lodash": "~4.5.1",
"malhar-angular-dashboard": "git+https://github.com/dtpublic/malhar-angular-dashboard.git",
"moment": "~2.10.6",
"nvd3": "1.8.2"
},
"scripts": {
"test": "gulp test"
"clean": "gulp clean",
"build": "gulp build",
"test": "gulp test",
"serve": "gulp serve"
},
"devDependencies": {
"browser-sync": "~2.9.11",
@@ -21,6 +41,7 @@
"gulp-angular-filesort": "~1.1.1",
"gulp-angular-templatecache": "~1.8.0",
"gulp-autoprefixer": "~3.0.2",
"gulp-concat": "^2.6.1",
"gulp-cssnano": "~2.1.1",
"gulp-eslint": "~1.0.0",
"gulp-filter": "~3.0.1",
@@ -49,11 +70,8 @@
"karma-ng-html2js-preprocessor": "~0.2.0",
"karma-phantomjs-launcher": "~0.2.1",
"karma-phantomjs-shim": "~1.2.0",
"lodash": "~3.10.1",
"main-bower-files": "~2.9.0",
"phantomjs": "~2.1.7",
"uglify-save-license": "~0.4.1",
"wiredep": "~2.2.2",
"wrench": "~1.5.8"
},
"engines": {
Oops, something went wrong.

0 comments on commit d937359

Please sign in to comment.