提交 f269a702 编写于 作者: M Matt Zabriskie

Automating release process

上级 a913ea56
...@@ -21,10 +21,8 @@ module.exports = function(grunt) { ...@@ -21,10 +21,8 @@ module.exports = function(grunt) {
} }
}, },
update_json: { package2bower: {
bower: { all: {
src: 'package.json',
dest: 'bower.json',
fields: [ fields: [
'name', 'name',
'description', 'description',
...@@ -68,8 +66,6 @@ module.exports = function(grunt) { ...@@ -68,8 +66,6 @@ module.exports = function(grunt) {
all: ['test/unit/**/*.js'] all: ['test/unit/**/*.js']
}, },
webpack: require('./webpack.config.js'),
watch: { watch: {
build: { build: {
files: ['lib/**/*.js'], files: ['lib/**/*.js'],
...@@ -79,10 +75,25 @@ module.exports = function(grunt) { ...@@ -79,10 +75,25 @@ module.exports = function(grunt) {
files: ['lib/**/*.js', 'test/**/*.js', '!test/typescript/axios.js', '!test/typescript/out.js'], files: ['lib/**/*.js', 'test/**/*.js', '!test/typescript/axios.js', '!test/typescript/out.js'],
tasks: ['test'] tasks: ['test']
} }
},
webpack: require('./webpack.config.js')
});
grunt.registerMultiTask('package2bower', 'Sync package.json to bower.json', function () {
var npm = grunt.file.readJSON('package.json');
var bower = grunt.file.readJSON('bower.json');
var fields = this.data.fields || [];
for (var i=0, l=fields.length; i<l; i++) {
var field = fields[i];
bower[field] = npm[field];
} }
grunt.file.write('bower.json', JSON.stringify(bower, null, 2));
}); });
grunt.registerTask('test', 'Run the jasmine and nodeunit tests', ['eslint', 'nodeunit', 'karma:single', 'ts']); grunt.registerTask('test', 'Run the jasmine and nodeunit tests', ['eslint', 'nodeunit', 'karma:single', 'ts']);
grunt.registerTask('build', 'Run webpack and bundle the source', ['webpack']); grunt.registerTask('build', 'Run webpack and bundle the source', ['clean', 'webpack']);
grunt.registerTask('publish', 'Prepare the code for release', ['clean', 'test', 'build', 'usebanner', 'update_json']); grunt.registerTask('version', 'Sync version info for a release', ['usebanner', 'package2bower']);
}; };
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
"description": "Promise based HTTP client for the browser and node.js", "description": "Promise based HTTP client for the browser and node.js",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "NODE_ENV=production ./node_modules/.bin/grunt build", "test": "grunt test",
"test": "./node_modules/.bin/grunt test",
"start": "node ./sandbox/server.js", "start": "node ./sandbox/server.js",
"build": "NODE_ENV=production grunt build",
"preversion": "npm test",
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
"postversion": "git push && git push --tags",
"examples": "node ./examples/server.js", "examples": "node ./examples/server.js",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
}, },
...@@ -39,7 +42,6 @@ ...@@ -39,7 +42,6 @@
"grunt-eslint": "18.0.0", "grunt-eslint": "18.0.0",
"grunt-karma": "0.12.1", "grunt-karma": "0.12.1",
"grunt-ts": "5.3.2", "grunt-ts": "5.3.2",
"grunt-update-json": "0.2.2",
"grunt-webpack": "1.0.11", "grunt-webpack": "1.0.11",
"istanbul-instrumenter-loader": "^0.2.0", "istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "2.4.1", "jasmine-core": "2.4.1",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册