Use module packager for all transpile tasks

This commit is contained in:
kpdecker
2013-12-01 14:59:38 -06:00
parent cc16bc47dd
commit 57b4ef08b6
3 changed files with 18 additions and 41 deletions
+17 -26
View File
@@ -42,9 +42,20 @@ module.exports = function(grunt) {
}
},
transpile: {
packager: {
global: {
type: 'global',
export: 'Handlebars',
files: [{
cwd: 'lib/',
expand: true,
src: ['handlebars*.js'],
dest: 'dist/'
}]
},
amd: {
type: "amd",
type: 'amd',
anonymous: true,
files: [{
expand: true,
@@ -64,21 +75,6 @@ module.exports = function(grunt) {
}]
}
},
packager: {
options: {
export: 'Handlebars'
},
global: {
files: [{
cwd: 'lib/',
expand: true,
src: ['handlebars*.js'],
dest: 'dist/'
}]
}
},
requirejs: {
options: {
optimize: "none",
@@ -126,9 +122,9 @@ module.exports = function(grunt) {
'node',
'globals']);
this.registerTask('amd', ['transpile:amd', 'requirejs']);
this.registerTask('node', ['transpile:cjs']);
this.registerTask('globals', ['packager-fork']);
this.registerTask('amd', ['packager:amd', 'requirejs']);
this.registerTask('node', ['packager:cjs']);
this.registerTask('globals', ['packager:global']);
this.registerTask('release', 'Build final packages', ['amd', 'uglify', 'copy:dist', 'copy:components', 'copy:cdnjs']);
@@ -138,15 +134,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-es6-module-transpiler');
grunt.loadNpmTasks('es6-module-packager');
grunt.task.loadTasks('tasks');
grunt.registerTask('packager-fork', function() {
// Allows us to run the packager task out of process to work around the multiple
// traceur exec issues
grunt.util.spawn({grunt: true, args: ['--stack', 'packager'], opts: {stdio: 'inherit'}}, this.async());
});
grunt.registerTask('bench', ['metrics']);
grunt.registerTask('default', ['build', 'test', 'release']);
+1 -2
View File
@@ -38,8 +38,7 @@
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-es6-module-transpiler": "joefiorini/grunt-es6-module-transpiler",
"es6-module-packager": "*",
"es6-module-packager": "~0.1.1",
"jison": "~0.3.0",
"keen.io": "0.0.3",
"mocha": "*",
-13
View File
@@ -1,13 +0,0 @@
module.exports = function(grunt) {
grunt.registerMultiTask('packager', 'Transpiles scripts written using ES6 to ES5.', function() {
// Execute in here to prevent traceur private var blowup
var Packager = require('es6-module-packager').default,
fs = require('fs');
var options = this.options();
this.files.forEach(function(file) {
var packager = new Packager(file.src[0], {export: options.export});
fs.writeFileSync(file.dest, packager.toLocals());
});
});
};