diff --git a/.gitignore b/.gitignore index 51266c8..6627466 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ .parcel-cache/ ec*.exe + +# public (build) +public/content/ +public/index.* +public/manifest.webmanifest +public/*.png diff --git a/app/partitial/footer.html b/app/partitial/footer.html index e9d0fb2..414043b 100644 --- a/app/partitial/footer.html +++ b/app/partitial/footer.html @@ -1,11 +1,11 @@ diff --git a/clean_public.sh b/clean_public.sh new file mode 100755 index 0000000..e33de63 --- /dev/null +++ b/clean_public.sh @@ -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!" diff --git a/package.json b/package.json index be8d172..885c139 100644 --- a/package.json +++ b/package.json @@ -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 ", diff --git a/public/.gitignore b/public/.gitignore deleted file mode 100644 index a82bd78..0000000 --- a/public/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -index.* -manifest.webmanifest -*.png diff --git a/update_commit.sh b/update_commit.sh new file mode 100755 index 0000000..d178855 --- /dev/null +++ b/update_commit.sh @@ -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 +