Installation: download the binary for your system from Releases
$ sn-sizer serve test-binary
Starting server on http://localhost:52616
When you navigate to the page, you will be greeted with an interactive dashboard allowing to drill down into the various packages and their sizes.
At the moment, only MacOS and Linux binaries are supported, to support Windows we need a brave volunteer.
This is an sbt project with two modules:
-
cli- a Scala Native CLI that analyses the binary and starts and embedded HTTP server which serves a web frontend to explore the binary. -
frontend- a Scala.js single-page application, using Vite as bundler and dev server
The frontend and the backend need to be built in strict order.
Run frontendBuild; buildBinaryDebug and ./out/debug/sn-sizemap binary will be produced with latest version of the frontend embedded in the CLI itself.
If you want to build a release version, run frontendBuild; buildBinaryRelease.
For convenience, these commands are provided:
debugBuildreleaseBuilddebugPlatformBuildreleasePlatformBuild
The project is structured to allow working on frontend and CLI independently.
- First, start the CLI server – for simplicity, we provide a
serveItselfsbt task - it will launch the server on port 8899 analysing the CLI's binary itself - Then, run
frontend/reStart- this will start Vite's dev server, connecting to the backend on port 8899 - Run
~fastLinkJSto automatically rebuild the Scala.js frontend on each change
To produce an optimised bundle, run frontendBuild - it will place the fully static bundle in frontend/dist folder.
serveItself task will automatically rebuild the CLI and restart the server every
time you run it.
Alternatively, run cli/reStart <args> to launch it with different parameters.