update deps to current state of module template; update runtime to node22

This commit is contained in:
2025-06-06 17:15:26 +02:00
parent 2f9fa1cb0b
commit 34a2814c19
7 changed files with 3375 additions and 2167 deletions

1
.husky/pre-commit Normal file
View File

@@ -0,0 +1 @@
lint-staged

View File

@@ -74,3 +74,8 @@ Presets are available for **Start Timer** and **Stop Timer**.
### Version 2.1.1 ### Version 2.1.1
- Prevent module crash if user has no Clients - Prevent module crash if user has no Clients
### Version 2.1.2
- Update node runtime to node22
- make polling interval configurable as toggl is updating their [API usage limits](https://support.toggl.com/en/articles/11484112-api-webhook-limits)

View File

@@ -17,7 +17,7 @@
], ],
"legacyIds": [], "legacyIds": [],
"runtime": { "runtime": {
"type": "node18", "type": "node22",
"api": "nodejs-ipc", "api": "nodejs-ipc",
"apiVersion": "0.0.0", "apiVersion": "0.0.0",
"entrypoint": "../dist/main.js" "entrypoint": "../dist/main.js"

View File

@@ -4,6 +4,7 @@
"main": "dist/main.js", "main": "dist/main.js",
"type": "module", "type": "module",
"scripts": { "scripts": {
"postinstall": "husky",
"format": "prettier -w .", "format": "prettier -w .",
"package": "yarn run build && companion-module-build", "package": "yarn run build && companion-module-build",
"build": "rimraf dist && yarn run build:main", "build": "rimraf dist && yarn run build:main",
@@ -17,19 +18,26 @@
"type": "git", "type": "git",
"url": "git+https://github.com/bitfocus/companion-module-toggl-track.git" "url": "git+https://github.com/bitfocus/companion-module-toggl-track.git"
}, },
"engines": {
"node": "^22.14",
"yarn": "^4"
},
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@companion-module/base": "~1.11", "@companion-module/base": "~1.11.3",
"toggl-track": "^0.8.0" "toggl-track": "^0.8.0"
}, },
"devDependencies": { "devDependencies": {
"@companion-module/tools": "~2.1.1", "@companion-module/tools": "~2.3.0",
"@types/node": "^22.10.2", "@types/node": "^22.14.1",
"eslint": "^9.17.0", "@types/ws": "^8",
"prettier": "^3.4.2", "eslint": "^9.24.0",
"rimraf": "^5.0.10", "husky": "^9.1.7",
"typescript": "~5.5.4", "lint-staged": "^15.5.1",
"typescript-eslint": "^8.18.1" "prettier": "^3.5.3",
"rimraf": "^6.0.1",
"typescript": "~5.8.3",
"typescript-eslint": "^8.30.1"
}, },
"prettier": "@companion-module/tools/.prettierrc.json", "prettier": "@companion-module/tools/.prettierrc.json",
"lint-staged": { "lint-staged": {
@@ -39,5 +47,6 @@
"*.{ts,tsx,js,jsx}": [ "*.{ts,tsx,js,jsx}": [
"yarn lint:raw --fix" "yarn lint:raw --fix"
] ]
} },
"packageManager": "yarn@4.9.1"
} }

View File

@@ -5,6 +5,7 @@ export interface ModuleConfig {
workspaceName: string workspaceName: string
alwaysStart: boolean alwaysStart: boolean
startTimerPoller: boolean startTimerPoller: boolean
timerPollerInterval: number
} }
export function GetConfigFields(): SomeCompanionConfigField[] { export function GetConfigFields(): SomeCompanionConfigField[] {
@@ -36,9 +37,18 @@ export function GetConfigFields(): SomeCompanionConfigField[] {
{ {
type: 'checkbox', type: 'checkbox',
id: 'startTimerPoller', id: 'startTimerPoller',
label: 'Poll for current time entry every 30 seconds', label: 'Poll for current time entry every n seconds',
width: 12, width: 12,
default: false, default: false,
}, },
{
type: 'number',
id: 'timerPollerInterval',
label: 'Poll interval in seconds',
width: 12,
default: 60,
min: 30,
max: 3600,
},
] ]
} }

View File

@@ -146,7 +146,7 @@ export class TogglTrack extends InstanceBase<ModuleConfig> {
void (async () => { void (async () => {
await this.getCurrentTimer() await this.getCurrentTimer()
})() })()
}, 30 * 1000) }, this.config.timerPollerInterval * 1000)
} }
private stopTimeEntryPoller(): void { private stopTimeEntryPoller(): void {
this.log('info', 'Stopping TimeEntry-Poller') this.log('info', 'Stopping TimeEntry-Poller')

5493
yarn.lock

File diff suppressed because it is too large Load Diff