g-ui-web 1.4.42 → 1.4.43
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/lib/plugins/index.cjs +43 -2
- package/lib/plugins/index.mjs +43 -2
- package/package.json +1 -1
package/lib/plugins/index.cjs
CHANGED
|
@@ -201,9 +201,50 @@ function componentUsagePlugin(options = {}) {
|
|
|
201
201
|
topComponents: [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20).map(([name, count]) => ({ name, count })),
|
|
202
202
|
...extraData
|
|
203
203
|
};
|
|
204
|
-
const
|
|
204
|
+
const topAll = [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]);
|
|
205
|
+
let md = `# \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A
|
|
206
|
+
|
|
207
|
+
`;
|
|
208
|
+
md += `- **\u7EC4\u4EF6\u5E93**: ${libraryName}
|
|
209
|
+
`;
|
|
210
|
+
md += `- **\u7EDF\u8BA1\u65F6\u95F4**: ${reportData.timestamp}
|
|
211
|
+
`;
|
|
212
|
+
md += `- **\u603B\u5F15\u7528\u6B21\u6570**: ${reportData.summary.totalImports}
|
|
213
|
+
`;
|
|
214
|
+
md += `- **\u4F7F\u7528\u7684\u7EC4\u4EF6\u6570**: ${reportData.summary.uniqueComponents}
|
|
215
|
+
`;
|
|
216
|
+
md += `- **\u6D89\u53CA\u6587\u4EF6\u6570**: ${reportData.summary.filesWithImports}
|
|
217
|
+
`;
|
|
218
|
+
md += `
|
|
219
|
+
## \u7EC4\u4EF6\u4F7F\u7528\u6392\u884C
|
|
220
|
+
|
|
221
|
+
`;
|
|
222
|
+
md += `| \u6392\u540D | \u7EC4\u4EF6\u540D\u79F0 | \u5F15\u7528\u6B21\u6570 |
|
|
223
|
+
`;
|
|
224
|
+
md += `| --- | --- | --- |
|
|
225
|
+
`;
|
|
226
|
+
topAll.forEach(([name, count], index) => {
|
|
227
|
+
md += `| ${index + 1} | ${name} | ${count} |
|
|
228
|
+
`;
|
|
229
|
+
});
|
|
230
|
+
md += `
|
|
231
|
+
## \u6587\u4EF6\u5F15\u7528\u8BE6\u60C5
|
|
232
|
+
|
|
233
|
+
`;
|
|
234
|
+
importStats.fileDetails.forEach((components, filePath) => {
|
|
235
|
+
md += `### ${filePath}
|
|
236
|
+
|
|
237
|
+
`;
|
|
238
|
+
components.forEach((comp) => {
|
|
239
|
+
md += `- ${comp}
|
|
240
|
+
`;
|
|
241
|
+
});
|
|
242
|
+
md += `
|
|
243
|
+
`;
|
|
244
|
+
});
|
|
245
|
+
const outputPath = (0, import_path.resolve)(process.cwd(), "component-usage-report.md");
|
|
205
246
|
(0, import_fs.mkdirSync)((0, import_path.dirname)(outputPath), { recursive: true });
|
|
206
|
-
(0, import_fs.writeFileSync)(outputPath,
|
|
247
|
+
(0, import_fs.writeFileSync)(outputPath, md, "utf-8");
|
|
207
248
|
console.log(`
|
|
208
249
|
\u{1F4CA} \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A\u5DF2\u751F\u6210: ${outputPath}`);
|
|
209
250
|
if (reportUrl) {
|
package/lib/plugins/index.mjs
CHANGED
|
@@ -175,9 +175,50 @@ function componentUsagePlugin(options = {}) {
|
|
|
175
175
|
topComponents: [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20).map(([name, count]) => ({ name, count })),
|
|
176
176
|
...extraData
|
|
177
177
|
};
|
|
178
|
-
const
|
|
178
|
+
const topAll = [...importStats.componentCount.entries()].sort((a, b) => b[1] - a[1]);
|
|
179
|
+
let md = `# \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A
|
|
180
|
+
|
|
181
|
+
`;
|
|
182
|
+
md += `- **\u7EC4\u4EF6\u5E93**: ${libraryName}
|
|
183
|
+
`;
|
|
184
|
+
md += `- **\u7EDF\u8BA1\u65F6\u95F4**: ${reportData.timestamp}
|
|
185
|
+
`;
|
|
186
|
+
md += `- **\u603B\u5F15\u7528\u6B21\u6570**: ${reportData.summary.totalImports}
|
|
187
|
+
`;
|
|
188
|
+
md += `- **\u4F7F\u7528\u7684\u7EC4\u4EF6\u6570**: ${reportData.summary.uniqueComponents}
|
|
189
|
+
`;
|
|
190
|
+
md += `- **\u6D89\u53CA\u6587\u4EF6\u6570**: ${reportData.summary.filesWithImports}
|
|
191
|
+
`;
|
|
192
|
+
md += `
|
|
193
|
+
## \u7EC4\u4EF6\u4F7F\u7528\u6392\u884C
|
|
194
|
+
|
|
195
|
+
`;
|
|
196
|
+
md += `| \u6392\u540D | \u7EC4\u4EF6\u540D\u79F0 | \u5F15\u7528\u6B21\u6570 |
|
|
197
|
+
`;
|
|
198
|
+
md += `| --- | --- | --- |
|
|
199
|
+
`;
|
|
200
|
+
topAll.forEach(([name, count], index) => {
|
|
201
|
+
md += `| ${index + 1} | ${name} | ${count} |
|
|
202
|
+
`;
|
|
203
|
+
});
|
|
204
|
+
md += `
|
|
205
|
+
## \u6587\u4EF6\u5F15\u7528\u8BE6\u60C5
|
|
206
|
+
|
|
207
|
+
`;
|
|
208
|
+
importStats.fileDetails.forEach((components, filePath) => {
|
|
209
|
+
md += `### ${filePath}
|
|
210
|
+
|
|
211
|
+
`;
|
|
212
|
+
components.forEach((comp) => {
|
|
213
|
+
md += `- ${comp}
|
|
214
|
+
`;
|
|
215
|
+
});
|
|
216
|
+
md += `
|
|
217
|
+
`;
|
|
218
|
+
});
|
|
219
|
+
const outputPath = resolve(process.cwd(), "component-usage-report.md");
|
|
179
220
|
mkdirSync(dirname(outputPath), { recursive: true });
|
|
180
|
-
writeFileSync(outputPath,
|
|
221
|
+
writeFileSync(outputPath, md, "utf-8");
|
|
181
222
|
console.log(`
|
|
182
223
|
\u{1F4CA} \u7EC4\u4EF6\u5F15\u7528\u7EDF\u8BA1\u62A5\u544A\u5DF2\u751F\u6210: ${outputPath}`);
|
|
183
224
|
if (reportUrl) {
|