-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
35 lines (28 loc) · 850 Bytes
/
scripts.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
const _package = require('./package.json');
const argv = require('yargs').argv;
const child_process = require('child_process');
const _auxMakeGit = (param = '-auto') => {
const version = _package.version;
const msg = version + ' ' + param;
let command = '(git add . -A || true) && (git status) && (git commit -m "{(msg}}" || true)';
command = command.replace('{(msg}}', msg);
let result;
try {
result = child_process.execSync(command, ['init'], { stdio: 'inherit' }).toString();
console.log('\n', msg, '\n', result, '\n');
return true;
} catch (e) {
return false;
console.log('\n', e, '\n');
}
};
let command = argv._[0];
let param1 = argv._[1];
let param2 = argv._[2];
if (!true) {
console.log(command);
console.log(param1);
}
if (command === 'autoGit') {
_auxMakeGit(param1);
}