Skip to content

Commit

Permalink
Add script to upgrade htmx
Browse files Browse the repository at this point in the history
  • Loading branch information
Piszmog committed May 8, 2024
1 parent 7463def commit 617a142
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/core/html.templ
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ templ head(title string) {
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Hello world"/>
<title>{ title }</title>
<script src="/assets/js/[email protected].10.min.js"></script>
<script src="/assets/js/[email protected].12.min.js"></script>
<link href={ "/assets/css/output@" + version.Value + ".css" } rel="stylesheet"/>
</head>
}
Expand Down
1 change: 0 additions & 1 deletion dist/assets/js/[email protected]

This file was deleted.

1 change: 1 addition & 0 deletions dist/assets/js/[email protected]

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions upgrade_htmx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

if [ "$#" -ne 1 ]; then
echo "Usage: $0 <new htmx version>"
exit 1
fi

old_version=""
new_version=$1

for filename in "./dist/assets/js"/*; do
if [[ "$filename" == "./dist/assets/js/htmx"* ]]; then
old_version=$(echo "$filename" | awk -F'@' '{gsub(/\.min\.js/, "", $2); print $2}')
break
fi
done

curl -sL -o "./dist/assets/js/htmx@${new_version}.min.js" "https://github.com/bigskysoftware/htmx/releases/download/${new_version}/htmx.min.js"

sed -i '' -e "s/${old_version}/${new_version}/g" "./components/core/html.templ"

rm "./dist/assets/js/htmx@${old_version}.min.js"

0 comments on commit 617a142

Please sign in to comment.