diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 45c6eed..ba240e7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - node-version: [22] + node-version: [24] steps: - name: Checkout code @@ -36,9 +36,6 @@ jobs: - name: Install dependencies run: pnpm install - - name: Build project - run: pnpm run build - - name: Run tests env: LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }} @@ -62,7 +59,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 - name: Install dependencies run: pnpm install diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.nvmrc b/.nvmrc index 89b93fd..a45fd52 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.18.0 \ No newline at end of file +24 diff --git a/Dockerfile b/Dockerfile index 558e75f..2ba1918 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # syntax=docker/dockerfile:1 -# Use the official Node.js v22 base image +# Use the official Node.js v24 base image # We use the slim variant to keep the image size smaller while still having essential tools -ARG NODE_VERSION=22 +ARG NODE_VERSION=24 FROM node:${NODE_VERSION}-slim AS base # Configure pnpm installation directory and ensure it is on PATH @@ -45,10 +45,6 @@ RUN npx livekit-agents download-files # (Excludes files specified in .dockerignore) COPY . . -# Build the project -# Your package.json must contain a "build" script, such as `"build": "tsc"` -RUN pnpm build - # Remove dev dependencies for a leaner production image RUN pnpm prune --prod @@ -79,5 +75,5 @@ ENV NODE_ENV=production # Run the application # The "start" command tells the worker to connect to LiveKit and begin waiting for jobs. -# Your package.json must contain a "start" script, such as `"start": "node dist/agent.js start"` +# Your package.json must contain a "start" script, such as `"start": "node src/main.ts start"` CMD [ "pnpm", "start" ] \ No newline at end of file diff --git a/package.json b/package.json index 28dd2fd..f0efd02 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,6 @@ "private": true, "type": "module", "scripts": { - "build": "vite build", - "clean": "rm -rf dist", "typecheck": "tsc --noEmit", "lint": "eslint \"**/*.{ts,js}\"", "lint:fix": "eslint --fix \"**/*.{ts,js}\"", @@ -13,23 +11,22 @@ "format:check": "prettier --check \"**/*.{ts,js,json,md}\"", "test": "vitest --run", "test:watch": "vitest", - "dev": "pnpm run build && node dist/main.js dev", - "start": "node dist/main.js start" + "dev": "node src/main.ts dev", + "start": "node src/main.ts start" }, "engines": { - "node": ">=22.0.0", + "node": ">=24.0.0", "pnpm": ">=10.0.0" }, "devDependencies": { "@eslint/js": "^9.39.4", "@trivago/prettier-plugin-sort-imports": "^5.2.2", - "@types/node": "^22.19.17", + "@types/node": "^24.10.1", "eslint": "^9.39.4", "globals": "^16.5.0", "jiti": "^2.6.1", "typescript": "^5.9.3", "typescript-eslint": "^8.58.1", - "vite": "^7.3.2", "vitest": "^4.1.4" }, "dependencies": { diff --git a/src/agent.test.ts b/src/agent.test.ts index 46de9fa..6cd2dc1 100644 --- a/src/agent.test.ts +++ b/src/agent.test.ts @@ -1,7 +1,7 @@ import { dedent, inference, initializeLogger, voice } from '@livekit/agents'; import dotenv from 'dotenv'; import { afterEach, beforeEach, describe, it } from 'vitest'; -import { Agent } from './agent'; +import { Agent } from './agent.ts'; dotenv.config({ path: '.env.local' }); diff --git a/src/main.ts b/src/main.ts index 664a6fe..844b877 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { ServerOptions, cli, defineAgent, inference, voice } from '@livekit/agen import { audioEnhancement } from '@livekit/plugins-ai-coustics'; import dotenv from 'dotenv'; import { fileURLToPath } from 'node:url'; -import { Agent } from './agent'; +import { Agent } from './agent.ts'; // Load environment variables from a local file. // Make sure to set LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET diff --git a/tsconfig.json b/tsconfig.json index 59a1665..23674e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "include": ["./src/**/*"], - "exclude": ["./dist", "./node_modules", "**/*.test.ts", "**/*.spec.ts"], + "exclude": ["./node_modules", "**/*.test.ts", "**/*.spec.ts"], "compilerOptions": { "target": "ES2022", "module": "ES2022", @@ -18,12 +18,13 @@ "forceConsistentCasingInFileNames": true, "isolatedModules": true, "verbatimModuleSyntax": true, - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "rootDir": "./src", - "outDir": "./dist", - "incremental": true, - "tsBuildInfoFile": "./dist/.tsbuildinfo" + // Node strips types at runtime; tsc is used only for type checking. + // `allowImportingTsExtensions` permits the explicit `.ts` import + // specifiers that Node's native type stripping requires, and + // `erasableSyntaxOnly` rejects TS-only syntax (enums, namespaces, + // parameter properties) that Node cannot strip without transformation. + "noEmit": true, + "allowImportingTsExtensions": true, + "erasableSyntaxOnly": true } } diff --git a/vite.config.ts b/vite.config.ts deleted file mode 100644 index 7aa09a0..0000000 --- a/vite.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vite'; - -export default defineConfig({ - build: { - ssr: 'src/main.ts', // marks entry as Node - target: 'node18', - sourcemap: true, - outDir: 'dist', - rollupOptions: { - output: { - entryFileNames: 'main.js', - }, - }, - }, -});