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
- 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": [],
"runtime": {
"type": "node18",
"type": "node22",
"api": "nodejs-ipc",
"apiVersion": "0.0.0",
"entrypoint": "../dist/main.js"

View File

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

View File

@@ -5,6 +5,7 @@ export interface ModuleConfig {
workspaceName: string
alwaysStart: boolean
startTimerPoller: boolean
timerPollerInterval: number
}
export function GetConfigFields(): SomeCompanionConfigField[] {
@@ -36,9 +37,18 @@ export function GetConfigFields(): SomeCompanionConfigField[] {
{
type: 'checkbox',
id: 'startTimerPoller',
label: 'Poll for current time entry every 30 seconds',
label: 'Poll for current time entry every n seconds',
width: 12,
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 () => {
await this.getCurrentTimer()
})()
}, 30 * 1000)
}, this.config.timerPollerInterval * 1000)
}
private stopTimeEntryPoller(): void {
this.log('info', 'Stopping TimeEntry-Poller')

5493
yarn.lock

File diff suppressed because it is too large Load Diff