diff --git a/.jshintrc b/.jshintrc index 12cfa4d4..de33a701 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,6 +11,7 @@ "expr": true, "undef": true, "unused": true, + "esnext": true, "globals": { "console": true, diff --git a/Gruntfile.js b/Gruntfile.js index 775c0ece..47aae103 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,7 +45,13 @@ module.exports = function(grunt) { browserifyOptions: { standalone: 'openpgp' }, - external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ] + external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ], + transform: [ + ["babelify", { + ignore: ['*.min.js'], + presets: ["es2015"] + }] + ] } }, openpgp_debug: { @@ -57,7 +63,13 @@ module.exports = function(grunt) { debug: true, standalone: 'openpgp' }, - external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ] + external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ], + transform: [ + ["babelify", { + ignore: ['*.min.js'], + presets: ["es2015"] + }] + ] } }, worker: { @@ -139,8 +151,8 @@ module.exports = function(grunt) { build: ['Gruntfile.js'], options: { config: ".jscsrc", - esnext: false, // If you use ES6 http://jscs.info/overview.html#esnext - verbose: true, // If you need output with rule names http://jscs.info/overview.html#verbose + esnext: true, + verbose: true, } }, jsdoc: { @@ -260,16 +272,12 @@ module.exports = function(grunt) { fs.writeFileSync(path, JSON.stringify(file, null, 2) + '\n'); } - grunt.registerTask('default', 'Build OpenPGP.js', function() { - grunt.task.run(['clean', 'copy:zlib', 'browserify', 'replace', 'uglify']); - //TODO jshint is not run because of too many discovered issues, once these are addressed it should autorun - grunt.log.ok('Before Submitting a Pull Request please also run `grunt jshint`.'); - }); - + // Build tasks + grunt.registerTask('default', ['clean', 'copy:zlib', 'browserify', 'replace', 'uglify']); grunt.registerTask('documentation', ['jsdoc']); - // Test/Dev tasks grunt.registerTask('test', ['jshint', 'jscs', 'copy:zlib', 'mochaTest']); grunt.registerTask('coverage', ['copy:zlib', 'mocha_istanbul:coverage']); grunt.registerTask('saucelabs', ['default', 'copy:browsertest', 'connect', 'saucelabs-mocha']); + }; diff --git a/package.json b/package.json index 5f6b57fb..5cd8c214 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,8 @@ }, "devDependencies": { "asmcrypto-lite": "^1.0.0", + "babel-preset-es2015": "^6.3.13", + "babelify": "^7.2.0", "chai": "~3.4.1", "es6-promise": "^1.0.0", "grunt": "~0.4.5",