-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (33 loc) · 934 Bytes
/
index.js
File metadata and controls
40 lines (33 loc) · 934 Bytes
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
import jsonfile from "jsonfile";
import moment from "moment";
import simpleGit from "simple-git";
import random from "random";
const path = "./data.json";
const markCommit = (x, y) => {
const date = moment()
.subtract(1, "y")
.add(1, "d")
.add(x, "w")
.add(y, "d")
.format();
const data = {
date: date,
};
jsonfile.writeFile(path, data, () => {
simpleGit().add([path]).commit(date, { "--date": date }).push();
});
};
const makeCommits = (n) => {
if(n===0) return simpleGit().push();
const x = random.int(0, 54);
const y = random.int(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(path, data, () => {
simpleGit().add([path]).commit(date, { "--date": date },makeCommits.bind(this,--n));
});
};
makeCommits(100);