Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Remove LICENSE workaround
Browse files Browse the repository at this point in the history
Issue gruntjs/grunt-contrib-uglify#22 resolved in 0.2.7
  • Loading branch information
dfreedm committed Nov 13, 2013
1 parent a9faf7a commit d19a1b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
28 changes: 6 additions & 22 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
module.exports = function(grunt) {
var readManifest = require('../tools/loader/readManifest.js');
var temporary = require('temporary');
var tmp = new temporary.File();

grunt.initConfig({
karma: {
Expand All @@ -28,29 +26,29 @@ module.exports = function(grunt) {
nonull: true
},
files: {
'platform.concat.js': readManifest('build.json', [tmp.path])
'platform.concat.js': readManifest('build.json')
}
}
},
concat: {
lite: {
files: {
'platform-lite.concat.js': readManifest('build-lite.json', [tmp.path])
'platform-lite.concat.js': readManifest('build-lite.json')
}
}
},
uglify: {
options: {
nonull: true,
preserveComments: 'some',
compress: {
unsafe: false
}
},
Platform: {
options: {
sourceMap: 'platform.min.js.map',
sourceMapIn: 'platform.concat.js.map'
sourceMapIn: 'platform.concat.js.map',
banner: grunt.file.read('LICENSE')
},
files: {
'platform.min.js': 'platform.concat.js'
Expand Down Expand Up @@ -85,20 +83,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-concat-sourcemap');

// Workaround for banner + sourceMap + uglify: https://github.com/gruntjs/grunt-contrib-uglify/issues/22
grunt.registerTask('gen_license', function() {
var banner = [
'/* @license',
grunt.file.read('LICENSE'),
'*/'
].join(grunt.util.linefeed);
grunt.file.write(tmp.path, banner);
});

grunt.registerTask('clean_license', function() {
tmp.unlinkSync();
});

grunt.registerTask('stash', 'prepare for testing build', function() {
grunt.option('force', true);
grunt.task.run('move:platform.js:platform.js.bak');
Expand All @@ -112,10 +96,10 @@ module.exports = function(grunt) {

grunt.registerTask('test-build', ['default', 'stash', 'test', 'restore']);

grunt.registerTask('default', ['gen_license', 'concat_sourcemap', 'uglify', 'sourcemap_copy:platform.concat.js.map:platform.min.js.map', 'clean_license']);
grunt.registerTask('default', ['concat_sourcemap', 'uglify', 'sourcemap_copy:platform.concat.js.map:platform.min.js.map']);
grunt.registerTask('docs', ['yuidoc']);
grunt.registerTask('test', ['override-chrome-launcher', 'karma:platform']);
grunt.registerTask('test-buildbot', ['override-chrome-launcher', 'karma:buildbot', 'test-build']);
grunt.registerTask('build-lite', ['gen_license', 'concat', 'clean_license']);
grunt.registerTask('build-lite', ['concat']);
};

27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
"name": "Platform",
"version": "0.0.1",
"devDependencies": {
"mocha": "*",
"chai": "*",
"grunt": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-yuidoc": "~0.4.0",
"grunt-karma": "*",
"karma-mocha": "*",
"karma-ie-launcher": "*",
"karma-safari-launcher": "*",
"karma-script-launcher": "*",
"karma-crbot-reporter": "*",
"grunt-concat-sourcemap": "~0.3.0",
"temporary": "~0.0.7"
"mocha": "~1.14.0",
"chai": "~1.8.1",
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-yuidoc": "~0.5.0",
"grunt-karma": "~0.6.2",
"karma-mocha": "~0.1.0",
"karma-ie-launcher": "~0.1.1",
"karma-safari-launcher": "~0.1.1",
"karma-script-launcher": "~0.1.0",
"karma-crbot-reporter": "0.0.4",
"grunt-concat-sourcemap": "~0.3.2"
}
}

0 comments on commit d19a1b7

Please sign in to comment.