-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.js
More file actions
24 lines (15 loc) · 577 Bytes
/
run.js
File metadata and controls
24 lines (15 loc) · 577 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require('dotenv').config();
const git = require('./src/GitCommander');
const filePath = process.env.filePath
const dates = process.env.dates.split(',');
function readyModifyFile(filePath) {
const currentContent = require('fs').readFileSync(filePath, 'utf-8');
let newContent = currentContent === 'fizz' ? 'buzz' : 'fizz'
require('fs').writeFileSync(filePath, newContent);
}
for (const date of dates) {
readyModifyFile(filePath);
const tree = git.addDot(filePath)
const commit = git.commit(tree, date);
console.log(`${date} commit hash: ${commit} \n`);
}