chore : change vec generator
This commit is contained in:
@@ -1,45 +1,76 @@
|
|||||||
#!/bin/bash
|
##!/bin/bash
|
||||||
|
#
|
||||||
|
#
|
||||||
|
## Relative path to the package
|
||||||
|
#PACKAGE_PATH="../packages/core"
|
||||||
|
#
|
||||||
|
## Get absolute path to the package
|
||||||
|
#SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
#PACKAGE_ABS_PATH="$SCRIPT_DIR/$PACKAGE_PATH"
|
||||||
|
#
|
||||||
|
#echo "🗃️ package path: $PACKAGE_ABS_PATH"
|
||||||
|
#
|
||||||
|
## Directory to read files from
|
||||||
|
#sourcePath="../assets/icons"
|
||||||
|
#targetPath="../assets/vec"
|
||||||
|
#echo "🗃️ sourcePath path: $sourcePath"
|
||||||
|
#echo "🗃️ targetPath path: $targetPath"
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#if [ ! -e "$targetPath" ]; then
|
||||||
|
# echo "📁 Directory does not exist. Creating: $targetPath"
|
||||||
|
# mkdir -p "$targetPath"
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#
|
||||||
|
## Loop and delete old vec file
|
||||||
|
#for file in "$targetPath"/*
|
||||||
|
#do
|
||||||
|
# if [ -f "$file" ]; then
|
||||||
|
#
|
||||||
|
# echo "Delete old ===> $file"
|
||||||
|
# rm "$file"
|
||||||
|
# fi
|
||||||
|
#done
|
||||||
|
## Loop through all files in the directory
|
||||||
|
#for file in "$sourcePath"/*
|
||||||
|
#do
|
||||||
|
# if [ -f "$file" ]; then
|
||||||
|
# echo "Generate Vec file ===> $file"
|
||||||
|
# fileName=$(basename -- "$file")
|
||||||
|
# echo "Generate Vec file ===> $fileName"
|
||||||
|
# dart run vector_graphics_compiler -i "$file" -o "$targetPath/$fileName.vec"
|
||||||
|
# git add .
|
||||||
|
# fi
|
||||||
|
#done
|
||||||
|
|
||||||
|
|
||||||
# Relative path to the package
|
|
||||||
PACKAGE_PATH="../packages/core"
|
PACKAGE_PATH="../packages/core"
|
||||||
|
|
||||||
# Get absolute path to the package
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
PACKAGE_ABS_PATH="$SCRIPT_DIR/$PACKAGE_PATH"
|
PACKAGE_ABS_PATH="$SCRIPT_DIR/$PACKAGE_PATH"
|
||||||
|
|
||||||
echo "🗃️ package path: $PACKAGE_ABS_PATH"
|
echo "🗃️ package path: $PACKAGE_ABS_PATH"
|
||||||
|
|
||||||
# Directory to read files from
|
|
||||||
sourcePath="../assets/icons"
|
sourcePath="../assets/icons"
|
||||||
targetPath="../assets/vec"
|
targetPath="../assets/vec"
|
||||||
echo "🗃️ sourcePath path: $sourcePath"
|
echo "🗃️ sourcePath: $sourcePath"
|
||||||
echo "🗃️ targetPath path: $targetPath"
|
echo "🗃️ targetPath: $targetPath"
|
||||||
|
|
||||||
|
mkdir -p "$targetPath"
|
||||||
|
|
||||||
if [ ! -e "$targetPath" ]; then
|
# Delete old .vec files
|
||||||
echo "📁 Directory does not exist. Creating: $targetPath"
|
echo "🧹 Deleting old .vec files..."
|
||||||
mkdir -p "$targetPath"
|
find "$targetPath" -type f -name "*.vec" -exec rm {} \;
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Generate .vec files in parallel
|
||||||
|
echo "⚙️ Generating .vec files in parallel..."
|
||||||
|
|
||||||
# Loop and delete old vec file
|
find "$sourcePath" -type f | xargs -P 10 -I {} bash -c '
|
||||||
for file in "$targetPath"/*
|
input="{}"
|
||||||
do
|
filename=$(basename "$input")
|
||||||
if [ -f "$file" ]; then
|
output="'$targetPath'/$filename.vec"
|
||||||
|
echo "➡️ Generating: $filename"
|
||||||
|
dart run vector_graphics_compiler -i "$input" -o "$output"
|
||||||
|
'
|
||||||
|
|
||||||
echo "Delete old ===> $file"
|
git add .
|
||||||
rm "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# Loop through all files in the directory
|
|
||||||
for file in "$sourcePath"/*
|
|
||||||
do
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
echo "Generate Vec file ===> $file"
|
|
||||||
fileName=$(basename -- "$file")
|
|
||||||
echo "Generate Vec file ===> $fileName"
|
|
||||||
dart run vector_graphics_compiler -i "$file" -o "$targetPath/$fileName.vec"
|
|
||||||
git add .
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user