-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.js
49 lines (48 loc) · 1.22 KB
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var fs = require('fs');
const PR_CONFIG = './pr-config.json';
function readConfig(filename) {
try {
return require(filename);
} catch (err) {
return {};
}
}
function saveConfig(filename, json) {
var raw = readConfig(filename);
var obj = Object.assign(json, raw);
fs.writeFileSync(filename, JSON.stringify(obj, null, 2));
}
function pr() {
saveConfig(PR_CONFIG, {
user: {
name: '[Your GitHub username]',
token: '[Your GitHub token, REQUIRED if enable two facotr, IF no token, delete this line]',
password: '[If no token provided, enter your password here]'
},
repo: {
owner: '[Your repo owner]',
name: '[Your repo name]'
},
branch: {
prefix: '[Auto created branch\'s prefix]',
startNumber: 0
},
base: {
owner: '[Your pr base repo\'s owner]',
branch: '[Your pr base repo\'s branch]'
},
pr: {
title: '[Your pr\'s title]'
},
count: 1,
modifyCount: 20,
modifyDir: '.',
modifyFilePattern: '.md',
period: 5000
});
return PR_CONFIG;
}
(function init(action) {
var filename = action();
console.log('Modify ' + filename + ' to enter your information.');
})(pr)