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
package/dist/utils/gitParser.js
CHANGED
|
@@ -1,126 +1,136 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.filter(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getRepositoryUrl = exports.getRepositoryName = exports.getCurrentGitUser = exports.parseGitCommits = exports.parseCommitData = exports.getCommitHistory = void 0;
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const GIT_LOG_FORMAT = '--pretty=format:"%H|%an|%aI|%s"';
|
|
40
|
+
const getCommitHistory = (repoPath) => {
|
|
41
|
+
try {
|
|
42
|
+
const output = (0, child_process_1.execSync)(`git log ${GIT_LOG_FORMAT}`, {
|
|
43
|
+
cwd: repoPath,
|
|
44
|
+
encoding: 'utf-8',
|
|
45
|
+
maxBuffer: 50 * 1024 * 1024, // 50MB buffer for large repos
|
|
46
|
+
});
|
|
47
|
+
return output;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new Error(`Error retrieving commit history: ${error.message}`);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.getCommitHistory = getCommitHistory;
|
|
54
|
+
const parseCommitData = (commitData) => {
|
|
55
|
+
if (!commitData || commitData.trim() === '') {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
return commitData.split('\n')
|
|
59
|
+
.filter(line => line.trim())
|
|
60
|
+
.map(line => {
|
|
61
|
+
const parts = line.split('|');
|
|
62
|
+
if (parts.length < 4) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const [hash, author, date, ...messageParts] = parts;
|
|
66
|
+
const message = messageParts.join('|'); // Rejoin in case message contains |
|
|
67
|
+
return { hash, author, date, message };
|
|
68
|
+
})
|
|
69
|
+
.filter((commit) => commit !== null &&
|
|
70
|
+
Boolean(commit.hash) &&
|
|
71
|
+
Boolean(commit.author) &&
|
|
72
|
+
Boolean(commit.date));
|
|
73
|
+
};
|
|
74
|
+
exports.parseCommitData = parseCommitData;
|
|
75
|
+
const parseGitCommits = (repoPath) => {
|
|
76
|
+
const commitHistory = (0, exports.getCommitHistory)(repoPath);
|
|
77
|
+
return (0, exports.parseCommitData)(commitHistory);
|
|
78
|
+
};
|
|
79
|
+
exports.parseGitCommits = parseGitCommits;
|
|
80
|
+
const getCurrentGitUser = (repoPath) => {
|
|
81
|
+
try {
|
|
82
|
+
const name = (0, child_process_1.execSync)('git config user.name', {
|
|
83
|
+
cwd: repoPath,
|
|
84
|
+
encoding: 'utf-8',
|
|
85
|
+
}).trim();
|
|
86
|
+
return name || 'Unknown';
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return 'Unknown';
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.getCurrentGitUser = getCurrentGitUser;
|
|
93
|
+
const getRepositoryName = (repoPath) => {
|
|
94
|
+
try {
|
|
95
|
+
// Try to get from remote URL first
|
|
96
|
+
const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
|
|
97
|
+
cwd: repoPath,
|
|
98
|
+
encoding: 'utf-8',
|
|
99
|
+
}).trim();
|
|
100
|
+
if (remoteUrl) {
|
|
101
|
+
// Extract repo name from URL (e.g., "owner/repo" or just "repo")
|
|
102
|
+
const match = remoteUrl.match(/([^\/]+\/[^\/]+?)(\.git)?$/) || remoteUrl.match(/([^\/]+?)(\.git)?$/);
|
|
103
|
+
if (match) {
|
|
104
|
+
return match[1].replace('.git', '');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
// If git remote fails, fall back to directory name
|
|
110
|
+
}
|
|
111
|
+
// Fallback to directory name
|
|
112
|
+
return path.basename(path.resolve(repoPath));
|
|
113
|
+
};
|
|
114
|
+
exports.getRepositoryName = getRepositoryName;
|
|
115
|
+
const getRepositoryUrl = (repoPath) => {
|
|
116
|
+
try {
|
|
117
|
+
const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
|
|
118
|
+
cwd: repoPath,
|
|
119
|
+
encoding: 'utf-8',
|
|
120
|
+
}).trim();
|
|
121
|
+
if (remoteUrl) {
|
|
122
|
+
// Convert SSH URL to HTTPS for display
|
|
123
|
+
if (remoteUrl.startsWith('git@')) {
|
|
124
|
+
return remoteUrl
|
|
125
|
+
.replace(/^git@([^:]+):/, 'https://$1/')
|
|
126
|
+
.replace(/\.git$/, '');
|
|
127
|
+
}
|
|
128
|
+
return remoteUrl.replace(/\.git$/, '');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
// No remote URL available
|
|
133
|
+
}
|
|
134
|
+
return '';
|
|
135
|
+
};
|
|
136
|
+
exports.getRepositoryUrl = getRepositoryUrl;
|