Update auto-commit.js
Browse files- auto-commit.js +6 -4
auto-commit.js
CHANGED
@@ -2,14 +2,16 @@ const fs = require('fs')
|
|
2 |
const path = require('path')
|
3 |
const exec = require('child_process').execSync
|
4 |
|
|
|
5 |
function loop() {
|
6 |
-
const dirs = fs.readdirSync(
|
7 |
for (let dir of dirs) {
|
|
|
8 |
if (fs.existsSync(path.join(dir, '.git/config'))) {
|
9 |
console.log('auto commit', dir)
|
10 |
-
exec(`git add -A
|
11 |
-
exec(`git commit -am "[WIP] auto commit"
|
12 |
-
exec(`git push
|
13 |
console.log('done')
|
14 |
}
|
15 |
}
|
|
|
2 |
const path = require('path')
|
3 |
const exec = require('child_process').execSync
|
4 |
|
5 |
+
const root = __dirname
|
6 |
function loop() {
|
7 |
+
const dirs = fs.readdirSync(root)
|
8 |
for (let dir of dirs) {
|
9 |
+
const cwd = path.join(root, dir)
|
10 |
if (fs.existsSync(path.join(dir, '.git/config'))) {
|
11 |
console.log('auto commit', dir)
|
12 |
+
exec(`git add -A`, { cwd })
|
13 |
+
exec(`git commit -am "[WIP] auto commit"`, { cwd })
|
14 |
+
exec(`git push`, { cwd })
|
15 |
console.log('done')
|
16 |
}
|
17 |
}
|