2
2
3
3
build_site_only=false
4
4
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
+
5
34
incorrect_selection () {
6
35
echo " Incorrect selection! Try again."
7
36
}
8
37
9
38
until [ " $selection " = " 0" ]; do
10
- clear
39
+ # clear
11
40
echo " » Where would you like to publish?"
12
41
echo " "
13
42
echo " 1 - Upcoming"
36
65
#
37
66
# Do some cleanup & prep
38
67
#
39
- echo " » Removing '.dist' folder..."
40
- rm -rf .dist/
41
68
echo " » Removing '__release' folder..."
42
69
rm -rf __release/
43
70
echo " » Creating fresh '__release' folder..."
@@ -48,10 +75,14 @@ mkdir -p __release/
48
75
#
49
76
npx browserslist@latest --update-db
50
77
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
55
86
56
87
# # tar -cvf design-system-dist.tar .dist/
57
88
# cd .dist && zip -r dist . && mv dist.zip ../ && cd ..
0 commit comments