Skip to content

Commit ef1b144

Browse files
committed
update release script
1 parent af745a6 commit ef1b144

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

release.sh

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,41 @@
22

33
build_site_only=false
44

5+
dist_path="./.dist"
6+
7+
# Specify the path to the package.json file
8+
package_json="$dist_path/package.json"
9+
10+
use_exising_dist=false
11+
12+
if [ -e "$package_json" ]; then
13+
# Use jq to extract the version property
14+
version=$(jq -r '.version' "$package_json")
15+
16+
# Prompt the user to continue
17+
read -p "The version v$version exists in the .dist folder. Do you want to continue? (y/n): " choice
18+
19+
# Check the user's choice
20+
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
21+
echo "==============================================================="
22+
echo "Continuing with the existing version $version"
23+
echo "==============================================================="
24+
use_exising_dist=true
25+
fi
26+
fi
27+
28+
if [ "$use_exising_dist" = false ]; then
29+
echo "==============================================================="
30+
echo "Continuing to build and dist anew from v$(jq -r '.version' "./package.json")"
31+
echo "==============================================================="
32+
fi
33+
534
incorrect_selection() {
635
echo "Incorrect selection! Try again."
736
}
837

938
until [ "$selection" = "0" ]; do
10-
clear
39+
# clear
1140
echo "» Where would you like to publish?"
1241
echo ""
1342
echo " 1 - Upcoming"
@@ -36,8 +65,6 @@ done
3665
#
3766
# Do some cleanup & prep
3867
#
39-
echo "» Removing '.dist' folder..."
40-
rm -rf .dist/
4168
echo "» Removing '__release' folder..."
4269
rm -rf __release/
4370
echo "» Creating fresh '__release' folder..."
@@ -48,10 +75,14 @@ mkdir -p __release/
4875
#
4976
npx browserslist@latest --update-db
5077

51-
#
52-
# Build framework
53-
#
54-
npm run build-dist
78+
if [ "$use_exising_dist" = false ]; then
79+
echo "» Removing '.dist' folder..."
80+
rm -rf $dist_path
81+
#
82+
# Build framework
83+
#
84+
npm run build-dist
85+
fi
5586

5687
# # tar -cvf design-system-dist.tar .dist/
5788
# cd .dist && zip -r dist . && mv dist.zip ../ && cd ..

0 commit comments

Comments
 (0)