feat: add JS toolchain — esbuild, TypeScript, Vitest

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Mühl 2026-04-08 13:11:26 +02:00
parent 5c26d205f7
commit 032b6f87ff
No known key found for this signature in database
GPG key ID: 925AC7D69955293F
8 changed files with 2757 additions and 0 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ vendor/
result result
*.js.map *.js.map
dist/ dist/
.phpunit.result.cache

View file

@ -0,0 +1 @@
"use strict";var KimaiHeatmap=(()=>{var e=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(i,n)=>{for(var t in n)e(i,t,{get:n[t],enumerable:!0})},H=(i,n,t,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of c(n))!m.call(i,o)&&o!==t&&e(i,o,{get:()=>n[o],enumerable:!(l=a(n,o))||l.enumerable});return i};var d=i=>H(e({},"__esModule",{value:!0}),i);var g={};p(g,{init:()=>f});function f(i){console.log("Heatmap init",i)}return d(g);})();

3
assets/src/heatmap.ts Normal file
View file

@ -0,0 +1,3 @@
export function init(container: HTMLElement): void {
console.log('Heatmap init', container);
}

View file

@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('heatmap', () => {
it('placeholder', () => {
expect(true).toBe(true);
});
});

2694
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

32
package.json Normal file
View file

@ -0,0 +1,32 @@
{
"name": "kimai-heatmap-bundle",
"private": true,
"type": "module",
"scripts": {
"build": "esbuild assets/src/heatmap.ts --bundle --outfile=Resources/public/heatmap.js --format=iife --global-name=KimaiHeatmap --minify",
"build:dev": "esbuild assets/src/heatmap.ts --bundle --outfile=Resources/public/heatmap.js --format=iife --global-name=KimaiHeatmap --sourcemap",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"d3-array": "^3.2.4",
"d3-scale": "^4.0.2",
"d3-scale-chromatic": "^3.1.0",
"d3-selection": "^3.0.0",
"d3-time": "^3.1.0",
"d3-time-format": "^4.1.0"
},
"devDependencies": {
"@types/d3-array": "^3.2.2",
"@types/d3-scale": "^4.0.9",
"@types/d3-scale-chromatic": "^3.1.0",
"@types/d3-selection": "^3.0.11",
"@types/d3-time": "^3.0.4",
"@types/d3-time-format": "^4.0.3",
"@vitest/coverage-v8": "^4.1.3",
"esbuild": "^0.28.0",
"jsdom": "^29.0.2",
"typescript": "^6.0.2",
"vitest": "^4.1.3"
}
}

11
tsconfig.json Normal file
View file

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"types": ["vitest/globals"]
},
"include": ["assets/src/**/*.ts", "assets/test/**/*.ts"]
}

8
vitest.config.ts Normal file
View file

@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'jsdom',
globals: true,
},
});