This commit is contained in:
cpu
2025-05-09 17:10:59 +02:00
parent e6f7c87ea4
commit 0e409c403d
3 changed files with 34 additions and 41 deletions

View File

@@ -186,20 +186,13 @@ 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.
**Setup Steps:**
1. **Ensure Node.js is installed.** The hook script is written in Node.js.
2. **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.
3. **Ensure the hook script is executable:**
The script `scripts/git-hooks/pre-commit.js` is the source, and it's copied/symlinked to `.githooks/pre-commit`. If you manually copy or if permissions are lost, ensure the hook in `.githooks` is executable:
```bash
chmod +x .githooks/pre-commit
```
(The main script in `scripts/git-hooks/` should also be executable if you plan to run it manually for testing: `chmod +x scripts/git-hooks/pre-commit.js`)
#### 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...