This commit is contained in:
cpu
2025-05-09 17:40:25 +02:00
parent 0e409c403d
commit 38105ce41d
3 changed files with 37 additions and 37 deletions

View File

@@ -125,8 +125,40 @@ For an enhanced tactile experience, Nexus Timer supports Smart Buttons based on
"theme": "dark" "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 ## Building for the production
Navigate to the projects' directory on the server ### On the Server
Navigate to the service directory on the server
```bash ```bash
cd /virt cd /virt
``` ```
@@ -177,40 +209,8 @@ curl https://nexus-timer.virtonline.eu
Or open it in your browser: Or open it in your browser:
[https://nexus-timer.virtonline.eu](https://nexus-timer.virtonline.eu) [https://nexus-timer.virtonline.eu](https://nexus-timer.virtonline.eu)
## Developer Setup ## Release the update
### On the Server
### 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
Navigate to the app directory on your server Navigate to the app directory on your server
```bash ```bash
cd /virt/nexus-timer cd /virt/nexus-timer

View File

@@ -1,4 +1,4 @@
const CACHE_VERSION = 'nexus-timer-cache-v8'; const CACHE_VERSION = 'nexus-timer-cache-v9';
const APP_SHELL_URLS = [ const APP_SHELL_URLS = [
// '/', // Let NetworkFirst handle '/' // '/', // Let NetworkFirst handle '/'
'/manifest.json', '/manifest.json',

View File

@@ -59,7 +59,7 @@ const store = useStore();
// The hook should search for the string "__BUILD_TIME__" (including quotes if you prefer) // The hook should search for the string "__BUILD_TIME__" (including quotes if you prefer)
// and replace it with the actual build timestamp. // and replace it with the actual build timestamp.
// For display, we'll use a ref. // 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");` // 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. // 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");` // Or, if it replaces only the string content: `const buildTime = ref("Actual Build Time");`