Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 746abfe

Browse filesBrowse files
committed
添加自动上传部署代码
1 parent d5c0728 commit 746abfe
Copy full SHA for 746abfe

2 files changed

+31Lines changed: 31 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎build/deploy.js‎

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var exec = require('child_process').exec;
2+
var ghpages = require('gh-pages');
3+
var loading = require('loading-cli');
4+
var path = require('path');
5+
var color = require('colors-cli/safe');
6+
var error = color.red.bold;
7+
var warn = color.yellow;
8+
var notice = color.blue;
9+
var success = color.green;
10+
11+
var deploy_path = path.join(process.cwd(), '.deploy');
12+
13+
if(fs.existsSync(deploy_path)){
14+
var load = loading(' Pushing code!!')
15+
load.start();
16+
ghpages.publish(deploy_path,{
17+
repo: 'https://github.com/jaywcjlove/linux-command.git',
18+
branch: 'gh-pages'
19+
}, function(err) {
20+
if(err) return console.log(error(' → '+"ok!"+err));
21+
load.stop()
22+
console.log(success('\n\n '+"Push success!!"));
23+
// 删除文件夹
24+
exec('rm -rf .deploy');
25+
});
26+
}
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"start": "node build/compile.js",
9+
"deploy": "node build/deploy.js",
910
"build:css": "stylus -u autoprefixer-stylus template/styl/index.styl -o .deploy/ -c",
1011
"watch:css": "stylus -u autoprefixer-stylus -w template/styl/index.styl -o .deploy/ -c"
1112
},
@@ -29,5 +30,9 @@
2930
"ssr": "^1.1.1",
3031
"stylus": "^0.54.5",
3132
"watch": "^1.0.1"
33+
},
34+
"dependencies": {
35+
"gh-pages": "^0.12.0",
36+
"loading-cli": "^1.0.2"
3237
}
3338
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.