-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (20 loc) · 699 Bytes
/
index.js
File metadata and controls
22 lines (20 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const jsonfile = require('jsonfile');
const moment = require('moment');
const simpleGit = require('simple-git');
const random = require('random');
const COMMIT_COUNTS = 1000;
const FILE_PATH = './data.json';
const makeCommit = (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 JSON_DATA = {
date: DATE
}
console.log(DATE);
jsonfile.writeFile(FILE_PATH, JSON_DATA, () => {
simpleGit().add([FILE_PATH]).commit(DATE, { '--date': DATE }, makeCommit.bind(this, --n));
});
}
makeCommit(COMMIT_COUNTS);