Skip to content

Commit 4da46b7

Browse files
committed
fix(ci): correct feature extraction from JSON tree structure
- Navigate through nested package structure correctly - Find src folder, then features folder within it - Extract each feature by direct child name (not path pattern) - Include core and shared in breakdown - Total: 220KB across 20 features
1 parent 39fd53b commit 4da46b7

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
.pub/
99
/build/
1010

11+
# Size analysis files
12+
apk-code-size-analysis_*.json
13+
1114
# IntelliJ related
1215
*.iml
1316
*.ipr

scripts/ci/extract_feature_sizes.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,41 @@ jq -r '
3030
0
3131
end;
3232
33-
# Find the stadata_flutter_sdk package node with multiple patterns
33+
# Find the stadata_flutter_sdk package node
3434
def find_package:
35-
(.. | objects | select(.n? == "package:stadata_flutter_sdk")) //
36-
(.. | objects | select(.n? == "stadata_flutter_sdk")) //
37-
(.. | objects | select(.n? | test("stadata_flutter_sdk"))) //
38-
{};
35+
.. | objects | select(.n? == "package:stadata_flutter_sdk" and .children);
3936
40-
# Extract feature sizes
37+
# Find the src folder within the package
38+
def find_src:
39+
[find_package | .children[]? | select(.n? == "src")] |
40+
if length > 0 then .[0] else null end;
41+
42+
# Find the features folder within src
43+
def find_features_folder:
44+
find_src |
45+
if . then .children[]? | select(.n? == "features") else null end;
46+
47+
# Extract feature sizes from the features folder
4148
def extract_features:
42-
find_package |
43-
if .children then
49+
find_features_folder |
50+
if . and .children then
4451
.children[] |
45-
select(.n? // "" | test("^src/features/")) |
4652
{
47-
feature: (.n | split("/")[2]),
53+
feature: .n,
4854
size: sum_values
4955
}
5056
else
5157
empty
5258
end;
5359
54-
# Also extract core and shared sizes
60+
# Extract core and shared sizes
5561
def extract_core_shared:
56-
find_package |
57-
if .children then
62+
find_src |
63+
if . and .children then
5864
.children[] |
59-
select(.n? // "" | test("^src/(core|shared)/")) |
65+
select(.n? == "core" or .n? == "shared") |
6066
{
61-
feature: (.n | split("/")[1]),
67+
feature: .n,
6268
size: sum_values
6369
}
6470
else

0 commit comments

Comments
 (0)