web-infra-dev / rsdoctor

A one-stop build analyzer for Rspack and webpack.
https://rsdoctor.dev/
MIT License
440 stars 35 forks source link

[Feature]: Custom export behaviour for Gitlab pages #157

Closed YanPes closed 2 months ago

YanPes commented 9 months ago

What problem does this feature solve?

As a customer I want to publish the Rsdoctor report on a Gitlab Pages page or a custom hosting solution to be able to access the generated reports from outside. This will help customers monitor the running applications without the need of a local running system.

Acceptance:

What does the proposed API look like?

New plugin option:

new RsdoctorRspackPlugin({
      [...],
      staticExport: true
    }),

Generated static files for usage: // my-repository-path/dist/rsdoctor/index.html // my-repository-path/dist/rsdoctor/main.css // my-repository-path/dist/rsdoctor/main.js

### Tasks
- [ ] https://github.com/web-infra-dev/rsdoctor/issues/462
- [ ] Generate the biref page for rsdoctor.
easy1090 commented 9 months ago

Good idea! I'll include this in the plan. Perhaps you only need to report assets once. If you need historical assets, you should keep the reports.

YanPes commented 9 months ago

Thank you for the fast action on this request. Really appreciate it!

YanPes commented 6 months ago

@easy1090 any rough idea when this will be implemented?

easy1090 commented 6 months ago

@YanPes At present, in May, the high-priority requirement of Rsdoctor is to improve the efficiency of build analysis on webpack or rspack, but the ability of custom report will be realized in June or July.

Currently, the data of Rsdoctor is too large, which may cause the page to crash, so a streamlined page export is required for the custom report.

In June, the ability of the Rsdoctor plugin system will be provided. During the construction process, users can obtain and operate the Rsdoctor analysis data by themselves:


// xxx.config.js
 new RsdoctorWebpackPlugin({
      extends: [RsdoctorCustomPlugin]
 })

 // rsdoctorCustomPlugin.ts
 import { definePlugin } from '@rsdoctor/utils'
 const RsdoctorCustomPlugin = definePlugin(() => ({
  handle(data) {
    // .. do something with the data context, the data includes rsdoctor's all analysis data.
  },
}));
YanPes commented 5 months ago

@easy1090 Thank you for the insights on the current development! I will check out the custom plugin approach. Appreciate your efforts! 🥳

easy1090 commented 2 months ago

You can use rsdoctor's brief mode, @rsdoctor/* > 0.4.0, https://rsdoctor.dev/guide/start/cicd