From 0cf37c8c52c52b55d33310441c97dba1fcd762d9 Mon Sep 17 00:00:00 2001 From: Rowan Manning Date: Tue, 5 Nov 2013 11:06:10 +0000 Subject: [PATCH] Move from Make to Grunt --- Gruntfile.js | 29 ++++++++++++++++++ Makefile | 27 ----------------- README.md | 13 +++++++-- package.json | 3 +- test/config/jshint.json | 65 ----------------------------------------- 5 files changed, 41 insertions(+), 96 deletions(-) create mode 100644 Gruntfile.js delete mode 100644 Makefile delete mode 100644 test/config/jshint.json diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..3ee80b2 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,29 @@ +module.exports = function (grunt) { + + grunt.initConfig({ + + jshint: { + all: ['**/*.js', '!node_modules/**/*.js', '!public/js/vendor/**/*.js'], + options: { + es3: false, + indent: 4, + latedef: false, + maxcomplexity: 4, + maxdepth: 2, + maxlen: 100, + maxparams: 4, + maxstatements: false, + node: true, + quotmark: 'single' + } + } + + }); + + grunt.loadNpmTasks('grunt-contrib-jshint'); + + grunt.registerTask('lint', ['jshint']); + grunt.registerTask('default', ['lint']); + grunt.registerTask('ci', ['lint']); + +}; \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 2772a6d..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ - -# Group targets -all: deps lint - -# Install dependencies -deps: - @echo "Installing dependencies..." - @npm install - @./node_modules/.bin/bower install - -# Lint JavaScript -lint: - @echo "Linting JavaScript..." - @./node_modules/.bin/jshint \ - --config ./test/config/jshint.json \ - --exclude ./node_modules \ - *.js **/*.js - -# Start the application -start: - @echo "Starting application..." - @NODE_ENV=production node . - -# Start the application in development mode -start-dev: - @echo "Starting application (development mode)..." - @NODE_ENV=development ./node_modules/.bin/supervisor -q . diff --git a/README.md b/README.md index b02cb5a..2d4b97f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,14 @@ Setup pa11y-dashboard requires [Node.js][node] 0.10+ and [pa11y-webservice][pa11y-webservice] to be installed and running. You'll need to follow the setup guide for pa11y-webservice before setting up pa11y-dashboard. -You'll then need to clone this repo locally and install dependencies with `make deps`, this installs npm and bower dependencies. Once you have a local clone, you'll need to copy some sample configuration files in order to run the application. From within the repo, run the following commands: +You'll then need to clone this repo locally and install dependencies with: + +```sh +$ npm install +$ ./node_modules/.bin/bower install +``` + +This installs npm and bower dependencies. Once you have a local clone, you'll need to copy some sample configuration files in order to run the application. From within the repo, run the following commands: ```sh $ cp config/development.sample.json config/development.json @@ -28,8 +35,8 @@ Each of these files defines configurations for a different environment. If you'r Now that you've got your application configured, you can run in each mode with the following commands: ```sh -$ make start # start in production mode -$ make start-dev # start in development mode +$ NODE_ENV=production node . +$ NODE_ENV=development ./node_modules/.bin/supervisor -q . ``` Development mode runs the application with [Supervisor][supervisor], so you won't need to restart it if you change any JavaScript files. diff --git a/package.json b/package.json index cfe67ed..e6fbf16 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "underscore": "~1.5" }, "devDependencies": { - "jshint": "~2.1", + "grunt": "~0.4", + "grunt-contrib-jshint": "~0.7", "supervisor": "~0.5" }, diff --git a/test/config/jshint.json b/test/config/jshint.json deleted file mode 100644 index f3c0e1b..0000000 --- a/test/config/jshint.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "bitwise": true, - "camelcase": false, - "curly": true, - "eqeqeq": true, - "es3": false, - "forin": true, - "immed": true, - "indent": 4, - "latedef": false, - "newcap": true, - "noarg": true, - "noempty": true, - "nonew": true, - "plusplus": true, - "quotmark": "single", - "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "maxparams": 4, - "maxdepth": 2, - "maxstatements": 0, - "maxcomplexity": 4, - "maxlen": 100, - - "asi": false, - "boss": false, - "debug": false, - "eqnull": false, - "es5": false, - "esnext": false, - "evil": false, - "expr": false, - "funcscope": false, - "globalstrict": false, - "iterator": false, - "lastsemic": false, - "laxbreak": false, - "laxcomma": false, - "loopfunc": false, - "moz": false, - "multistr": false, - "proto": false, - "scripturl": false, - "smarttabs": false, - "shadow": false, - "sub": false, - "supernew": false, - "validthis": false, - - "browser": false, - "couch": false, - "devel": false, - "dojo": false, - "jquery": false, - "mootools": false, - "node": true, - "nonstandard": false, - "prototypejs": false, - "rhino": false, - "worker": false, - "wsh": false, - "yui": false -} \ No newline at end of file