statoscope icon indicating copy to clipboard operation
statoscope copied to clipboard

Add a way to specify custom reports in the CLI with multiple inputs

Open onigoetz opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. I'm trying to use the CLI with many stats file (Generated through @vercel/ncc) and have a custom report that goes through the data of all modules. It's possible to create a report using the "Make Report" UI, but not to add it to a configuration file.

Describe the solution you'd like

  • Add a way to define reports in the statoscope.config.js, with the same format as for webpack
  • Add a button on the "Make Report" UI to export to a valid JSON to easily add to statoscope.config.js
  • Make it work for more than one input file (statoscope inject-report works only for a single input)

Describe alternatives you've considered I can save the URL of my report, but that's not a great UX

Additional context I work on a node application, and want to bundle dependencies, that's why I have many stats files.

onigoetz avatar Feb 15 '22 20:02 onigoetz

Thanks for the issue! Pretty cool idea. Will be added

smelukov avatar Feb 15 '22 21:02 smelukov

@onigoetz I would like to suggest you a temporary workaround:

  • call statoscope inject-report for one stats file
  • call statoscope generate for all of your stats files

For example, imagine that you have a few stats file from @vercel/ncc in a stats directory.

statoscope inject-report --input stats/foo.json --report path/to/my-reports.json > stats/foo.json
statoscope generate --input stats/* -t output.html

smelukov avatar Mar 09 '22 11:03 smelukov

Seems like we can close this issue because after #175 we can use --custom-report with the generate command to add some custom reports

smelukov avatar Feb 17 '23 08:02 smelukov