Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions apps/watcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
FROM node:22-slim AS build

FROM node:22-slim AS base
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
WORKDIR /app

# Copy monorepo root files
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc* ./

# Copy workspace package manifests
COPY apps/watcher/package.json ./apps/watcher/
COPY packages/shared/package.json ./packages/shared/
COPY packages/backend/package.json ./packages/backend/
# Prune monorepo to only watcher's dependencies
FROM base AS pruner
COPY . .
RUN pnpm dlx turbo prune @clawe/watcher --docker

# Install pnpm and fetch dependencies
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install dependencies (cached unless package.json/lockfile changes)
FROM base AS deps
COPY --from=pruner /app/out/json/ .
RUN pnpm install --frozen-lockfile

# Copy source and build
COPY packages/shared/ ./packages/shared/
COPY packages/backend/ ./packages/backend/
COPY apps/watcher/ ./apps/watcher/
# Build the app
FROM base AS builder
COPY --from=deps /app/ .
COPY --from=pruner /app/out/full/ .
RUN pnpm build --filter=@clawe/watcher

# Deploy: extract watcher with all production deps into /app/deploy
# Extract watcher with production deps only
RUN pnpm --filter=@clawe/watcher --prod deploy deploy

# --- Production image ---
# Production runner
FROM node:22-slim

WORKDIR /app

COPY --from=build /app/deploy .

ENV NODE_ENV=production

COPY --from=builder /app/deploy .

CMD ["node", "dist/index.js"]
4 changes: 4 additions & 0 deletions apps/watcher/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { nodeConfig } from "@clawe/eslint-config/node";

/** @type {import("eslint").Linter.Config} */
export default nodeConfig;
7 changes: 7 additions & 0 deletions apps/watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"version": "0.1.0",
"private": true,
"type": "module",
"files": [
"dist"
],
"scripts": {
"dev": "tsx watch src/index.ts",
"start": "node dist/index.js",
"build": "tsc",
"lint": "eslint . --max-warnings 0",
"lint:fix": "eslint . --fix --max-warnings 0",
"check-types": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
Expand All @@ -17,7 +22,9 @@
"convex": "^1.21.0"
},
"devDependencies": {
"@clawe/eslint-config": "workspace:*",
"@clawe/typescript-config": "workspace:*",
"eslint": "^9.39.1",
"@types/node": "^22.0.0",
"tsx": "^4.19.0",
"typescript": "5.9.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.1.0",
"private": true,
"type": "module",
"files": [
"convex"
],
"exports": {
".": {
"types": "./convex/_generated/api.d.ts",
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-config/node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import globals from "globals";
import nodePlugin from "eslint-plugin-n";
import { config as baseConfig } from "./base.js";

/**
Expand All @@ -9,11 +10,15 @@ import { config as baseConfig } from "./base.js";
export const nodeConfig = [
...baseConfig,
{
plugins: { n: nodePlugin },
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
"n/file-extension-in-import": ["error", "always"],
},
},
{
ignores: ["dist/**"],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@next/eslint-plugin-next": "^15.5.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-n": "^17.24.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.1.0",
"private": true,
"type": "module",
"files": [
"dist"
],
"exports": {
"./squadhub": {
"types": "./dist/squadhub/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/squadhub/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
GatewayHealthResult,
TelegramProbeResult,
PairingRequest,
} from "./types";
} from "./types.js";

export type SquadhubConnection = {
squadhubUrl: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/squadhub/gateway-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
ConnectParams,
HelloOkResponse,
ChatEvent,
} from "./gateway-types";
} from "./gateway-types.js";

type PendingRequest = {
resolve: (value: unknown) => void;
Expand Down
14 changes: 7 additions & 7 deletions packages/shared/src/squadhub/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export {
listPairingRequests,
approvePairingCode,
parseToolText,
} from "./client";
} from "./client.js";
export type {
SquadhubConnection,
CronJob,
Expand All @@ -27,12 +27,12 @@ export type {
CronDelivery,
CronPayload,
CronJobState,
} from "./client";
} from "./client.js";

// Gateway Client
export { GatewayClient, createGatewayClient } from "./gateway-client";
export type { GatewayClientOptions } from "./gateway-client";
export { getSharedClient } from "./shared-client";
export { GatewayClient, createGatewayClient } from "./gateway-client.js";
export type { GatewayClientOptions } from "./gateway-client.js";
export { getSharedClient } from "./shared-client.js";

// Types
export type {
Expand All @@ -46,7 +46,7 @@ export type {
GatewayHealthResult,
TelegramProbeResult,
PairingRequest,
} from "./types";
} from "./types.js";

// Gateway Types
export type {
Expand Down Expand Up @@ -75,4 +75,4 @@ export type {
ChatHistoryResponse,
SSEEventType,
SSEEvent,
} from "./gateway-types";
} from "./gateway-types.js";
6 changes: 3 additions & 3 deletions packages/shared/src/squadhub/shared-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GatewayClient, createGatewayClient } from "./gateway-client";
import type { GatewayClientOptions } from "./gateway-client";
import type { SquadhubConnection } from "./client";
import { GatewayClient, createGatewayClient } from "./gateway-client.js";
import type { GatewayClientOptions } from "./gateway-client.js";
import type { SquadhubConnection } from "./client.js";

let sharedClient: GatewayClient | null = null;
let connectingPromise: Promise<void> | null = null;
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "@clawe/typescript-config/base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["node"],
"rootDir": "./src",
"outDir": "./dist",
Expand Down
76 changes: 76 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.