diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..3932801 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run format diff --git a/package-lock.json b/package-lock.json index 2e35d51..c4e8777 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@sveltejs/kit": "^2.5.2", "@sveltejs/vite-plugin-svelte": "^3.0.2", "autoprefixer": "^10.4.19", + "husky": "^9.0.11", "postcss": "^8.4.38", "prettier": "^3.2.5", "prettier-plugin-svelte": "^3.2.3", @@ -1528,6 +1529,21 @@ "node": ">= 0.4" } }, + "node_modules/husky": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "dev": true, + "bin": { + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", diff --git a/package.json b/package.json index 1e7228d..d95276e 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,15 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --check .", - "format": "prettier --write ." + "format": "prettier --write .", + "prepare": "husky" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.1.1", "@sveltejs/kit": "^2.5.2", "@sveltejs/vite-plugin-svelte": "^3.0.2", "autoprefixer": "^10.4.19", + "husky": "^9.0.11", "postcss": "^8.4.38", "prettier": "^3.2.5", "prettier-plugin-svelte": "^3.2.3", diff --git a/src/routes/timer/+page.svelte b/src/routes/timer/+page.svelte index 17accc7..3fae3ff 100644 --- a/src/routes/timer/+page.svelte +++ b/src/routes/timer/+page.svelte @@ -15,9 +15,9 @@ import { writable } from "svelte/store" import type { Writable } from "svelte/store" - const MINI_BREAK_DURATION = 20 * 60 * 1000; // 20 minutes + const MINI_BREAK_DURATION = 20 * 60 * 1000 // 20 minutes const MINI_BREAK_INTERVAL = 20 * 1000 // 20 seconds - const LONG_BREAK_DURATION = 5 * 60 * 1000; // 5 minutes + const LONG_BREAK_DURATION = 5 * 60 * 1000 // 5 minutes let timer: number | null = null let miniBreakCount = 0 @@ -26,20 +26,20 @@ const playSound = () => { if (audio) { - audio.pause(); + audio.pause() audio.src = "/sounds/Bells.mp3" audio.volume = 0.4 - audio.play(); + audio.play() } } const showNotification = (title: string, options: NotificationOptions) => { if (Notification.permission === "granted") { - new Notification(title, options); + new Notification(title, options) } else if (Notification.permission !== "denied") { Notification.requestPermission().then((permission) => { if (permission === "granted") { - new Notification(title, options); + new Notification(title, options) } }) }