g-ui-web 1.4.41 → 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.
@@ -175,7 +175,7 @@ function componentUsagePlugin(options = {}) {
175
175
  }
176
176
  if (componentsInFile.length > 0) {
177
177
  const relativePath = id.replace(process.cwd(), "");
178
- importStats.fileDetails.set(relativePath, componentsInFile);
178
+ importStats.fileDetails.set(relativePath, [...new Set(componentsInFile)]);
179
179
  }
180
180
  } catch (error) {
181
181
  console.warn(`[component-usage] \u89E3\u6790\u6587\u4EF6\u5931\u8D25: ${id}`, error.message);
@@ -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 outputPath = (0, import_path.resolve)(process.cwd(), "component-usage-report.json");
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, JSON.stringify(reportData, null, 2), "utf-8");
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) {
@@ -149,7 +149,7 @@ function componentUsagePlugin(options = {}) {
149
149
  }
150
150
  if (componentsInFile.length > 0) {
151
151
  const relativePath = id.replace(process.cwd(), "");
152
- importStats.fileDetails.set(relativePath, componentsInFile);
152
+ importStats.fileDetails.set(relativePath, [...new Set(componentsInFile)]);
153
153
  }
154
154
  } catch (error) {
155
155
  console.warn(`[component-usage] \u89E3\u6790\u6587\u4EF6\u5931\u8D25: ${id}`, error.message);
@@ -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 outputPath = resolve(process.cwd(), "component-usage-report.json");
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, JSON.stringify(reportData, null, 2), "utf-8");
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) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "g-ui-web",
3
3
  "private": false,
4
4
  "description": "可视化组件库",
5
- "version": "1.4.41",
5
+ "version": "1.4.43",
6
6
  "author": "wyu",
7
7
  "license": "MIT",
8
8
  "type": "module",