Skip to content
Back to archipelago.banuacoder.com

DevTools

size_analyzer Pro ​

Tier
Proversion 1.0.6
Command
archipelago generate size_analyzer
Generates
  • devtools/scripts/size_analyzer
Depends on
monorepo_toolkitgenerate these first

Flutter --analyze-size report parser with develop baseline diffing. Adds the size-analyzer command (analyze/update-baseline) to the base monorepo_toolkit.

What it is / when to use it ​

A devtools CLI script — no DI, no app UI. size-analyzer analyze parses the JSON Flutter's --analyze-size build flag produces, ranks packages by contributed size, and (optionally) diffs against a committed baseline so a PR fails when it grows the app past a threshold. size-analyzer update-baseline regenerates that baseline, typically run on merge to develop. Requires the base monorepo_toolkit brick first.

Variables ​

VariableTypeDefaultDescription
appNamestringMyAppThe name of your application
isForMonorepobooleantrueWhether this is being generated as part of a monorepo

Usage ​

Interactive ​

bash
archipelago generate size_analyzer

Non-interactive (CI) ​

bash
archipelago generate size_analyzer --config my_config.json

Config Template ​

json
{
  "@appName": "The name of your application",
  "appName": "MyApp",
  "@isForMonorepo": "Whether this is being generated as part of a monorepo",
  "isForMonorepo": true
}

Generated Structure ​

text
devtools/
└── scripts/
    └── size_analyzer/
        ├── lib/
        │   ├── size_analyzer.dart
        │   └── src/
        │       ├── commands/
        │       │   ├── analyze_command.dart
        │       │   ├── size_analyzer_command.dart
        │       │   └── update_baseline_command.dart
        │       ├── models/
        │       │   └── size_node.dart
        │       ├── reporters/
        │       │   └── size_metrics_reporter.dart
        │       └── services/
        │           └── size_analyzer_service.dart
        └── pubspec.yaml

The post_gen hook adds the package to the workspace, adds it as a dependency of monorepo_toolkit, and injects SizeAnalyzerCommand into command_runner.dart at the // --- Pro Commands --- marker. It does not scaffold a size_baseline/ directory or any baseline JSON files — those are written the first time you run update-baseline, at whatever path you pass to --output.

CLI Usage ​

bash
# Parse a fresh Flutter --analyze-size report, show top 20 contributors
flutter build apk --analyze-size --target-platform android-arm64
dart run monorepo_toolkit size-analyzer analyze --json build/.../code-size-analysis_arm64.json

# ...diff against a committed baseline and show growth
dart run monorepo_toolkit size-analyzer analyze --json <path> --baseline size_baseline/android.json --platform android --top 20

# Update the baseline (run on merge to develop)
dart run monorepo_toolkit size-analyzer update-baseline --json <path> --output size_baseline/android.json

analyze requires --json/-j (mandatory) and accepts --baseline/-b, --platform/-p, and --top (default 20). update-baseline requires both --json/-j and --output/-o.

Dependencies ​

  • monorepo_toolkit — must be generated first.
  • shared_scripts — provides MonorepoFinder, CliLogger.

Changelog ​

Run archipelago brick info size_analyzer to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.