repo-wrapped 0.0.3 → 0.0.5
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 +64 -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 +61 -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 +245 -233
- package/dist/utils/impactAnalyzer.js +247 -248
- package/dist/utils/knowledgeDistributionAnalyzer.js +380 -374
- package/dist/utils/matrixGenerator.js +369 -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,49 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateSlides =
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const formatters_1 = require("../formatters");
|
|
10
|
-
const BORDER_WIDTH = 50;
|
|
11
|
-
function generateSlides(summary) {
|
|
12
|
-
const slides = [
|
|
13
|
-
createWelcomeSlide(summary),
|
|
14
|
-
createBigNumberSlide(summary),
|
|
15
|
-
createPersonalitySlide(summary),
|
|
16
|
-
createStreakSlide(summary),
|
|
17
|
-
createTopMonthSlide(summary),
|
|
18
|
-
createImpactSlide(summary),
|
|
19
|
-
createDistributionSlide(summary),
|
|
20
|
-
createCollaborationSlide(summary),
|
|
21
|
-
createQualitySlide(summary),
|
|
22
|
-
createFunFactsSlide(summary),
|
|
23
|
-
createAchievementsSlide(summary)
|
|
24
|
-
];
|
|
25
|
-
// Add comparison slide if available
|
|
26
|
-
if (summary.comparison) {
|
|
27
|
-
slides.push(createComparisonSlide(summary));
|
|
28
|
-
}
|
|
29
|
-
// Add finale
|
|
30
|
-
slides.push(createFinaleSlide(summary));
|
|
31
|
-
return slides;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function createWelcomeSlide(summary) {
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateSlides = generateSlides;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const formatters_1 = require("../formatters");
|
|
10
|
+
const BORDER_WIDTH = 50;
|
|
11
|
+
function generateSlides(summary) {
|
|
12
|
+
const slides = [
|
|
13
|
+
createWelcomeSlide(summary),
|
|
14
|
+
createBigNumberSlide(summary),
|
|
15
|
+
createPersonalitySlide(summary),
|
|
16
|
+
createStreakSlide(summary),
|
|
17
|
+
createTopMonthSlide(summary),
|
|
18
|
+
createImpactSlide(summary),
|
|
19
|
+
createDistributionSlide(summary),
|
|
20
|
+
createCollaborationSlide(summary),
|
|
21
|
+
createQualitySlide(summary),
|
|
22
|
+
createFunFactsSlide(summary),
|
|
23
|
+
createAchievementsSlide(summary)
|
|
24
|
+
];
|
|
25
|
+
// Add comparison slide if available
|
|
26
|
+
if (summary.comparison) {
|
|
27
|
+
slides.push(createComparisonSlide(summary));
|
|
28
|
+
}
|
|
29
|
+
// Add finale
|
|
30
|
+
slides.push(createFinaleSlide(summary));
|
|
31
|
+
return slides;
|
|
32
|
+
}
|
|
33
|
+
function createBorder(char = '━') {
|
|
34
|
+
return char.repeat(BORDER_WIDTH);
|
|
35
|
+
}
|
|
36
|
+
function centerText(text, width = BORDER_WIDTH) {
|
|
37
|
+
const strippedText = stripAnsi(text);
|
|
38
|
+
const padding = Math.max(0, Math.floor((width - strippedText.length) / 2));
|
|
39
|
+
return ' '.repeat(padding) + text;
|
|
40
|
+
}
|
|
41
|
+
function stripAnsi(str) {
|
|
42
|
+
// eslint-disable-next-line no-control-regex
|
|
43
|
+
return str.replace(/\x1B\[[0-9;]*m/g, '');
|
|
44
|
+
}
|
|
45
|
+
function createWelcomeSlide(summary) {
|
|
47
46
|
const content = `
|
|
48
47
|
${chalk_1.default.magenta(createBorder())}
|
|
49
48
|
${centerText('')}
|
|
@@ -53,11 +52,11 @@ ${centerText(chalk_1.default.gray(`Hey ${summary.developer},`))}
|
|
|
53
52
|
${centerText(chalk_1.default.gray('Let\'s look back at your year!'))}
|
|
54
53
|
${centerText('')}
|
|
55
54
|
${chalk_1.default.magenta(createBorder())}
|
|
56
|
-
`;
|
|
57
|
-
return { title: 'Welcome', content, type: 'welcome' };
|
|
58
|
-
}
|
|
59
|
-
function createBigNumberSlide(summary) {
|
|
60
|
-
const perDay = summary.overview.avgCommitsPerDay.toFixed(1);
|
|
55
|
+
`;
|
|
56
|
+
return { title: 'Welcome', content, type: 'welcome' };
|
|
57
|
+
}
|
|
58
|
+
function createBigNumberSlide(summary) {
|
|
59
|
+
const perDay = summary.overview.avgCommitsPerDay.toFixed(1);
|
|
61
60
|
const content = `
|
|
62
61
|
${chalk_1.default.magenta(createBorder())}
|
|
63
62
|
${centerText(chalk_1.default.gray('You made'))}
|
|
@@ -68,13 +67,13 @@ ${centerText('')}
|
|
|
68
67
|
${centerText(chalk_1.default.gray(`That's ${perDay} commits per active day!`))}
|
|
69
68
|
${centerText('')}
|
|
70
69
|
${chalk_1.default.magenta(createBorder())}
|
|
71
|
-
`;
|
|
72
|
-
return { title: 'Big Number', content, type: 'stat' };
|
|
73
|
-
}
|
|
74
|
-
function createPersonalitySlide(summary) {
|
|
75
|
-
const emoji = constants_1.WRAPPED_CHRONOTYPE_EMOJIS[summary.timing.chronotype];
|
|
76
|
-
const label = constants_1.WRAPPED_CHRONOTYPE_LABELS[summary.timing.chronotype];
|
|
77
|
-
const timeStr = (0, formatters_1.formatHourShort)(summary.timing.peakHour);
|
|
70
|
+
`;
|
|
71
|
+
return { title: 'Big Number', content, type: 'stat' };
|
|
72
|
+
}
|
|
73
|
+
function createPersonalitySlide(summary) {
|
|
74
|
+
const emoji = constants_1.WRAPPED_CHRONOTYPE_EMOJIS[summary.timing.chronotype];
|
|
75
|
+
const label = constants_1.WRAPPED_CHRONOTYPE_LABELS[summary.timing.chronotype];
|
|
76
|
+
const timeStr = (0, formatters_1.formatHourShort)(summary.timing.peakHour);
|
|
78
77
|
const content = `
|
|
79
78
|
${chalk_1.default.magenta(createBorder())}
|
|
80
79
|
${centerText(chalk_1.default.gray('Your coding vibe:'))}
|
|
@@ -85,13 +84,13 @@ ${centerText(chalk_1.default.gray(`Peak hour: ${timeStr}`))}
|
|
|
85
84
|
${centerText(chalk_1.default.gray(`Favorite day: ${summary.timing.peakDay}`))}
|
|
86
85
|
${centerText('')}
|
|
87
86
|
${chalk_1.default.magenta(createBorder())}
|
|
88
|
-
`;
|
|
89
|
-
return { title: 'Personality', content, type: 'insight' };
|
|
90
|
-
}
|
|
91
|
-
function createStreakSlide(summary) {
|
|
92
|
-
const { longest } = summary.streaks;
|
|
93
|
-
const startStr = longest.start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
94
|
-
const endStr = longest.end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
87
|
+
`;
|
|
88
|
+
return { title: 'Personality', content, type: 'insight' };
|
|
89
|
+
}
|
|
90
|
+
function createStreakSlide(summary) {
|
|
91
|
+
const { longest } = summary.streaks;
|
|
92
|
+
const startStr = longest.start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
93
|
+
const endStr = longest.end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
95
94
|
const content = `
|
|
96
95
|
${chalk_1.default.magenta(createBorder())}
|
|
97
96
|
${centerText(chalk_1.default.gray('Your longest streak:'))}
|
|
@@ -103,10 +102,10 @@ ${centerText(chalk_1.default.gray(`${startStr} - ${endStr}`))}
|
|
|
103
102
|
${centerText('')}
|
|
104
103
|
${centerText(chalk_1.default.gray('Consistency is key! 💪'))}
|
|
105
104
|
${chalk_1.default.magenta(createBorder())}
|
|
106
|
-
`;
|
|
107
|
-
return { title: 'Streak', content, type: 'celebration' };
|
|
108
|
-
}
|
|
109
|
-
function createTopMonthSlide(summary) {
|
|
105
|
+
`;
|
|
106
|
+
return { title: 'Streak', content, type: 'celebration' };
|
|
107
|
+
}
|
|
108
|
+
function createTopMonthSlide(summary) {
|
|
110
109
|
const content = `
|
|
111
110
|
${chalk_1.default.magenta(createBorder())}
|
|
112
111
|
${centerText(chalk_1.default.gray('Your most productive month:'))}
|
|
@@ -116,11 +115,11 @@ ${centerText('')}
|
|
|
116
115
|
${centerText(chalk_1.default.gray('You were on fire! 🔥'))}
|
|
117
116
|
${centerText('')}
|
|
118
117
|
${chalk_1.default.magenta(createBorder())}
|
|
119
|
-
`;
|
|
120
|
-
return { title: 'Top Month', content, type: 'stat' };
|
|
121
|
-
}
|
|
122
|
-
function createImpactSlide(summary) {
|
|
123
|
-
const { linesAdded, linesRemoved } = summary.impact;
|
|
118
|
+
`;
|
|
119
|
+
return { title: 'Top Month', content, type: 'stat' };
|
|
120
|
+
}
|
|
121
|
+
function createImpactSlide(summary) {
|
|
122
|
+
const { linesAdded, linesRemoved } = summary.impact;
|
|
124
123
|
const content = `
|
|
125
124
|
${chalk_1.default.magenta(createBorder())}
|
|
126
125
|
${centerText(chalk_1.default.gray('Code impact:'))}
|
|
@@ -132,13 +131,13 @@ ${centerText(chalk_1.default.gray(`${summary.impact.filesChanged} files changed`
|
|
|
132
131
|
${centerText('')}
|
|
133
132
|
${centerText(chalk_1.default.gray('Making waves in the codebase! 🌊'))}
|
|
134
133
|
${chalk_1.default.magenta(createBorder())}
|
|
135
|
-
`;
|
|
136
|
-
return { title: 'Impact', content, type: 'stat' };
|
|
137
|
-
}
|
|
138
|
-
function createDistributionSlide(summary) {
|
|
139
|
-
const { workDistribution } = summary;
|
|
140
|
-
const total = Object.values(workDistribution).reduce((sum, val) => sum + val, 0);
|
|
141
|
-
const getPercentage = (value) => total > 0 ? ((value / total) * 100).toFixed(0) : '0';
|
|
134
|
+
`;
|
|
135
|
+
return { title: 'Impact', content, type: 'stat' };
|
|
136
|
+
}
|
|
137
|
+
function createDistributionSlide(summary) {
|
|
138
|
+
const { workDistribution } = summary;
|
|
139
|
+
const total = Object.values(workDistribution).reduce((sum, val) => sum + val, 0);
|
|
140
|
+
const getPercentage = (value) => total > 0 ? ((value / total) * 100).toFixed(0) : '0';
|
|
142
141
|
const content = `
|
|
143
142
|
${chalk_1.default.magenta(createBorder())}
|
|
144
143
|
${centerText(chalk_1.default.gray('What you worked on:'))}
|
|
@@ -150,43 +149,43 @@ ${centerText(chalk_1.default.gray(`🔧 Refactors: ${getPercentage(workDistri
|
|
|
150
149
|
${centerText('')}
|
|
151
150
|
${centerText(chalk_1.default.cyan(workDistribution.features > workDistribution.fixes ? 'Feature-focused year! ✨' : 'Bug-squashing hero! 🦸'))}
|
|
152
151
|
${chalk_1.default.magenta(createBorder())}
|
|
153
|
-
`;
|
|
154
|
-
return { title: 'Distribution', content, type: 'insight' };
|
|
155
|
-
}
|
|
156
|
-
function createCollaborationSlide(summary) {
|
|
157
|
-
const { collaboration } = summary;
|
|
158
|
-
let collabText = '';
|
|
159
|
-
if (collaboration.uniqueContributors === 0) {
|
|
152
|
+
`;
|
|
153
|
+
return { title: 'Distribution', content, type: 'insight' };
|
|
154
|
+
}
|
|
155
|
+
function createCollaborationSlide(summary) {
|
|
156
|
+
const { collaboration } = summary;
|
|
157
|
+
let collabText = '';
|
|
158
|
+
if (collaboration.uniqueContributors === 0) {
|
|
160
159
|
collabText = `
|
|
161
160
|
${centerText(chalk_1.default.cyan('Solo developer!'))}
|
|
162
|
-
${centerText(chalk_1.default.gray('Building independently 🚀'))}`;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
const topCollab = collaboration.topCollaborator;
|
|
161
|
+
${centerText(chalk_1.default.gray('Building independently 🚀'))}`;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const topCollab = collaboration.topCollaborator;
|
|
166
165
|
collabText = `
|
|
167
166
|
${centerText(chalk_1.default.gray('You worked alongside:'))}
|
|
168
167
|
${centerText('')}
|
|
169
168
|
${centerText(chalk_1.default.cyan(`👥 ${collaboration.uniqueContributors} developer${collaboration.uniqueContributors === 1 ? '' : 's'}`))}
|
|
170
|
-
${centerText('')}`;
|
|
171
|
-
if (topCollab) {
|
|
169
|
+
${centerText('')}`;
|
|
170
|
+
if (topCollab) {
|
|
172
171
|
collabText += `
|
|
173
172
|
${centerText(chalk_1.default.gray('Most commits with:'))}
|
|
174
173
|
${centerText(chalk_1.default.yellow(topCollab.name))} ${chalk_1.default.gray(`(${topCollab.sharedDays} shared days)`)}
|
|
175
|
-
${centerText('')}`;
|
|
176
|
-
}
|
|
174
|
+
${centerText('')}`;
|
|
175
|
+
}
|
|
177
176
|
collabText += `
|
|
178
|
-
${centerText(chalk_1.default.gray('Great teamwork! 🤝'))}`;
|
|
179
|
-
}
|
|
177
|
+
${centerText(chalk_1.default.gray('Great teamwork! 🤝'))}`;
|
|
178
|
+
}
|
|
180
179
|
const content = `
|
|
181
180
|
${chalk_1.default.magenta(createBorder())}
|
|
182
181
|
${collabText}
|
|
183
182
|
${chalk_1.default.magenta(createBorder())}
|
|
184
|
-
`;
|
|
185
|
-
return { title: 'Collaboration', content, type: 'insight' };
|
|
186
|
-
}
|
|
187
|
-
function createQualitySlide(summary) {
|
|
188
|
-
const { quality } = summary;
|
|
189
|
-
const stars = '⭐'.repeat(Math.min(5, Math.ceil(quality.overallScore / 2)));
|
|
183
|
+
`;
|
|
184
|
+
return { title: 'Collaboration', content, type: 'insight' };
|
|
185
|
+
}
|
|
186
|
+
function createQualitySlide(summary) {
|
|
187
|
+
const { quality } = summary;
|
|
188
|
+
const stars = '⭐'.repeat(Math.min(5, Math.ceil(quality.overallScore / 2)));
|
|
190
189
|
const content = `
|
|
191
190
|
${chalk_1.default.magenta(createBorder())}
|
|
192
191
|
${centerText(chalk_1.default.gray('Commit quality score:'))}
|
|
@@ -198,33 +197,33 @@ ${centerText(chalk_1.default.gray(`${quality.conventionalPercentage.toFixed(0)}%
|
|
|
198
197
|
${centerText('')}
|
|
199
198
|
${centerText(chalk_1.default.cyan('Well documented code! 📚'))}
|
|
200
199
|
${chalk_1.default.magenta(createBorder())}
|
|
201
|
-
`;
|
|
202
|
-
return { title: 'Quality', content, type: 'stat' };
|
|
203
|
-
}
|
|
204
|
-
function createFunFactsSlide(summary) {
|
|
205
|
-
const { funFacts } = summary;
|
|
206
|
-
let facts = '';
|
|
207
|
-
if (funFacts.holidayCommits.length > 0) {
|
|
200
|
+
`;
|
|
201
|
+
return { title: 'Quality', content, type: 'stat' };
|
|
202
|
+
}
|
|
203
|
+
function createFunFactsSlide(summary) {
|
|
204
|
+
const { funFacts } = summary;
|
|
205
|
+
let facts = '';
|
|
206
|
+
if (funFacts.holidayCommits.length > 0) {
|
|
208
207
|
facts += `
|
|
209
|
-
${centerText(chalk_1.default.yellow(`🎄 Committed on ${funFacts.holidayCommits.join(', ')}`))}`;
|
|
210
|
-
}
|
|
211
|
-
if (funFacts.midnightCommits > 0) {
|
|
208
|
+
${centerText(chalk_1.default.yellow(`🎄 Committed on ${funFacts.holidayCommits.join(', ')}`))}`;
|
|
209
|
+
}
|
|
210
|
+
if (funFacts.midnightCommits > 0) {
|
|
212
211
|
facts += `
|
|
213
|
-
${centerText(chalk_1.default.blue(`🌙 ${funFacts.midnightCommits} commit${funFacts.midnightCommits === 1 ? '' : 's'} past midnight`))}`;
|
|
214
|
-
}
|
|
215
|
-
if (funFacts.weekendCommits > 0) {
|
|
212
|
+
${centerText(chalk_1.default.blue(`🌙 ${funFacts.midnightCommits} commit${funFacts.midnightCommits === 1 ? '' : 's'} past midnight`))}`;
|
|
213
|
+
}
|
|
214
|
+
if (funFacts.weekendCommits > 0) {
|
|
216
215
|
facts += `
|
|
217
|
-
${centerText(chalk_1.default.green(`🎉 ${funFacts.weekendCommits} weekend commit${funFacts.weekendCommits === 1 ? '' : 's'}`))}`;
|
|
218
|
-
}
|
|
219
|
-
if (funFacts.busiestDay) {
|
|
220
|
-
const dateStr = funFacts.busiestDay.date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
216
|
+
${centerText(chalk_1.default.green(`🎉 ${funFacts.weekendCommits} weekend commit${funFacts.weekendCommits === 1 ? '' : 's'}`))}`;
|
|
217
|
+
}
|
|
218
|
+
if (funFacts.busiestDay) {
|
|
219
|
+
const dateStr = funFacts.busiestDay.date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
221
220
|
facts += `
|
|
222
|
-
${centerText(chalk_1.default.magenta(`📅 Busiest day: ${dateStr} (${funFacts.busiestDay.commits} commits)`))}`;
|
|
223
|
-
}
|
|
224
|
-
if (!facts) {
|
|
221
|
+
${centerText(chalk_1.default.magenta(`📅 Busiest day: ${dateStr} (${funFacts.busiestDay.commits} commits)`))}`;
|
|
222
|
+
}
|
|
223
|
+
if (!facts) {
|
|
225
224
|
facts = `
|
|
226
|
-
${centerText(chalk_1.default.gray('Steady and consistent work! 💪'))}`;
|
|
227
|
-
}
|
|
225
|
+
${centerText(chalk_1.default.gray('Steady and consistent work! 💪'))}`;
|
|
226
|
+
}
|
|
228
227
|
const content = `
|
|
229
228
|
${chalk_1.default.magenta(createBorder())}
|
|
230
229
|
${centerText(chalk_1.default.gray('Fun facts about your year:'))}
|
|
@@ -233,23 +232,23 @@ ${facts}
|
|
|
233
232
|
${centerText('')}
|
|
234
233
|
${centerText(chalk_1.default.yellow('Dedication level: 💯'))}
|
|
235
234
|
${chalk_1.default.magenta(createBorder())}
|
|
236
|
-
`;
|
|
237
|
-
return { title: 'Fun Facts', content, type: 'celebration' };
|
|
238
|
-
}
|
|
239
|
-
function createAchievementsSlide(summary) {
|
|
240
|
-
const { achievements } = summary;
|
|
241
|
-
let badgeText = '';
|
|
242
|
-
if (achievements.earned.length > 0) {
|
|
243
|
-
const topBadges = achievements.earned.slice(0, 5);
|
|
244
|
-
topBadges.forEach(badge => {
|
|
235
|
+
`;
|
|
236
|
+
return { title: 'Fun Facts', content, type: 'celebration' };
|
|
237
|
+
}
|
|
238
|
+
function createAchievementsSlide(summary) {
|
|
239
|
+
const { achievements } = summary;
|
|
240
|
+
let badgeText = '';
|
|
241
|
+
if (achievements.earned.length > 0) {
|
|
242
|
+
const topBadges = achievements.earned.slice(0, 5);
|
|
243
|
+
topBadges.forEach(badge => {
|
|
245
244
|
badgeText += `
|
|
246
|
-
${centerText(chalk_1.default.yellow(`✨ ${badge}`))}`;
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
245
|
+
${centerText(chalk_1.default.yellow(`✨ ${badge}`))}`;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
250
249
|
badgeText = `
|
|
251
|
-
${centerText(chalk_1.default.gray('Start your journey to earn badges!'))}`;
|
|
252
|
-
}
|
|
250
|
+
${centerText(chalk_1.default.gray('Start your journey to earn badges!'))}`;
|
|
251
|
+
}
|
|
253
252
|
const content = `
|
|
254
253
|
${chalk_1.default.magenta(createBorder())}
|
|
255
254
|
${centerText(chalk_1.default.gray(`Badges earned in ${summary.year}:`))}
|
|
@@ -258,29 +257,29 @@ ${badgeText}
|
|
|
258
257
|
${centerText('')}
|
|
259
258
|
${centerText(chalk_1.default.cyan(`${achievements.total} total achievement${achievements.total === 1 ? '' : 's'}! 🏆`))}
|
|
260
259
|
${chalk_1.default.magenta(createBorder())}
|
|
261
|
-
`;
|
|
262
|
-
return { title: 'Achievements', content, type: 'celebration' };
|
|
263
|
-
}
|
|
264
|
-
function createComparisonSlide(summary) {
|
|
265
|
-
if (!summary.comparison) {
|
|
266
|
-
return { title: 'Comparison', content: '', type: 'comparison' };
|
|
267
|
-
}
|
|
268
|
-
const { comparison } = summary;
|
|
269
|
-
const { changes } = comparison;
|
|
270
|
-
const getTrendArrow = (trend) => {
|
|
271
|
-
if (trend === 'up')
|
|
272
|
-
return chalk_1.default.green('↑');
|
|
273
|
-
if (trend === 'down')
|
|
274
|
-
return chalk_1.default.red('↓');
|
|
275
|
-
return chalk_1.default.gray('→');
|
|
276
|
-
};
|
|
277
|
-
const formatChange = (value, percentage, trend) => {
|
|
278
|
-
const arrow = getTrendArrow(trend);
|
|
279
|
-
if (trend === 'stable')
|
|
280
|
-
return chalk_1.default.gray('stable');
|
|
281
|
-
const sign = value > 0 ? '+' : '';
|
|
282
|
-
return `${arrow} ${sign}${Math.abs(percentage).toFixed(0)}%`;
|
|
283
|
-
};
|
|
260
|
+
`;
|
|
261
|
+
return { title: 'Achievements', content, type: 'celebration' };
|
|
262
|
+
}
|
|
263
|
+
function createComparisonSlide(summary) {
|
|
264
|
+
if (!summary.comparison) {
|
|
265
|
+
return { title: 'Comparison', content: '', type: 'comparison' };
|
|
266
|
+
}
|
|
267
|
+
const { comparison } = summary;
|
|
268
|
+
const { changes } = comparison;
|
|
269
|
+
const getTrendArrow = (trend) => {
|
|
270
|
+
if (trend === 'up')
|
|
271
|
+
return chalk_1.default.green('↑');
|
|
272
|
+
if (trend === 'down')
|
|
273
|
+
return chalk_1.default.red('↓');
|
|
274
|
+
return chalk_1.default.gray('→');
|
|
275
|
+
};
|
|
276
|
+
const formatChange = (value, percentage, trend) => {
|
|
277
|
+
const arrow = getTrendArrow(trend);
|
|
278
|
+
if (trend === 'stable')
|
|
279
|
+
return chalk_1.default.gray('stable');
|
|
280
|
+
const sign = value > 0 ? '+' : '';
|
|
281
|
+
return `${arrow} ${sign}${Math.abs(percentage).toFixed(0)}%`;
|
|
282
|
+
};
|
|
284
283
|
const content = `
|
|
285
284
|
${chalk_1.default.magenta(createBorder())}
|
|
286
285
|
${centerText(chalk_1.default.gray(`${summary.year} vs ${summary.year - 1}:`))}
|
|
@@ -291,10 +290,10 @@ ${centerText(chalk_1.default.gray(`Quality: ${comparison.currentYear.qualit
|
|
|
291
290
|
${centerText('')}
|
|
292
291
|
${centerText(chalk_1.default.cyan(comparison.insights[0] || 'Keep up the great work!'))}
|
|
293
292
|
${chalk_1.default.magenta(createBorder())}
|
|
294
|
-
`;
|
|
295
|
-
return { title: 'Comparison', content, type: 'comparison' };
|
|
296
|
-
}
|
|
297
|
-
function createFinaleSlide(summary) {
|
|
293
|
+
`;
|
|
294
|
+
return { title: 'Comparison', content, type: 'comparison' };
|
|
295
|
+
}
|
|
296
|
+
function createFinaleSlide(summary) {
|
|
298
297
|
const content = `
|
|
299
298
|
${chalk_1.default.magenta(createBorder())}
|
|
300
299
|
${centerText(chalk_1.default.bold.cyan(`That's your ${summary.year}!`))}
|
|
@@ -308,6 +307,6 @@ ${centerText(chalk_1.default.bold.green(`Here's to ${summary.year + 1}! 🚀`))}
|
|
|
308
307
|
${centerText('')}
|
|
309
308
|
${centerText(chalk_1.default.gray('#YearInCode #DevLife'))}
|
|
310
309
|
${chalk_1.default.magenta(createBorder())}
|
|
311
|
-
`;
|
|
312
|
-
return { title: 'Finale', content, type: 'finale' };
|
|
313
|
-
}
|
|
310
|
+
`;
|
|
311
|
+
return { title: 'Finale', content, type: 'finale' };
|
|
312
|
+
}
|