react-native-bundle-discovery 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,6 @@ There are two ways to install the package:
24
24
  1. As in independent tool (UI + CLI)
25
25
  2. Or as a [Rozenite](_rozenite/README.md) plugin (see: [_rozenite/README.md](_rozenite/README.md))
26
26
 
27
-
28
27
  > 🚀 If you've migrated to [Re.Pack](https://re-pack.dev/), you can still use this package to analyze 📊 JS bundles 📦 generated by Re.Pack.
29
28
  >
30
29
  > 💡 Learn more: 📖 [Re.Pack.md](./Re.Pack.md)
@@ -94,6 +93,31 @@ npx react-native-bundle-discovery-cli packages metro-stats.json [--sort size|nam
94
93
  # Display the heaviest modules in the bundle report (default limit: 50, --limit 0 shows all)
95
94
  # --filter accepts plain text (case-insensitive) or a regexp: --filter '/\.json/i'
96
95
  npx react-native-bundle-discovery-cli modules metro-stats.json [--limit 50] [--filter <text|/regexp/>] [--sort size|name] [--format json|table|default]
96
+
97
+ # Compare two bundle reports: total size, added/removed/changed modules and packages,
98
+ # version changes, new duplicates and new deprecated packages
99
+ npx react-native-bundle-discovery-cli compare --before main-stats.json --after pr-stats.json [--limit 50] [--format json|markdown|default]
100
+ ```
101
+
102
+ ##### Bundle size checks in CI
103
+
104
+ `compare` exits with code `1` when one of the checks fails:
105
+
106
+ ```bash
107
+ # --fail-on-increase: max growth, in bytes (50KB, 0.5MB, 51200) or percent of the "before" size (5%)
108
+ # --max-size: absolute limit for the "after" bundle
109
+ # --fail-on: fail when new duplicate or new deprecated packages appear
110
+ npx react-native-bundle-discovery-cli compare --before main-stats.json --after pr-stats.json \
111
+ --fail-on-increase 50KB \
112
+ --max-size 3MB \
113
+ --fail-on new-duplicates,new-deprecated
114
+ ```
115
+
116
+ On GitHub Actions no extra setup is needed: the markdown report is added to the job summary
117
+ and failed checks are shown as error annotations. Use `--format markdown` to get the same report for a PR comment.
118
+
119
+ ```yaml
120
+ - run: npx react-native-bundle-discovery-cli compare --before main-stats0.json --after metro-stats1.json --fail-on-increase 5%
97
121
  ```
98
122
 
99
123
  #### UI package
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bundle-discovery",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:retyui/react-native-bundle-discovery.git",
6
6
  "author": "David <4661784+retyui@users.noreply.github.com>",
@@ -1,6 +1,6 @@
1
1
  const DEFAULT_REGISTRY = "https://registry.npmjs.org";
2
- const DEFAULT_TIMEOUT_MS = 1_000;
3
- const DEFAULT_CONCURRENCY = 8;
2
+ const DEFAULT_TIMEOUT_MS = 5_000;
3
+ const DEFAULT_CONCURRENCY = 5;
4
4
 
5
5
  // Simple in-memory cache: `${registry}|${name}` -> Promise<packument summary | null>
6
6
  // Keeps promises (not values) so concurrent lookups of the same package share one request,