Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] enable build-report as part of the normal release process (instead of having to build the report and release separately) #881

Closed
xlfe opened this issue May 8, 2021 · 7 comments

Comments

@xlfe
Copy link

xlfe commented May 8, 2021

Firstly, thank you @thheller for shadow-cljs!

This is a feature request - currently we have our CI pipeline generate a build report at the same time as a release, so we run

npx shadow-cljs run shadow.cljs.build-report client "report.html"                                                                 
npx shadow-cljs release client

Both takes a little while, so I guess I'm wondering if it would be useful to add an option to generate the report as part of the release build and avoid building the release twice?

I'd be happy to take a crack at a PR if that would be useful?

@thheller
Copy link
Owner

thheller commented May 8, 2021

In theory that is not a problem.

The only option the build-report would need to force is :compiler-options {:source-map true} since the report is generated from the source maps and as so they need to exist on disk.

@xlfe
Copy link
Author

xlfe commented May 9, 2021

👍

So would you be happy with a new option in the build section of shadow-cljs.edn which controls report generation such as :build-report true

And instead of forcing source-map true how about a warning along the lines of "Unable to generate a build-report without source-maps" if the build config contains :build-report true but not :compiler-options {:source-map true}?

@thheller
Copy link
Owner

thheller commented May 9, 2021

I rewrote the build-report UI today, which was long overdue.

There are a couple things I want to sort out before hooking up the report into the build directly. You could in theory hook it up yourself via a build hook in the :flush stage, I may end up providing such a hook. I don't really think it should live in the build target directly but I need to think about it for a bit.

@thheller
Copy link
Owner

In 2.12.6 you can now configure this via :build-hooks.

:build-hooks
[(shadow.cljs.build-report/hook)]

in your build config which will generate a report.html in the configured :output-dir.

Optionally you can overwrite where this is written to via

:build-hooks
[(shadow.cljs.build-report/hook
   {:output-to "foo.html")]

The :output-to is relative to the project root, not the :output-dir.

@xlfe
Copy link
Author

xlfe commented May 10, 2021

@thheller that's awesome. Thank you for such a rapid & responsive resolution.

I really like the new UI in the report, and I can see myself doing something with the embedded data down the track too to track build size over time, etc :)

screen-2021-05-11T08-56-36

@thheller
Copy link
Owner

That data was previously also generated as bundle-info.edn but the hook doesn't generate that file at all. I can add an option if you are interested in that data. It is the same data as in the HTML but would maybe save an extraction step.

@xlfe
Copy link
Author

xlfe commented May 11, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants