-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (27 loc) · 934 Bytes
/
index.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
import('random').then(random => {
const jsonfile = require('jsonfile');
const moment = require('moment');
const simpleGit = require('simple-git');
const FILE_PATH = './data.json';
const getRandomInt = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
const makeCommit = n => {
if (n===0) return simpleGit().push();
const x = getRandomInt(0,54);
const y = getRandomInt(0,6)
const DATE = moment().subtract(1,'y').add(1,'d').add(x,'w').add(y,'d').format();
const data = {
date : DATE
}
console.log(DATE);
jsonfile.writeFile(FILE_PATH,data , () => {
//git commit --date=""
simpleGit().add([FILE_PATH]).commit(DATE,{'--date':DATE},
makeCommit.bind(this,--n));
});
}
makeCommit(40)
}).catch(error => {
console.error('Dynamic import error:', error);
});