添加自动上传部署代码
This commit is contained in:
parent
d5c07285e7
commit
746abfe54f
|
|
@ -0,0 +1,26 @@
|
|||
var exec = require('child_process').exec;
|
||||
var ghpages = require('gh-pages');
|
||||
var loading = require('loading-cli');
|
||||
var path = require('path');
|
||||
var color = require('colors-cli/safe');
|
||||
var error = color.red.bold;
|
||||
var warn = color.yellow;
|
||||
var notice = color.blue;
|
||||
var success = color.green;
|
||||
|
||||
var deploy_path = path.join(process.cwd(), '.deploy');
|
||||
|
||||
if(fs.existsSync(deploy_path)){
|
||||
var load = loading(' Pushing code!!')
|
||||
load.start();
|
||||
ghpages.publish(deploy_path,{
|
||||
repo: 'https://github.com/jaywcjlove/linux-command.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');
|
||||
});
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node build/compile.js",
|
||||
"deploy": "node build/deploy.js",
|
||||
"build:css": "stylus -u autoprefixer-stylus template/styl/index.styl -o .deploy/ -c",
|
||||
"watch:css": "stylus -u autoprefixer-stylus -w template/styl/index.styl -o .deploy/ -c"
|
||||
},
|
||||
|
|
@ -29,5 +30,9 @@
|
|||
"ssr": "^1.1.1",
|
||||
"stylus": "^0.54.5",
|
||||
"watch": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"gh-pages": "^0.12.0",
|
||||
"loading-cli": "^1.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue