Enable ES6 support by using babelify transform in browserify build
* Add babelify as dev dependency * Add babelify transform to browserify build * Enable es6 support for jshint * Ignore minified js files in babel transform
This commit is contained in:
parent
d725abd5b6
commit
01b0cd8387
|
@ -11,6 +11,7 @@
|
||||||
"expr": true,
|
"expr": true,
|
||||||
"undef": true,
|
"undef": true,
|
||||||
"unused": true,
|
"unused": true,
|
||||||
|
"esnext": true,
|
||||||
|
|
||||||
"globals": {
|
"globals": {
|
||||||
"console": true,
|
"console": true,
|
||||||
|
|
30
Gruntfile.js
30
Gruntfile.js
|
@ -45,7 +45,13 @@ module.exports = function(grunt) {
|
||||||
browserifyOptions: {
|
browserifyOptions: {
|
||||||
standalone: 'openpgp'
|
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: {
|
openpgp_debug: {
|
||||||
|
@ -57,7 +63,13 @@ module.exports = function(grunt) {
|
||||||
debug: true,
|
debug: true,
|
||||||
standalone: 'openpgp'
|
standalone: 'openpgp'
|
||||||
},
|
},
|
||||||
external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ]
|
external: [ 'crypto', 'buffer', 'node-localstorage', 'node-fetch' ],
|
||||||
|
transform: [
|
||||||
|
["babelify", {
|
||||||
|
ignore: ['*.min.js'],
|
||||||
|
presets: ["es2015"]
|
||||||
|
}]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
worker: {
|
worker: {
|
||||||
|
@ -139,8 +151,8 @@ module.exports = function(grunt) {
|
||||||
build: ['Gruntfile.js'],
|
build: ['Gruntfile.js'],
|
||||||
options: {
|
options: {
|
||||||
config: ".jscsrc",
|
config: ".jscsrc",
|
||||||
esnext: false, // If you use ES6 http://jscs.info/overview.html#esnext
|
esnext: true,
|
||||||
verbose: true, // If you need output with rule names http://jscs.info/overview.html#verbose
|
verbose: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jsdoc: {
|
jsdoc: {
|
||||||
|
@ -260,16 +272,12 @@ module.exports = function(grunt) {
|
||||||
fs.writeFileSync(path, JSON.stringify(file, null, 2) + '\n');
|
fs.writeFileSync(path, JSON.stringify(file, null, 2) + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
grunt.registerTask('default', 'Build OpenPGP.js', function() {
|
// Build tasks
|
||||||
grunt.task.run(['clean', 'copy:zlib', 'browserify', 'replace', 'uglify']);
|
grunt.registerTask('default', ['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`.');
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask('documentation', ['jsdoc']);
|
grunt.registerTask('documentation', ['jsdoc']);
|
||||||
|
|
||||||
// Test/Dev tasks
|
// Test/Dev tasks
|
||||||
grunt.registerTask('test', ['jshint', 'jscs', 'copy:zlib', 'mochaTest']);
|
grunt.registerTask('test', ['jshint', 'jscs', 'copy:zlib', 'mochaTest']);
|
||||||
grunt.registerTask('coverage', ['copy:zlib', 'mocha_istanbul:coverage']);
|
grunt.registerTask('coverage', ['copy:zlib', 'mocha_istanbul:coverage']);
|
||||||
grunt.registerTask('saucelabs', ['default', 'copy:browsertest', 'connect', 'saucelabs-mocha']);
|
grunt.registerTask('saucelabs', ['default', 'copy:browsertest', 'connect', 'saucelabs-mocha']);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asmcrypto-lite": "^1.0.0",
|
"asmcrypto-lite": "^1.0.0",
|
||||||
|
"babel-preset-es2015": "^6.3.13",
|
||||||
|
"babelify": "^7.2.0",
|
||||||
"chai": "~3.4.1",
|
"chai": "~3.4.1",
|
||||||
"es6-promise": "^1.0.0",
|
"es6-promise": "^1.0.0",
|
||||||
"grunt": "~0.4.5",
|
"grunt": "~0.4.5",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user