Skip to content

Commit 409232b

Browse files
committed
Lowercased local vars
1 parent c069c6e commit 409232b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

utils/bump.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ case $1 in # edit subvers based on version type
2424
echo -e "\n${BY}Valid args are: ${BUMP_TYPES[*]/#/--}${NC}" ;
2525
exit 1 ;;
2626
esac
27-
NEW_VER=$(printf "%s.%s.%s" "${subvers[@]}")
27+
new_ver=$(printf "%s.%s.%s" "${subvers[@]}")
2828

2929
# PULL latest changes
3030
echo -e "${BY}Pulling latest changes from remote to sync local repository...${NC}\n"
@@ -33,20 +33,20 @@ echo ''
3333

3434
# Bump version in package.json + package-lock.json
3535
echo -e "${BY}Bumping versions in package manifests...${BW}"
36-
npm version --no-git-tag-version "$NEW_VER"
36+
npm version --no-git-tag-version "$new_ver"
3737

3838
# Bump versions in READMEs
3939
echo -e "${BY}\nBumping versions in READMEs...${BW}"
4040
sed -i \
41-
-e "s/\(chatgpt\(-\|\.js@\)\)[0-9]\+\(\.[0-9]\+\)\{2\}/\1$NEW_VER/g" `# jsDelivr URLs` \
42-
-e "s|v[0-9]\+\.[0-9]\+\.[0-9]\+|v$NEW_VER|g" `# Minified Size shield link/src + userguide links` \
41+
-e "s/\(chatgpt\(-\|\.js@\)\)[0-9]\+\(\.[0-9]\+\)\{2\}/\1$new_ver/g" `# jsDelivr URLs` \
42+
-e "s|v[0-9]\+\.[0-9]\+\.[0-9]\+|v$new_ver|g" `# Minified Size shield link/src + userguide links` \
4343
$(find docs -regex ".*/\(README\|USERGUIDE\)\.md") ./README.md
44-
echo "v$NEW_VER"
44+
echo "v$new_ver"
4545

4646
# Bump chatgpt.js version in Greasemonkey starter
4747
echo -e "${BY}\nBumping versions in Greasemonkey starter...${BW}\n"
48-
sed -i "s|\(@require.*chatgpt\.js@\)[0-9.]\+|\1$NEW_VER|g" starters/greasemonkey/*.user.js
49-
echo "chatgpt.js v$NEW_VER"
48+
sed -i "s|\(@require.*chatgpt\.js@\)[0-9.]\+|\1$new_ver|g" starters/greasemonkey/*.user.js
49+
echo "chatgpt.js v$new_ver"
5050

5151
# Bump userscript version in Greasemonkey starter
5252
TODAY=$(date +'%Y.%-m.%-d') # YYYY.M.D format
@@ -75,31 +75,31 @@ git config --global user.signingkey "$(cat "$GPG_KEYS_PATH/kudo-sync-bot-key-id.
7575
# Commit bumps to Git
7676
echo -e "${BY}\nCommitting bumps to Git...\n${NC}"
7777
git add package*.json
78-
git commit -n -m "Bumped versions in manifests to $NEW_VER"
78+
git commit -n -m "Bumped versions in manifests to $new_ver"
7979
git add "README.md" "./**/README.md" "./**/USERGUIDE.md"
80-
git commit -n -m "Bumped versions in jsDelivr URLs to $NEW_VER"
80+
git commit -n -m "Bumped versions in jsDelivr URLs to $new_ver"
8181
git add ./*greasemonkey-starter.user.js
82-
git commit -n -m "Bumped chatgpt.js to $NEW_VER"
82+
git commit -n -m "Bumped chatgpt.js to $new_ver"
8383

8484
# Build chatgpt.min.js to dist/
8585
echo -e "${BY}\nBuilding chatgpt.min.js...\n${NC}"
8686
bash utils/build.sh
8787

8888
# Update jsDelivr URLs for GitHub assets w/ commit hash
8989
echo -e "${BY}\nUpdating jsDelivr URLs for GitHub assets w/ commit hash...${NC}"
90-
BUMP_HASH=$(git rev-parse HEAD)
90+
bump_hash=$(git rev-parse HEAD)
9191
old_file=$(<dist/chatgpt.min.js)
92-
sed -i -E "s|(cdn\.jsdelivr\.net\/gh\/[^/]+\/[^@/\"']+)[^/\"']*|\1@$BUMP_HASH|g" dist/chatgpt.min.js
92+
sed -i -E "s|(cdn\.jsdelivr\.net\/gh\/[^/]+\/[^@/\"']+)[^/\"']*|\1@$bump_hash|g" dist/chatgpt.min.js
9393
new_file=$(<dist/chatgpt.min.js)
9494
if [[ "$old_file" != "$new_file" ]]
95-
then echo -e "${BW}$BUMP_HASH${NC}"
95+
then echo -e "${BW}$bump_hash${NC}"
9696
else echo "No jsDelivr URLs for GH assets found in built files"
9797
fi
9898

9999
# Commit build to Git
100100
echo -e "${BY}\nCommitting build to Git...\n${NC}"
101101
git add ./**/chatgpt.min.js
102-
git commit -n -m "Built chatgpt.js $NEW_VER"
102+
git commit -n -m "Built chatgpt.js $new_ver"
103103

104104
# Push to GiHub
105105
echo -e "${BY}\nPushing to GitHub...\n${NC}"
@@ -114,4 +114,4 @@ echo -e "${BY}\nRestoring original Git config...\n${NC}"
114114
while IFS='=' read -r key val ; do git config --global "$key" "$val" ; done < ~/.gitconfig.backup
115115

116116
# Print final summary
117-
echo -e "\n${BG}Successfully bumped to v$NEW_VER$([[ "$*" == *"--publish"* ]] && echo ' and published to npm')!${NC}"
117+
echo -e "\n${BG}Successfully bumped to v$new_ver$([[ "$*" == *"--publish"* ]] && echo ' and published to npm')!${NC}"

0 commit comments

Comments
 (0)