Skip to content

Commit

Permalink
Merge pull request canjs#1468 from bitovi/dist-banners
Browse files Browse the repository at this point in the history
Add banner to all generated files.
  • Loading branch information
daffl committed Feb 24, 2015
2 parents 19abf2c + 425e317 commit ad26cde
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
29 changes: 20 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var getTestTasks = function() {
var suite = process.env.TEST_SUITE;
var testTasks = ['testee'];
if(suite === 'loaders') {
testTasks = ['testee:steal', 'testee:amd'];
testTasks = ['simplemocha', 'testee:steal', 'testee:amd'];
} else if(suite === 'dists') {
testTasks = [ 'testee:dist', 'testee:dev', 'testee:compatibility' ];
} else if(suite === 'individuals') {
Expand All @@ -18,11 +18,6 @@ module.exports = function (grunt) {
var _ = grunt.util._;
var builderJSON = grunt.file.readJSON('builder.json');
var pkg = grunt.file.readJSON('package.json');
var banner = _.template(builderJSON.banner, {
pkg: pkg,
ids: [ 'CanJS default build' ],
url: pkg.homepage
});
var testifyDist = {
template: 'test/templates/__configuration__-dist.html.ejs',
builder: builderJSON,
Expand Down Expand Up @@ -228,6 +223,21 @@ module.exports = function (grunt) {
"export-helpers": require("./build/config_meta_defaults")()
}
},
usebanner: {
taskName: {
options: {
position: 'top',
banner: _.template(builderJSON.banner, {
pkg: pkg,
ids: [ 'CanJS default build' ]
}),
linebreak: true
},
files: {
src: [ 'dist/**/*.js' ]
}
}
},
testee: {
options: {
timeout: 10000,
Expand Down Expand Up @@ -268,13 +278,15 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-docco2');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('steal-tools');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('testee');

grunt.registerTask('default', ['build']);

grunt.registerTask('build', ['clean', 'steal-export', 'string-replace:version', 'browserify-package']);
grunt.registerTask('build', ['clean', 'steal-export',
'string-replace:version', 'browserify-package', 'usebanner']);
grunt.registerTask('build:amd',[
'clean:build',
'steal-export:amd',
Expand All @@ -287,8 +299,7 @@ module.exports = function (grunt) {
]);


grunt.registerTask('test', ['jshint', 'build', 'testify', 'simplemocha']
.concat(getTestTasks()));
grunt.registerTask('test', ['jshint', 'build', 'testify'].concat(getTestTasks()));
grunt.registerTask('test:compatibility', ['build', 'testify', 'testee:compatibility']);
grunt.registerTask('test:steal', ['testee:steal']);
grunt.registerTask('test:amd', ['build:amd', 'testify', 'testee:amd']);
Expand Down
2 changes: 1 addition & 1 deletion builder.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filename": "can.custom.js",
"banner": "/*!\n * <%= pkg.title || pkg.name %> - <%= pkg.version %>\n * <%= pkg.homepage %>\n * Copyright (c) <%= new Date().getFullYear() %> <%= pkg.author.name %>\n * <%= new Date().toUTCString() %>\n * Licensed <%= pkg.licenses[0].type %><% if(typeof url !== \"undefined\") { %>\n * Includes: <%= ids %>\n * Download from: <%= url %>\n<% } %> */\n",
"banner": "/*!\n * <%= pkg.title || pkg.name %> - <%= pkg.version %>\n * <%= pkg.homepage %>\n * Copyright (c) <%= new Date().getFullYear() %> <%= pkg.author.name %>\n * <%= new Date().toUTCString() %>\n * Licensed <%= pkg.licenses[0].type %>\n<% if(typeof url !== \"undefined\") { %>\n * Includes: <%= ids %>\n * Download from: <%= url %>\n<% } %> */\n",
"modules": {
"can/component/component": {
"name": "can.Component",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "can",
"title": "CanJS",
"description": "MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.",
"version": "2.2.0-alpha.10",
"author": {
Expand All @@ -22,6 +23,7 @@
"browserify": "~8.1.0",
"connect": "^2.14.4",
"grunt": "~0.4.0",
"grunt-banner": "^0.3.1",
"grunt-cli": "~0.1.7",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-connect": "~0.3.0",
Expand Down

0 comments on commit ad26cde

Please sign in to comment.