From 5b6a1c6290f5d4eb842a1a14a7c8871bda7ecfd8 Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Sat, 16 Jul 2016 15:55:04 +0300 Subject: [PATCH 1/8] Fix(grunt): remove redundant grunt task loading remove explicit grunt task loading for `grunt-protactor-coverage` as `load-grunt-tasks` handles it --- gruntfile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/gruntfile.js b/gruntfile.js index eb5c3d6752..c40185f4be 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -228,7 +228,6 @@ module.exports = function (grunt) { // Load NPM tasks require('load-grunt-tasks')(grunt); - grunt.loadNpmTasks('grunt-protractor-coverage'); // Make sure upload directory exists grunt.task.registerTask('mkdir:upload', 'Task that makes sure upload directory exists.', function () { From 29842081de3392bb85e464527aee1f687e35a305 Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Sat, 16 Jul 2016 16:00:27 +0300 Subject: [PATCH 2/8] Feat(grunt): add wiredep task for grunt Automatically update bower dependencies. --- gruntfile.js | 30 +++++++++++++++++++++++++++++- package.json | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gruntfile.js b/gruntfile.js index c40185f4be..4b063b590f 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -74,6 +74,34 @@ module.exports = function (grunt) { } } }, + wiredep: { + fileTypes: { + src: 'config/assets/default.js', + ignorePath: '../../', + js: { + replace: { + css: function (filePath) { + var minFilePath = filePath.replace('.css', '.min.css'); + var fullPath = path.join(process.cwd(), minFilePath); + if (!fs.existsSync(fullPath)) { + return '\'' + filePath + '\','; + } else { + return '\'' + minFilePath + '\','; + } + }, + js: function (filePath) { + var minFilePath = filePath.replace('.js', '.min.js'); + var fullPath = path.join(process.cwd(), minFilePath); + if (!fs.existsSync(fullPath)) { + return '\'' + filePath + '\','; + } else { + return '\'' + minFilePath + '\','; + } + } + } + } + } + }, nodemon: { dev: { script: 'server.js', @@ -288,7 +316,7 @@ module.exports = function (grunt) { grunt.registerTask('lint', ['sass', 'less', 'eslint', 'csslint']); // Lint project files and minify them into two production files. - grunt.registerTask('build', ['env:dev', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); + grunt.registerTask('build', ['env:dev', 'wiredep', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); // Run the project tests grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit', 'protractor']); diff --git a/package.json b/package.json index be3c6f12ac..d9ce31035a 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "glob": "~7.0.0", "grunt": "~1.0.1", "grunt-cli": "~1.2.0", + "grunt-wiredep": "^3.0.1", "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", From 07ccc3572b167ad3cfced1066e7ed8c6406795f2 Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Sat, 16 Jul 2016 16:04:32 +0300 Subject: [PATCH 3/8] Fix(grunt-wiredep):Remove trailing comma from assets Remove trailing comma from assets configuration generated by wiredep --- gruntfile.js | 8 +++++++- package.json | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gruntfile.js b/gruntfile.js index 4b063b590f..d5c618dcfb 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -102,6 +102,9 @@ module.exports = function (grunt) { } } }, + rtc: { + files: 'config/assets/*.js' + }, nodemon: { dev: { script: 'server.js', @@ -315,8 +318,11 @@ module.exports = function (grunt) { // Lint CSS and JavaScript files. grunt.registerTask('lint', ['sass', 'less', 'eslint', 'csslint']); + // Update bower dependencies and remove trailing comma + grunt.registerTask('wiredepnocomma', ['wiredep', 'rtc']); + // Lint project files and minify them into two production files. - grunt.registerTask('build', ['env:dev', 'wiredep', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); + grunt.registerTask('build', ['env:dev', 'wiredepnocomma', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); // Run the project tests grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit', 'protractor']); diff --git a/package.json b/package.json index d9ce31035a..a0d7ff04bb 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "glob": "~7.0.0", "grunt": "~1.0.1", "grunt-cli": "~1.2.0", + "grunt-rtc": "^0.1.1", "grunt-wiredep": "^3.0.1", "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", From 8554310f97bc7ea30d9ba1c1512f2eff4c535ed1 Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Sat, 16 Jul 2016 16:19:09 +0300 Subject: [PATCH 4/8] Fix(gulp): Remove trailing comma from asset files Remove trailing comma from asset configurations generated by wiredep --- gulpfile.js | 5 ++++- package.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 339a0bdf32..1a1072dfd2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,7 +13,8 @@ var _ = require('lodash'), runSequence = require('run-sequence'), plugins = gulpLoadPlugins({ rename: { - 'gulp-angular-templatecache': 'templateCache' + 'gulp-angular-templatecache': 'templateCache', + 'gulp-rtc': 'removeComma' } }), pngquant = require('imagemin-pngquant'), @@ -202,6 +203,7 @@ gulp.task('wiredep', function () { .pipe(plugins.wiredep({ ignorePath: '../../' })) + .pipe(plugins.removeComma()) .pipe(gulp.dest('config/assets/')); }); @@ -235,6 +237,7 @@ gulp.task('wiredep:prod', function () { } } })) + .pipe(plugins.removeComma()) .pipe(gulp.dest('config/assets/')); }); diff --git a/package.json b/package.json index a0d7ff04bb..bca0fae875 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "grunt-cli": "~1.2.0", "grunt-rtc": "^0.1.1", "grunt-wiredep": "^3.0.1", + "gulp-rtc": "^1.0.0", "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", From 5cdf2168e05be84574d1ae61009edd7519763aeb Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Sun, 17 Jul 2016 08:36:23 +0300 Subject: [PATCH 5/8] Fix(npm): use tilde ranges --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bca0fae875..a591faf7d2 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,9 @@ "glob": "~7.0.0", "grunt": "~1.0.1", "grunt-cli": "~1.2.0", - "grunt-rtc": "^0.1.1", - "grunt-wiredep": "^3.0.1", - "gulp-rtc": "^1.0.0", + "grunt-rtc": "~0.1.1", + "grunt-wiredep": "~3.0.1", + "gulp-rtc": "~1.0.0", "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", From 375e76248162943cfa6b2c3150a102fdce75936d Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Fri, 22 Jul 2016 14:53:09 +0300 Subject: [PATCH 6/8] Fix(gulp): use wiredep instead of gulp-wiredep Fixes #1398 --- gulpfile.js | 10 ++++------ package.json | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1a1072dfd2..0f4bc2d970 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,11 +13,11 @@ var _ = require('lodash'), runSequence = require('run-sequence'), plugins = gulpLoadPlugins({ rename: { - 'gulp-angular-templatecache': 'templateCache', - 'gulp-rtc': 'removeComma' + 'gulp-angular-templatecache': 'templateCache' } }), pngquant = require('imagemin-pngquant'), + wiredep = require('wiredep').stream, path = require('path'), endOfLine = require('os').EOL, protractor = require('gulp-protractor').protractor, @@ -200,17 +200,16 @@ gulp.task('imagemin', function () { // wiredep task to default gulp.task('wiredep', function () { return gulp.src('config/assets/default.js') - .pipe(plugins.wiredep({ + .pipe(wiredep({ ignorePath: '../../' })) - .pipe(plugins.removeComma()) .pipe(gulp.dest('config/assets/')); }); // wiredep task to production gulp.task('wiredep:prod', function () { return gulp.src('config/assets/production.js') - .pipe(plugins.wiredep({ + .pipe(wiredep({ ignorePath: '../../', fileTypes: { js: { @@ -237,7 +236,6 @@ gulp.task('wiredep:prod', function () { } } })) - .pipe(plugins.removeComma()) .pipe(gulp.dest('config/assets/')); }); diff --git a/package.json b/package.json index a591faf7d2..4cec704179 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,6 @@ "grunt-cli": "~1.2.0", "grunt-rtc": "~0.1.1", "grunt-wiredep": "~3.0.1", - "gulp-rtc": "~1.0.0", - "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", "lodash": "~4.6.1", @@ -79,7 +77,8 @@ "socket.io": "~1.4.5", "swig": "~1.4.2", "validator": "~5.1.0", - "winston": "^2.2.0" + "winston": "^2.2.0", + "wiredep": "~4.0.0" }, "devDependencies": { "coveralls": "~2.11.6", From 7cd674bbbf5d3f00644a7a18174add484aa2c0c9 Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Fri, 22 Jul 2016 14:55:29 +0300 Subject: [PATCH 7/8] Fix(grunt): use wiredep instead of grunt-wiredep --- gruntfile.js | 16 +++++++++------- package.json | 2 -- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index d5c618dcfb..15ad879ee6 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -8,7 +8,8 @@ var _ = require('lodash'), testAssets = require('./config/assets/test'), testConfig = require('./config/env/test'), fs = require('fs'), - path = require('path'); + path = require('path'), + wiredep = require('wiredep'); module.exports = function (grunt) { // Project Configuration @@ -102,9 +103,6 @@ module.exports = function (grunt) { } } }, - rtc: { - files: 'config/assets/*.js' - }, nodemon: { dev: { script: 'server.js', @@ -318,11 +316,15 @@ module.exports = function (grunt) { // Lint CSS and JavaScript files. grunt.registerTask('lint', ['sass', 'less', 'eslint', 'csslint']); - // Update bower dependencies and remove trailing comma - grunt.registerTask('wiredepnocomma', ['wiredep', 'rtc']); + grunt.registerMultiTask('wiredep', 'Inject Bower dependencies.', function () { + this.requiresConfig(['wiredep', this.target, 'src']); + + var options = this.options(this.data); + wiredep(options); + }); // Lint project files and minify them into two production files. - grunt.registerTask('build', ['env:dev', 'wiredepnocomma', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); + grunt.registerTask('build', ['env:dev', 'wiredep', 'lint', 'ngAnnotate', 'uglify', 'cssmin']); // Run the project tests grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit', 'protractor']); diff --git a/package.json b/package.json index 4cec704179..c193b95a65 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,6 @@ "glob": "~7.0.0", "grunt": "~1.0.1", "grunt-cli": "~1.2.0", - "grunt-rtc": "~0.1.1", - "grunt-wiredep": "~3.0.1", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", "lodash": "~4.6.1", From d9f5ca4343d3ff96e8b6029b509b84af810c1bca Mon Sep 17 00:00:00 2001 From: Shanavas M Date: Fri, 22 Jul 2016 14:57:37 +0300 Subject: [PATCH 8/8] Fix(lint): suppress eslint errors in asset files Fixes #1402 --- config/assets/default.js | 13 ++++++++----- config/assets/production.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/config/assets/default.js b/config/assets/default.js index 38f0b2487c..a83f0ba00e 100644 --- a/config/assets/default.js +++ b/config/assets/default.js @@ -1,24 +1,27 @@ 'use strict'; +/* eslint comma-dangle:[0, "only-multiline"] */ + module.exports = { client: { lib: { css: [ // bower:css 'public/lib/bootstrap/dist/css/bootstrap.css', - 'public/lib/bootstrap/dist/css/bootstrap-theme.css' + 'public/lib/bootstrap/dist/css/bootstrap-theme.css', // endbower ], js: [ // bower:js 'public/lib/angular/angular.js', - 'public/lib/angular-resource/angular-resource.js', 'public/lib/angular-animate/angular-animate.js', + 'public/lib/angular-bootstrap/ui-bootstrap-tpls.js', + 'public/lib/angular-file-upload/dist/angular-file-upload.min.js', 'public/lib/angular-messages/angular-messages.js', + 'public/lib/angular-mocks/angular-mocks.js', + 'public/lib/angular-resource/angular-resource.js', 'public/lib/angular-ui-router/release/angular-ui-router.js', - 'public/lib/angular-bootstrap/ui-bootstrap-tpls.js', - 'public/lib/angular-file-upload/dist/angular-file-upload.js', - 'public/lib/owasp-password-strength-test/owasp-password-strength-test.js' + 'public/lib/owasp-password-strength-test/owasp-password-strength-test.js', // endbower ], tests: ['public/lib/angular-mocks/angular-mocks.js'] diff --git a/config/assets/production.js b/config/assets/production.js index 9d82cb8b5e..552a35f073 100644 --- a/config/assets/production.js +++ b/config/assets/production.js @@ -1,24 +1,27 @@ 'use strict'; +/* eslint comma-dangle:[0, "only-multiline"] */ + module.exports = { client: { lib: { css: [ // bower:css 'public/lib/bootstrap/dist/css/bootstrap.min.css', - 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css' + 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css', // endbower ], js: [ // bower:js 'public/lib/angular/angular.min.js', - 'public/lib/angular-resource/angular-resource.min.js', 'public/lib/angular-animate/angular-animate.min.js', - 'public/lib/angular-messages/angular-messages.min.js', - 'public/lib/angular-ui-router/release/angular-ui-router.min.js', 'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js', 'public/lib/angular-file-upload/dist/angular-file-upload.min.js', - 'public/lib/owasp-password-strength-test/owasp-password-strength-test.js' + 'public/lib/angular-messages/angular-messages.min.js', + 'public/lib/angular-mocks/angular-mocks.js', + 'public/lib/angular-resource/angular-resource.min.js', + 'public/lib/angular-ui-router/release/angular-ui-router.min.js', + 'public/lib/owasp-password-strength-test/owasp-password-strength-test.js', // endbower ] },