Permalink
Browse files

Update bower, npm packages, and switch to grunt-contrib-watch

  • Loading branch information...
1 parent b06354a commit b9a76aa35ea794a5e47c7a4d36ab46e7221b2ff3 @ericclemmons committed Jul 4, 2013
Showing with 57 additions and 56 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 .travis.yml
  3. +46 −45 Gruntfile.coffee
  4. +2 −1 client/app/styles/app.less
  5. +1 −1 client/app/test/e2e/runner.html
  6. +2 −2 client/app/test/e2e/scenarios.js
  7. +2 −2 client/index.html
  8. +2 −2 karma.conf.js
  9. +0 −1 package.json
View
@@ -1,5 +1,5 @@
+/bower_components
/build
-/components
/node_modules
/npm-debug.log
.DS_STORE
View
@@ -3,4 +3,4 @@ node_js:
- 0.8
before_install:
- npm install -g bower
- - bower install
+ - bower install --quiet
View
@@ -1,13 +1,19 @@
module.exports = (grunt)->
# Run `grunt server` for live-reloading development environment
- grunt.registerTask('server', [ 'build', 'livereload-start', 'karma:background', 'express', 'regarde' ])
+ grunt.registerTask('server', [ 'build', 'express', 'watch' ])
+
+ # Run `grunt server:unit` for live-reloading unit testing environment
+ grunt.registerTask('server:unit', [ 'build', 'karma:background', 'watch:unit' ])
# Run `grunt test` (used by `npm test`) for continuous integration (e.g. Travis)
- grunt.registerTask('test', [ 'build', 'karma:unit' ])
+ grunt.registerTask('test', [ 'test:unit' ])
+
+ # Run `grunt test:unit` for single-run unit testing
+ grunt.registerTask('test:unit', [ 'build', 'karma:unit' ])
# Run `grunt test:browsers` for real-world browser testing
- grunt.registerTask('test:browsers', [ 'karma:browsers', 'server' ])
+ grunt.registerTask('test:e2e', [ 'karma:e2e' ])
# Clean, validate & compile web-accessible resources
grunt.registerTask('build', [ 'clean', 'jshint', 'copy', 'ngtemplates', 'less' ])
@@ -22,7 +28,7 @@ module.exports = (grunt)->
# Directory CONSTANTS (see what I did there?)
BUILD_DIR: 'build/'
CLIENT_DIR: 'client/'
- COMPONENTS_DIR: 'components/'
+ BOWER_DIR: 'bower_components/'
SERVER_DIR: 'server/'
# Glob CONSTANTS
@@ -43,7 +49,7 @@ module.exports = (grunt)->
images:
files: [
expand: true,
- cwd: '<%= COMPONENTS_DIR %>/bootstrap/img'
+ cwd: '<%= BOWER_DIR %>/bootstrap/img'
src: '<%= IMG_FILES %>'
dest: '<%= BUILD_DIR %>/img'
,
@@ -62,10 +68,10 @@ module.exports = (grunt)->
dest: '<%= BUILD_DIR %>'
]
- # Make components HTTP-accessible
- components:
+ # Make bower HTTP-accessible
+ bower:
files:
- '<%= BUILD_DIR %>': '<%= COMPONENTS_DIR + ALL_FILES %>'
+ '<%= BUILD_DIR %>': '<%= BOWER_DIR + ALL_FILES %>'
# app (non-Bower) JS in `client`
js:
@@ -85,6 +91,12 @@ module.exports = (grunt)->
dest: '<%= BUILD_DIR %>'
]
+ # Express requires `server.script` to reload from changes
+ express:
+ server:
+ options:
+ script: '<%= SERVER_DIR %>/server.js'
+
# Validate app `client` and `server` JS
jshint:
files: [ '<%= SERVER_DIR + JS_FILES %>'
@@ -104,10 +116,9 @@ module.exports = (grunt)->
singleRun: false
# Used for testing site across several browser profiles
- browsers:
+ e2e:
browsers: [ 'PhantomJS' ] # 'Chrome', 'ChromeCanary', 'Firefox', 'Opera', 'Safari', 'IE', 'bin/browsers.sh'
- background: true
- singleRun: false
+ singleRun: true
# Used for one-time validation (e.g. `grunt test`, `npm test`)
unit:
@@ -117,12 +128,6 @@ module.exports = (grunt)->
less:
'<%= BUILD_DIR %>/app/styles/app.css': '<%= CLIENT_DIR %>/app/styles/app.less'
- # Support live-reloading of all non-Bower resources
- livereload:
- options:
- base: '<%= BUILD_DIR %>'
- files: '<%= BUILD_DIR + ALL_FILES %>'
-
# Minify app `.css` resources -> `.min.css`
mincss:
app:
@@ -140,51 +145,49 @@ module.exports = (grunt)->
options:
base: '<%= BUILD_DIR %>'
- # Ability to run `jshint` without errors terminating the development server
- parallel:
- less: [ grunt: true, args: [ 'less' ] ]
- jshint: [ grunt: true, args: [ 'jshint' ] ]
+ # Output for optimized app index
+ usemin:
+ html: '<%= BUILD_DIR %>/index.html'
+
+ # Input for optimized app index
+ useminPrepare:
+ html: '<%= BUILD_DIR %>/index.html'
# "watch" distinct types of files and re-prepare accordingly
- regarde:
+ watch:
+ options:
+ debounceDelay: 200
+ livereload: true
+ nospawn: true
+
# Any public-facing changes should reload the browser & re-run tests (which may depend on those resources)
build:
files: '<%= BUILD_DIR + ALL_FILES %>'
- tasks: [ 'livereload', 'karma:background:run' ]
- # Changes to app code should be validated and re-copied to the `build`, triggering `regarde:build`
+ # Changes to app code should be validated and re-copied to the `build`, triggering `watch:build`
js:
files: '<%= CLIENT_DIR + JS_FILES %>'
- tasks: [ 'copy:js', 'parallel:jshint' ]
+ tasks: [ 'copy:js', 'jshint' ]
- # Changes to app styles should re-compile, triggering `regarde:build`
+ # Changes to app styles should re-compile, triggering `watch:build`
less:
files: '<%= CLIENT_DIR + LESS_FILES %>'
- tasks: [ 'parallel:less' ]
+ tasks: [ 'less' ]
# Changes to server-side code should validate, restart the server, & refresh the browser
server:
files: '<%= SERVER_DIR + ALL_FILES %>'
- tasks: [ 'parallel:jshint', 'express', 'livereload' ]
+ tasks: [ 'jshint', 'express' ]
- # Changes to app templates should re-copy & re-compile them, triggering `regarde:build`
+ # Changes to app templates should re-copy & re-compile them, triggering `watch:build`
templates:
files: '<%= CLIENT_DIR + HTML_FILES %>'
tasks: [ 'copy:templates', 'ngtemplates' ]
- # Express requires `server.script` to reload from changes
- express:
- server:
- options:
- script: '<%= SERVER_DIR %>/server.js'
-
- # Output for optimized app index
- usemin:
- html: '<%= BUILD_DIR %>/index.html'
-
- # Input for optimized app index
- useminPrepare:
- html: '<%= BUILD_DIR %>/index.html'
+ # Changes to app code should be validated and re-copied to the `build`, triggering `watch:build`
+ unit:
+ files: '<%= CLIENT_DIR + JS_FILES %>'
+ tasks: [ 'copy:js', 'jshint', 'karma:background:run' ]
# Dependencies
@@ -194,11 +197,9 @@ module.exports = (grunt)->
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-contrib-less')
- grunt.loadNpmTasks('grunt-contrib-livereload')
grunt.loadNpmTasks('grunt-contrib-mincss')
grunt.loadNpmTasks('grunt-contrib-uglify')
+ grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-express-server')
grunt.loadNpmTasks('grunt-karma')
- grunt.loadNpmTasks('grunt-regarde')
- grunt.loadNpmTasks('grunt-parallel')
grunt.loadNpmTasks('grunt-usemin')
@@ -2,7 +2,7 @@
* Bootstrap
*/
-@import "../../../components/bootstrap/less/bootstrap.less";
+@import "../../../bower_components/bootstrap/less/bootstrap.less";
@iconSpritePath: "/img/glyphicons-halflings.png";
@iconWhiteSpritePath: "/img/glyphicons-halflings-white.png";
@@ -38,3 +38,4 @@
.marketing p + h4 {
margin-top: 28px;
}
+
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>End2end Test Runner</title>
- <script src="../../../../components/angular-scenario/angular-scenario.js" ng-autotest></script>
+ <script src="../../../../bower_components/angular-scenario/angular-scenario.js" ng-autotest></script>
<script src="scenarios.js"></script>
</head>
<body>
@@ -5,8 +5,8 @@ describe('App', function() {
});
it('should list NPM packages', function() {
- expect(repeater('.npm.packages tr', 'package row').count()).toEqual(17);
- expect(repeater('.npm.packages tr a', 'package link').count()).toEqual(17);
+ expect(repeater('.npm.packages tr', 'package row').count()).toEqual(14);
+ expect(repeater('.npm.packages tr a', 'package link').count()).toEqual(14);
});
it('should list Bower packages', function() {
View
@@ -50,8 +50,8 @@ <h3>
</div>
<!-- build:js app/scripts/all.min.js -->
- <script src="components/angular/angular.js"></script>
- <script src="components/modernizr/modernizr.js"></script>
+ <script src="bower_components/angular/angular.js"></script>
+ <script src="bower_components/modernizr/modernizr.js"></script>
<script src="app/scripts/app.js"></script>
<script src="app/scripts/controllers/home.js"></script>
View
@@ -3,8 +3,8 @@ basePath = '';
files = [
JASMINE,
JASMINE_ADAPTER,
- 'components/angular/angular.js',
- 'components/angular-mocks/angular-mocks.js',
+ 'bower_components/angular/angular.js',
+ 'bower_components/angular-mocks/angular-mocks.js',
'build/app/scripts/**/*.js',
'build/app/test/unit/**/*Spec.js'
];
View
@@ -38,7 +38,6 @@
"grunt-contrib-watch": "~0.4.4",
"grunt-express-server": "~0.3.1",
"grunt-karma": "~0.4.5",
- "grunt-parallel": "0.0.2",
"grunt-usemin": "~0.1.12"
}
}

0 comments on commit b9a76aa

Please sign in to comment.