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 ] }, diff --git a/gruntfile.js b/gruntfile.js index eb5c3d6752..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 @@ -74,6 +75,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', @@ -228,7 +257,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 () { @@ -288,8 +316,15 @@ module.exports = function (grunt) { // Lint CSS and JavaScript files. grunt.registerTask('lint', ['sass', 'less', 'eslint', 'csslint']); + 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', '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/gulpfile.js b/gulpfile.js index 339a0bdf32..0f4bc2d970 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,6 +17,7 @@ var _ = require('lodash'), } }), pngquant = require('imagemin-pngquant'), + wiredep = require('wiredep').stream, path = require('path'), endOfLine = require('os').EOL, protractor = require('gulp-protractor').protractor, @@ -199,7 +200,7 @@ 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(gulp.dest('config/assets/')); @@ -208,7 +209,7 @@ gulp.task('wiredep', function () { // wiredep task to production gulp.task('wiredep:prod', function () { return gulp.src('config/assets/production.js') - .pipe(plugins.wiredep({ + .pipe(wiredep({ ignorePath: '../../', fileTypes: { js: { diff --git a/package.json b/package.json index be3c6f12ac..c193b95a65 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "glob": "~7.0.0", "grunt": "~1.0.1", "grunt-cli": "~1.2.0", - "gulp-wiredep": "~0.0.0", "helmet": "~1.3.0", "jasmine-core": "~2.4.1", "lodash": "~4.6.1", @@ -76,7 +75,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",