-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (46 loc) · 1.78 KB
/
index.js
File metadata and controls
56 lines (46 loc) · 1.78 KB
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
47
48
49
50
51
52
53
54
55
56
import jsonfile from 'jsonfile';
import moment from 'moment';
import simpleGit from 'simple-git';
const path = './data.json';
const git = simpleGit();
// ---------------------------------------------------------
// PASTE YOUR COORDINATES BELOW
// (Use generator.py to create this array)
// ---------------------------------------------------------
const pixels = [
// Example: Letter "H"
{x:0, y:1}, {x:0, y:2}, {x:0, y:3}, {x:0, y:4}, {x:0, y:5},
{x:1, y:3}, {x:2, y:3},
{x:3, y:1}, {x:3, y:2}, {x:3, y:3}, {x:3, y:4}, {x:3, y:5},
// Example: Letter "I" (Shifted)
{x:5, y:1}, {x:5, y:2}, {x:5, y:3}, {x:5, y:4}, {x:5, y:5},
];
const makeArt = async () => {
// CONFIG: Start Date (Default: July 1st of LAST year)
const startYear = moment().year() - 1;
const startDate = moment(`${startYear}-07-01`).startOf('week');
console.log(`🎨 Painting starting from: ${startDate.format('YYYY-MM-DD')}`);
for (const pixel of pixels) {
// Calculate date: Start + x weeks + y days
const commitDate = startDate.clone()
.add(pixel.x, 'weeks')
.add(pixel.y, 'days')
.format();
// Make 5 commits per pixel for Dark Green color
for (let i = 0; i < 5; i++) {
const data = {
date: commitDate,
pixel_id: `PIXEL-${pixel.x}-${pixel.y}`,
counter: i
};
jsonfile.writeFileSync(path, data);
await git.add([path]);
await git.commit(`Pixel (${pixel.x},${pixel.y})`, {'--date': commitDate});
}
process.stdout.write("█"); // Visual progress bar
}
console.log("\n\n📤 Pushing to GitHub...");
await git.push();
console.log("✅ Done! Refresh your profile in 5 minutes.");
};
makeArt();