-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
46 lines (37 loc) · 965 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
39
40
41
42
43
44
45
46
const jsonfile = require("jsonfile");
const simpleGit = require("simple-git");
const randomInt = require("./random.js").randomInt;
const FILE_PATH = "./data.json";
const makeCommit = (n) => {
if (n === 0) return simpleGit().push();
const x = randomInt(0, 54);
const y = randomInt(0, 6);
const DATE = new Date();
DATE.setUTCFullYear(DATE.getUTCFullYear() - 1);
DATE.setDate(DATE.getDate() + 1);
DATE.setDate(DATE.getDate() + x * 7);
DATE.setDate(DATE.getDate() + y);
/*
* you can speed up with this ::
DATE.setDate(
DATE.getDate()+(((x*7)+y)+1)
);
*
*
*/
const data = {
date: DATE.valueOf(),
};
console.log(DATE);
jsonfile.writeFile(FILE_PATH, data, () => {
// git commit --date = ""
simpleGit()
.add([FILE_PATH])
.commit(
DATE.toISOString(),
{ "--date": DATE.toISOString() },
makeCommit.bind(this, --n)
);
});
};
makeCommit(500);