Skip to content

Commit 661de88

Browse files
committed
Merge pull request #1127 from kingcody/feature/wiredep-karma
feat(app): use wiredep to inject bower deps into karma.conf.js
2 parents 93f534d + f31e996 commit 661de88

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

app/templates/Gruntfile.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = function (grunt) {
7272
},
7373
jsTest: {
7474
files: ['<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js'],
75-
tasks: ['newer:jshint:all', 'karma']
75+
tasks: ['newer:jshint:all', 'wiredep:test', 'karma']
7676
},<% if (filters.stylus) { %>
7777
injectStylus: {
7878
files: ['<%%= yeoman.client %>/{app,components}/**/*.styl'],
@@ -240,12 +240,26 @@ module.exports = function (grunt) {
240240
}
241241
},
242242

243-
// Automatically inject Bower components into the app
243+
// Automatically inject Bower components into the app and karma.conf.js
244244
wiredep: {
245-
target: {
245+
options: {
246+
exclude: [
247+
/angular-scenario/,
248+
/bootstrap-sass-official/,
249+
/bootstrap.js/,
250+
'/json3/',
251+
'/es5-shim/'<% if(!filters.css) { %>,
252+
/bootstrap.css/,
253+
/font-awesome.css/<% } %>
254+
]
255+
},
256+
client: {
246257
src: '<%%= yeoman.client %>/index.html',
247258
ignorePath: '<%%= yeoman.client %>/',
248-
exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/'<% if(!filters.css) { %>, /bootstrap.css/, /font-awesome.css/ <% } %>]
259+
},
260+
test: {
261+
src: './karma.conf.js',
262+
devDependencies: true
249263
}
250264
},
251265

@@ -773,7 +787,7 @@ module.exports = function (grunt) {
773787
'injector:sass',<% } %>
774788
'concurrent:server',
775789
'injector',
776-
'wiredep',
790+
'wiredep:client',
777791
'postcss',
778792
'concurrent:debug'
779793
]);
@@ -787,7 +801,7 @@ module.exports = function (grunt) {
787801
'injector:sass',<% } %>
788802
'concurrent:server',
789803
'injector',
790-
'wiredep',
804+
'wiredep:client',
791805
'postcss',
792806
'express:dev',
793807
'wait',
@@ -821,6 +835,7 @@ module.exports = function (grunt) {
821835
'concurrent:test',
822836
'injector',
823837
'postcss',
838+
'wiredep:test',
824839
'karma'
825840
]);
826841
}
@@ -847,7 +862,7 @@ module.exports = function (grunt) {
847862
'injector:sass',<% } %>
848863
'concurrent:test',
849864
'injector',
850-
'wiredep',
865+
'wiredep:client',
851866
'postcss',
852867
'express:dev',
853868
'protractor'
@@ -903,7 +918,7 @@ module.exports = function (grunt) {
903918
'injector:sass',<% } %>
904919
'concurrent:dist',
905920
'injector',
906-
'wiredep',
921+
'wiredep:client',
907922
'useminPrepare',
908923
'postcss',
909924
'ngtemplates',

app/templates/_package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"devDependencies": {
3737
"autoprefixer-core": "^5.2.1",
3838
"grunt": "~0.4.4",
39-
"grunt-wiredep": "~1.8.0",
39+
"grunt-wiredep": "^2.0.0",
4040
"grunt-concurrent": "~0.5.0",
4141
"grunt-contrib-clean": "~0.5.0",
4242
"grunt-contrib-concat": "~0.4.0",

app/templates/karma.conf.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@ module.exports = function(config) {
1212

1313
// list of files / patterns to load in the browser
1414
files: [
15-
'client/bower_components/jquery/dist/jquery.js',
16-
'client/bower_components/angular/angular.js',
17-
'client/bower_components/angular-mocks/angular-mocks.js',
18-
'client/bower_components/angular-resource/angular-resource.js',
19-
'client/bower_components/angular-cookies/angular-cookies.js',
20-
'client/bower_components/angular-sanitize/angular-sanitize.js',
21-
'client/bower_components/angular-route/angular-route.js',<% if (filters.uibootstrap) { %>
22-
'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',<% } %>
23-
'client/bower_components/lodash/dist/lodash.compat.js',<% if (filters.socketio) { %>
24-
'client/bower_components/angular-socket-io/socket.js',<% } %><% if (filters.uirouter) { %>
25-
'client/bower_components/angular-ui-router/release/angular-ui-router.js',<% } %>
15+
// bower:js
16+
// endbower<% if (filters.socketio) { %>
17+
'node_modules/socket.io-client/socket.io.js',<% } %>
2618
'client/app/app.js',
2719
'client/app/app.coffee',
2820
'client/app/**/*.js',

0 commit comments

Comments
 (0)