diff --git a/README.md b/README.md index 10dc8cf..940e8f6 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,40 @@ For an enhanced tactile experience, Nexus Timer supports Smart Buttons based on "theme": "dark" } ``` +## Developer Setup +### Clone the repository +```bash +git clone https://gitea.virtonline.eu/2HoursProject/nexus-timer.git +cd nexus-timer +``` +Run the live update server locally +```bash +npm run dev +``` +### Modify the app +Make code changes... +### Test the PWA locally +Open it in your browser: +[http://localhost:8080/](http://localhost:8080/) +### Git Pre-Commit Hook +This project uses a Git pre-commit hook to automatically updates the build timestamp placeholder in `src/views/InfoView.vue` and increments the `CACHE_VERSION` in `public/service-worker.js` (it is the indicator for the installed PWA that the new version is available). This ensures that each commit intended for a build/deployment reflects the correct information. + +#### Configure Git to use the local hooks directory +Tell the Git to use the hooks located in the `.githooks` directory: +```bash +git config core.hooksPath .githooks +``` +This step needs to be done once per local clone of the repository. The script `scripts/git-hooks/pre-commit.cjs` will be executed before every commit. +### Commit & Push +Stage changes, commit and push +```bash +git add . +git commit -m 'fixed visuals' +git push +``` ## Building for the production -Navigate to the projects' directory on the server +### On the Server +Navigate to the service directory on the server ```bash cd /virt ``` @@ -177,40 +209,8 @@ curl https://nexus-timer.virtonline.eu Or open it in your browser: [https://nexus-timer.virtonline.eu](https://nexus-timer.virtonline.eu) -## Developer Setup - -### Clone the repository -```bash -git clone https://gitea.virtonline.eu/2HoursProject/nexus-timer.git -cd nexus-timer -``` -### Git Pre-Commit Hook -This project uses a Git pre-commit hook to automatically updates the build timestamp placeholder in `src/views/InfoView.vue` and increments the `CACHE_VERSION` in `public/service-worker.js` (it is the indicator for the installed PWA that the new version is available). This ensures that each commit intended for a build/deployment reflects the correct information. - -#### Configure Git to use the local hooks directory -After cloning the repository, run the following command in your terminal from the project root to tell Git to use the hooks located in the `.githooks` directory: -```bash -git config core.hooksPath .githooks -``` -This step needs to be done once per local clone of the repository. The script `scripts/git-hooks/pre-commit.cjs` will be executed before every commit. -### Modify the app -Make code changes... - -Run the live update server locally -```bash -npm run dev -``` -#### Test the PWA locally -Open it in your browser: -[http://localhost:8080/](http://localhost:8080/) - -Stage changes, commit and push -```bash -git add . -git commit -m 'fixed visuals' -git push -``` -### Release the update +## Release the update +### On the Server Navigate to the app directory on your server ```bash cd /virt/nexus-timer diff --git a/public/service-worker.js b/public/service-worker.js index fce1d8b..2510c36 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,4 +1,4 @@ -const CACHE_VERSION = 'nexus-timer-cache-v8'; +const CACHE_VERSION = 'nexus-timer-cache-v9'; const APP_SHELL_URLS = [ // '/', // Let NetworkFirst handle '/' '/manifest.json', diff --git a/src/views/InfoView.vue b/src/views/InfoView.vue index 7156141..a828021 100644 --- a/src/views/InfoView.vue +++ b/src/views/InfoView.vue @@ -59,7 +59,7 @@ const store = useStore(); // The hook should search for the string "__BUILD_TIME__" (including quotes if you prefer) // and replace it with the actual build timestamp. // For display, we'll use a ref. -const buildTime = ref("2025-05-09 16:57:06"); +const buildTime = ref("2025-05-09 17:40:26"); // If your hook replaces the entire line `const buildTime = ref("2025-05-09 17:10:59");` // with `const buildTime = ref("YYYY-MM-DD HH:MM:SS");`, that's also fine. // Or, if it replaces only the string content: `const buildTime = ref("Actual Build Time");`