Skip to content

Commit

Permalink
Add gh-pages branch push method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 20, 2016
1 parent 1e4bc37 commit f2187c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 16 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ var exec = require('child_process').exec;
var fs = require('fs');
var path = require('path');
var marked = require('marked');
var ghpages = require('gh-pages');
var loading = require('loading-cli');
var mkdirp = require('mkdirp');
var renderer = new marked.Renderer();
var color = require('colors-cli/safe')
var error = color.red.bold;
var warn = color.yellow;
var notice = color.blue;
var success = color.green;

// console.log(error('Error!'));
// console.log(warn('Warning'));
Expand Down Expand Up @@ -52,6 +55,19 @@ MarkedToHTMLSave('.deploy/index.html','README.md'.toString(),function(err){
MarkedToHTMLSave('.deploy/index.en.html','README-en.md'.toString(),function(err){
if (err) return console.log(error(err));
console.log(notice(' → '+"ok!"));
var load = loading(' Pushing code!!')
load.start()
ghpages.publish(path.join(__dirname, '.deploy'),{
repo: 'https://github.com/jaywcjlove/awesome-mac.git',
branch: 'gh-pages'
}, function(err) {
if(err) return console.log(error(' → '+"ok!"+err));
load.stop()
console.log(success('\n\n '+"Push success!!"));
// 删除文件夹
exec('rm -rf .deploy');
});

})

})
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"node build.js"
"start": "node build.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jaywcjlove/awesome-mac-osx.git"
"url": "https://github.com/jaywcjlove/awesome-mac.git"
},
"keywords": [
"awesome",
Expand All @@ -21,11 +21,13 @@
"author": "kenny wang <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/jaywcjlove/awesome-mac-osx/issues"
"url": "https://github.com/jaywcjlove/awesome-mac/issues"
},
"homepage": "https://github.com/jaywcjlove/awesome-mac-osx#readme",
"homepage": "https://github.com/jaywcjlove/awesome-mac#readme",
"devDependencies": {
"colors-cli": "^1.0.7",
"gh-pages": "^0.11.0",
"loading-cli": "^1.0.2",
"marked": "^0.3.6",
"mkdirp": "^0.5.1",
"pygmentize-bundled": "^2.3.0"
Expand Down

0 comments on commit f2187c0

Please sign in to comment.