update hash string script
This commit is contained in:
parent
97af1107ac
commit
16421f0023
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,2 +1,8 @@
|
||||
.parcel-cache/
|
||||
ec*.exe
|
||||
|
||||
# public (build)
|
||||
public/content/
|
||||
public/index.*
|
||||
public/manifest.webmanifest
|
||||
public/*.png
|
||||
|
@ -1,11 +1,11 @@
|
||||
<footer class="text-center text-shadow mt-3 text-white-50">
|
||||
<p class="font-monospace">
|
||||
build:
|
||||
commit:
|
||||
<a
|
||||
class="text-reset text-decoration-none border-bottom py-1"
|
||||
href="#"
|
||||
href="https://git.a2s.su/iiiypuk/a2s.su"
|
||||
target="_blank"
|
||||
>ab6324f</a
|
||||
>{GIT_COMMIT_HASH}</a
|
||||
>
|
||||
</p>
|
||||
</footer>
|
||||
|
17
clean_public.sh
Executable file
17
clean_public.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
files=(
|
||||
"manifest.webmanifest"
|
||||
"index.html"
|
||||
"*.css*"
|
||||
"*.png"
|
||||
)
|
||||
|
||||
echo -n "Remove all build files in 'public'... "
|
||||
|
||||
for file in "${files[@]}"
|
||||
do
|
||||
rm ./public/$file &> /dev/null
|
||||
done
|
||||
|
||||
echo "Complete!"
|
@ -7,6 +7,8 @@
|
||||
"serve": "npx parcel serve --dist-dir public app/index.html",
|
||||
"build": "npx parcel build --dist-dir public app/index.html --no-optimize",
|
||||
"prettier": "npx prettier --write .",
|
||||
"git-hash": "./update_commit.sh",
|
||||
"clean": "./clean_public.sh",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Alexander Popov <iiiypuk@fastmail.fm>",
|
||||
|
3
public/.gitignore
vendored
3
public/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
index.*
|
||||
manifest.webmanifest
|
||||
*.png
|
12
update_commit.sh
Executable file
12
update_commit.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f "./public/index.html" ]; then
|
||||
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
|
||||
echo -n "Update git commit hash in 'index.html' "
|
||||
sed -i -- "s/{GIT_COMMIT_HASH}/$GIT_COMMIT_HASH/g" ./public/index.html
|
||||
echo " Complete!"
|
||||
else
|
||||
echo "Run 'npm run build'"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user