repo-wrapped 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/generate.js +104 -95
- package/dist/constants/chronotypes.js +23 -23
- package/dist/constants/colors.js +18 -18
- package/dist/constants/index.js +18 -18
- package/dist/formatters/index.js +17 -17
- package/dist/formatters/timeFormatter.js +28 -29
- package/dist/generators/html/templates/achievementsSection.js +42 -43
- package/dist/generators/html/templates/commitQualitySection.js +25 -26
- package/dist/generators/html/templates/contributionGraph.js +47 -48
- package/dist/generators/html/templates/impactSection.js +19 -20
- package/dist/generators/html/templates/knowledgeSection.js +86 -87
- package/dist/generators/html/templates/streakSection.js +8 -9
- package/dist/generators/html/templates/timePatternsSection.js +45 -46
- package/dist/generators/html/utils/colorUtils.js +21 -21
- package/dist/generators/html/utils/commitMapBuilder.js +23 -24
- package/dist/generators/html/utils/dateRangeCalculator.js +56 -57
- package/dist/generators/html/utils/developerStatsCalculator.js +28 -29
- package/dist/generators/html/utils/scriptLoader.js +15 -16
- package/dist/generators/html/utils/styleLoader.js +17 -18
- package/dist/generators/html/utils/weekGrouper.js +27 -28
- package/dist/index.js +78 -78
- package/dist/types/index.js +2 -2
- package/dist/utils/achievementDefinitions.js +433 -433
- package/dist/utils/achievementEngine.js +169 -170
- package/dist/utils/commitQualityAnalyzer.js +367 -368
- package/dist/utils/fileHotspotAnalyzer.js +269 -270
- package/dist/utils/gitParser.js +136 -126
- package/dist/utils/htmlGenerator.js +232 -233
- package/dist/utils/impactAnalyzer.js +247 -248
- package/dist/utils/knowledgeDistributionAnalyzer.js +373 -374
- package/dist/utils/matrixGenerator.js +349 -350
- package/dist/utils/slideGenerator.js +170 -171
- package/dist/utils/streakCalculator.js +134 -135
- package/dist/utils/timePatternAnalyzer.js +304 -305
- package/dist/utils/wrappedDisplay.js +124 -115
- package/dist/utils/wrappedGenerator.js +376 -377
- package/dist/utils/wrappedHtmlGenerator.js +105 -106
- package/package.json +10 -10
|
@@ -1,135 +1,134 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let
|
|
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
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function getStreakMotivation(days, isActive) {
|
|
117
|
-
if (days === 0) {
|
|
118
|
-
return "Start building momentum today";
|
|
119
|
-
}
|
|
120
|
-
if (!isActive) {
|
|
121
|
-
return `Your ${days}-day streak ended. Time for a fresh start.`;
|
|
122
|
-
}
|
|
123
|
-
if (days >= 61)
|
|
124
|
-
return "Outstanding consistency";
|
|
125
|
-
if (days >= 31)
|
|
126
|
-
return "Exceptional dedication";
|
|
127
|
-
if (days >= 15)
|
|
128
|
-
return "Strong momentum 🔥";
|
|
129
|
-
if (days >= 8)
|
|
130
|
-
return "Solid consistency";
|
|
131
|
-
if (days >= 4)
|
|
132
|
-
return "Building momentum";
|
|
133
|
-
return "Just getting started";
|
|
134
|
-
}
|
|
135
|
-
exports.getStreakMotivation = getStreakMotivation;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateStreaks = calculateStreaks;
|
|
4
|
+
exports.getStreakMotivation = getStreakMotivation;
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
function calculateStreaks(commits, startDate, endDate) {
|
|
7
|
+
// Create set of unique commit dates
|
|
8
|
+
const commitDates = new Set();
|
|
9
|
+
commits.forEach(commit => {
|
|
10
|
+
const commitDate = new Date(commit.date);
|
|
11
|
+
if (commitDate >= startDate && commitDate <= endDate) {
|
|
12
|
+
commitDates.add((0, date_fns_1.format)(commitDate, 'yyyy-MM-dd'));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
// Calculate total days and active days
|
|
16
|
+
const totalDays = (0, date_fns_1.differenceInDays)(endDate, startDate) + 1;
|
|
17
|
+
const totalActiveDays = commitDates.size;
|
|
18
|
+
const activeDayPercentage = totalDays > 0 ? (totalActiveDays / totalDays) * 100 : 0;
|
|
19
|
+
// Find all streaks
|
|
20
|
+
const streaks = [];
|
|
21
|
+
let currentStreakDays = 0;
|
|
22
|
+
let currentStreakStart = null;
|
|
23
|
+
const allDays = (0, date_fns_1.eachDayOfInterval)({ start: startDate, end: endDate });
|
|
24
|
+
for (const date of allDays) {
|
|
25
|
+
const dateKey = (0, date_fns_1.format)(date, 'yyyy-MM-dd');
|
|
26
|
+
if (commitDates.has(dateKey)) {
|
|
27
|
+
if (currentStreakDays === 0) {
|
|
28
|
+
currentStreakStart = date;
|
|
29
|
+
}
|
|
30
|
+
currentStreakDays++;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (currentStreakDays > 0 && currentStreakStart) {
|
|
34
|
+
streaks.push({
|
|
35
|
+
days: currentStreakDays,
|
|
36
|
+
startDate: currentStreakStart,
|
|
37
|
+
endDate: (0, date_fns_1.subDays)(date, 1)
|
|
38
|
+
});
|
|
39
|
+
currentStreakDays = 0;
|
|
40
|
+
currentStreakStart = null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Handle streak that extends to end date
|
|
45
|
+
if (currentStreakDays > 0 && currentStreakStart) {
|
|
46
|
+
streaks.push({
|
|
47
|
+
days: currentStreakDays,
|
|
48
|
+
startDate: currentStreakStart,
|
|
49
|
+
endDate: endDate
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Find longest streak
|
|
53
|
+
const longestStreak = streaks.length > 0
|
|
54
|
+
? streaks.reduce((longest, current) => current.days > longest.days ? current : longest)
|
|
55
|
+
: { days: 0, startDate: startDate, endDate: startDate };
|
|
56
|
+
// Determine current streak (from today or most recent commit going backward)
|
|
57
|
+
const today = new Date();
|
|
58
|
+
const todayKey = (0, date_fns_1.format)(today, 'yyyy-MM-dd');
|
|
59
|
+
let currentStreak;
|
|
60
|
+
if (commitDates.has(todayKey)) {
|
|
61
|
+
// Today has a commit, find streak from today backward
|
|
62
|
+
let streakDays = 0;
|
|
63
|
+
let checkDate = today;
|
|
64
|
+
while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
|
|
65
|
+
streakDays++;
|
|
66
|
+
checkDate = (0, date_fns_1.subDays)(checkDate, 1);
|
|
67
|
+
if (checkDate < startDate)
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
currentStreak = {
|
|
71
|
+
days: streakDays,
|
|
72
|
+
startDate: (0, date_fns_1.subDays)(today, streakDays - 1),
|
|
73
|
+
endDate: today,
|
|
74
|
+
isActive: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// No commit today, check if yesterday had commit (streak just broke)
|
|
79
|
+
const yesterday = (0, date_fns_1.subDays)(today, 1);
|
|
80
|
+
const yesterdayKey = (0, date_fns_1.format)(yesterday, 'yyyy-MM-dd');
|
|
81
|
+
if (commitDates.has(yesterdayKey)) {
|
|
82
|
+
let streakDays = 0;
|
|
83
|
+
let checkDate = yesterday;
|
|
84
|
+
while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
|
|
85
|
+
streakDays++;
|
|
86
|
+
checkDate = (0, date_fns_1.subDays)(checkDate, 1);
|
|
87
|
+
if (checkDate < startDate)
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
currentStreak = {
|
|
91
|
+
days: streakDays,
|
|
92
|
+
startDate: (0, date_fns_1.subDays)(yesterday, streakDays - 1),
|
|
93
|
+
endDate: yesterday,
|
|
94
|
+
isActive: false
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// No recent streak
|
|
99
|
+
currentStreak = {
|
|
100
|
+
days: 0,
|
|
101
|
+
startDate: today,
|
|
102
|
+
endDate: today,
|
|
103
|
+
isActive: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
currentStreak,
|
|
109
|
+
longestStreak,
|
|
110
|
+
totalActiveDays,
|
|
111
|
+
totalDays,
|
|
112
|
+
activeDayPercentage,
|
|
113
|
+
streaks
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function getStreakMotivation(days, isActive) {
|
|
117
|
+
if (days === 0) {
|
|
118
|
+
return "Start building momentum today";
|
|
119
|
+
}
|
|
120
|
+
if (!isActive) {
|
|
121
|
+
return `Your ${days}-day streak ended. Time for a fresh start.`;
|
|
122
|
+
}
|
|
123
|
+
if (days >= 61)
|
|
124
|
+
return "Outstanding consistency";
|
|
125
|
+
if (days >= 31)
|
|
126
|
+
return "Exceptional dedication";
|
|
127
|
+
if (days >= 15)
|
|
128
|
+
return "Strong momentum 🔥";
|
|
129
|
+
if (days >= 8)
|
|
130
|
+
return "Solid consistency";
|
|
131
|
+
if (days >= 4)
|
|
132
|
+
return "Building momentum";
|
|
133
|
+
return "Just getting started";
|
|
134
|
+
}
|