Skip to content

Commit

Permalink
Add bower.json and Grunt task to prepare Bower release
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed May 14, 2014
1 parent 224f8e9 commit ff669d4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ perf/*

.DS_Store
npm-debug.log
node_modules
node_modules
dist
27 changes: 27 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ module.exports = function(grunt) {
debug: './build/output/knockout-latest.debug.js',
min: './build/output/knockout-latest.js'
},
dist: {
debug: './dist/knockout.debug.js',
min: './dist/knockout.js'
},
test: {
phantomjs: 'spec/runner.phantom.js',
node: 'spec/runner.node.js'
Expand Down Expand Up @@ -147,6 +151,29 @@ module.exports = function(grunt) {
);
});

grunt.registerTask('dist', ['clean'], function() {
// Update the version in bower.json
var bowerConfig = grunt.file.readJSON('bower.json'),
version = grunt.config('pkg.version');
bowerConfig.version = version;
grunt.file.write('bower.json', JSON.stringify(bowerConfig, true, 2));

var buildConfig = grunt.config('build'),
distConfig = grunt.config('dist');
grunt.file.copy(buildConfig.debug, distConfig.debug);
grunt.file.copy(buildConfig.min, distConfig.min);

console.log('To publish, run:');
console.log(' git add bower.json');
console.log(' git add -f ' + distConfig.debug);
console.log(' git add -f ' + distConfig.min);
console.log(' git checkout head');
console.log(' git commit -m \'Version ' + version + ' for distribution\'');
console.log(' git tag -a v' + version + ' -m \'Add tag v' + version + '\'');
console.log(' git checkout master');
console.log(' git push origin --tags');
});

// Default task.
grunt.registerTask('default', ['clean', 'checktrailingspaces', 'build', 'test']);
};
26 changes: 26 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "knockout",
"version": "3.2.0-alpha",
"homepage": "http://knockoutjs.com/",
"description": "Knockout makes it easier to create rich, responsive UIs with JavaScript",
"main": "dist/knockout.js",
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"knockout",
"mvvm",
"mvc",
"spa"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"spec",
"build/output"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "knockout",
"description": "Knockout makes it easier to create rich, responsive UIs with JavaScript",
"homepage": "http://knockoutjs.com/",
"version": "3.1.0",
"version": "3.2.0-alpha",
"license": "MIT",
"author": "The Knockout.js team",
"main": "build/output/knockout-latest.debug.js",
Expand Down

0 comments on commit ff669d4

Please sign in to comment.