diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 05be22bc7..b669845c8 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -38,6 +38,12 @@ module.exports = (grunt)-> prod: files: './dist/js/main.js': ['./src/coffee/main.coffee'] + coffee: + dev: + options: + sourceMap: true + files: [expand:true, cwd:'./src/coffee', src:'**/*.coffee', dest:'./dist'] + clean: dist: ['./dist'] @@ -134,16 +140,14 @@ module.exports = (grunt)-> grunt.registerTask 'default', 'build' - grunt.registerTask 'build', [ - 'rsync', 'sass:build', 'jade', 'copy', 'browserify:dev', 'exorcise' - ] - - grunt.registerTask 'dist', [ - 'clean', 'rsync', 'sass:dist', 'jade', 'copy', 'browserify:prod', 'uglify', 'test' - ] + grunt.registerTask 'build', ['rsync', 'sass:build', 'jade', 'copy', 'browserify:dev', 'exorcise'] grunt.registerTask 'clean-watch', ['clean', 'build', 'watch'] + grunt.registerTask 'dist', ['rsync', 'sass:dist', 'jade', 'copy', 'browserify:prod', 'uglify'] + + grunt.registerTask 'prepublish', ['clean', 'coffee'] + grunt.registerTask 'use-local-deps', -> grunt.file.mkdir './node_modules' grunt.file.delete './node_modules/crafting-guide-common', force:true diff --git a/package.json b/package.json index 7d10d95af..de87f1cd4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Source code for http://crafting-guide.com", "main": "./build/index.js", "scripts": { - "prepublish": "grunt build", + "prepublish": "grunt prepublish", "test": "grunt test" }, "repository": { @@ -24,6 +24,7 @@ "grunt": "^0.4.5", "grunt-browserify": "^3.2.1", "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-copy": "^0.7.0", "grunt-contrib-jade": "^0.13.0", "grunt-contrib-sass": "^0.8.1", diff --git a/scripts/deploy b/scripts/deploy index 8489c8f88..6b2aa4a16 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -35,6 +35,11 @@ if [[ ! -e "$S3CMD_CFG" ]]; then cat $AWS_CONFIG_FILE | grep "aws_secret_access_key" | sed "s/aws_secret_access_key/secret_key/" >> "$S3CMD_CFG" fi -echo "Preparing to upload to S3..." -s3cmd sync -r --add-header="cache-control:max-age=1800" $SOURCE_DIR $TARGET_DIR -echo "S3 Upload Complete" +if grunt clean dist; then + echo "Preparing to upload to S3..." + s3cmd sync -r --add-header="cache-control:max-age=1800" $SOURCE_DIR $TARGET_DIR + echo "S3 Upload Complete" +else + echo "ERROR: Building distribution failed. Aborting deployment!" + exit 1 +fi