1.0.8 • Published 5 months ago

top-assets v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Top Assets

A NodeJs + Shell Script Setup. It Extracts top n assets packed in apk (By size). Create a Html Report.

Setup

  1. Install top-assets npm package
npm install -g top-assets
  1. Run `npm install

  2. Prepare your Shell Enviroment, Save this in a extract.sh file and its path in ~/.bash_profile

# run sh extract.sh
SourceDir=".";
DestDir="release-res";
ext_list=(".jpg" ".png" ".webp" ".jpeg")

mv *.apk app.zip
unzip app.zip -d app
mkdir release-res
rm -r report
mkdir report
mkdir report/assets
touch report/index.html

# Copy files, allowing duplicates with appended index
for i in "${ext_list[@]}"
do
echo "Searching for type: $i"
find ${SourceDir}/ -type f -regex ".*"$i"" |
while read x
do
  bn=`basename $x`;
  if [ -f "${DestDir}/$bn" ]
  then
    for i in {1..9999}
    do
        if [ ! -f "${DestDir}/${bn%.*}_${i}.${bn##*.}" ]
        then
            bn="${bn%.*}_${i}.${bn##*.}"
            echo "$bn";
            break;
        fi
    done
  fi
  cp "$x" "${DestDir}/$bn";
 done
 done

echo 'Sorting assets...'
# Run the module `top-assets` to filter top assets.
# Arguement: Count of Top Assets we want in the report
top-assets 25
# Cleanup
echo "Cleanup"
rm -r release-res
rm -r app
rm app.zip

How to use

For easy setup, 1. Create a separate directory. 2. Paste the apk which you want to run this tool on 3. Run sh extract.sh in terminal. 4. It will generate a /reports/index.html 5. Open this report file, you will see top n assets listed along with its RAM Impact, Dimenstion, Name and Preview.

Note: This tool is already integrated on TeamCity as a Separate Build Config. You can optionally trigger any build and get the report generated.

TeamCity Build Setup

Report Preview: Screenshot 2023-11-30 at 4 54 21 PM

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago