-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
29 lines (28 loc) · 862 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Get the current working directory
root_dir=$(pwd)
source ~/.profile
source ~/.bashrc
nvm use;
npm i;
# Loop through each subdirectory, one level deep
for dir in */; do
dir="${dir%/}"
# Check if the directory contains a package.json file
if [ -f "${dir}/package.json" ]; then
echo "Entering directory: ${dir}"
cd "${dir}" || continue
npm i;
# Run 'npm run package' if package.json exists
if npm run package --icon=${root_dir}/${dir}/${dir}.svg ${dir}; then
echo "'npm run package' completed successfully in ${dir}"
else
echo "'npm run package' failed in ${dir}"
fi
# Return to the root directory
cd "${root_dir}";
node postpackage.js "${dir}" || exit
else
echo "No package.json found in ${dir}, skipping..."
fi
done