From 6c19eb6d469c48d8bc60fa7d2c550c6ff60344e3 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Thu, 14 Nov 2024 14:58:58 -0500 Subject: [PATCH] use js suffix --- apps/pty-proxy/eslint.config.js | 5 +++-- apps/pty-proxy/src/auth.ts | 2 +- apps/pty-proxy/src/controller/agent-socket.ts | 2 +- apps/pty-proxy/src/controller/index.ts | 6 +++--- apps/pty-proxy/src/controller/sockets.ts | 4 ++-- apps/pty-proxy/src/controller/user-socket.ts | 8 ++++---- apps/pty-proxy/src/index.ts | 6 +++--- apps/pty-proxy/src/routing.ts | 4 ++-- apps/pty-proxy/src/session-auditor.ts | 2 +- apps/pty-proxy/src/sessions/index.ts | 2 +- 10 files changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/pty-proxy/eslint.config.js b/apps/pty-proxy/eslint.config.js index dba3e6994..722b511a9 100644 --- a/apps/pty-proxy/eslint.config.js +++ b/apps/pty-proxy/eslint.config.js @@ -1,9 +1,10 @@ -import baseConfig from "@ctrlplane/eslint-config/base"; +import baseConfig, { requireJsSuffix } from "@ctrlplane/eslint-config/base"; /** @type {import('typescript-eslint').Config} */ export default [ { - ignores: [".nitro/**", ".output/**"], + ignores: [".nitro/**", ".output/**", "dist/**", "node_modules/**"], }, + ...requireJsSuffix, ...baseConfig, ]; diff --git a/apps/pty-proxy/src/auth.ts b/apps/pty-proxy/src/auth.ts index 2cfff33d5..90dd1d89a 100644 --- a/apps/pty-proxy/src/auth.ts +++ b/apps/pty-proxy/src/auth.ts @@ -1,7 +1,7 @@ import type { IncomingMessage } from "http"; import type { Session } from "next-auth"; -import { env } from "./config"; +import { env } from "./config.js"; export const getSession = async (req: IncomingMessage) => { const options: RequestInit = { diff --git a/apps/pty-proxy/src/controller/agent-socket.ts b/apps/pty-proxy/src/controller/agent-socket.ts index 81b15a69a..50e86e96b 100644 --- a/apps/pty-proxy/src/controller/agent-socket.ts +++ b/apps/pty-proxy/src/controller/agent-socket.ts @@ -16,7 +16,7 @@ import { upsertResources } from "@ctrlplane/job-dispatch"; import { logger } from "@ctrlplane/logger"; import { agentConnect, agentHeartbeat } from "@ctrlplane/validators/session"; -import { ifMessage } from "./utils"; +import { ifMessage } from "./utils.js"; export class AgentSocket { static async from(socket: WebSocket, request: IncomingMessage) { diff --git a/apps/pty-proxy/src/controller/index.ts b/apps/pty-proxy/src/controller/index.ts index 5cac342ff..06c3171c5 100644 --- a/apps/pty-proxy/src/controller/index.ts +++ b/apps/pty-proxy/src/controller/index.ts @@ -5,9 +5,9 @@ import { WebSocketServer } from "ws"; import { logger } from "@ctrlplane/logger"; -import { AgentSocket } from "./agent-socket"; -import { agents, users } from "./sockets"; -import { UserSocket } from "./user-socket"; +import { AgentSocket } from "./agent-socket.js"; +import { agents, users } from "./sockets.js"; +import { UserSocket } from "./user-socket.js"; const onConnect = async (ws: WebSocket, request: IncomingMessage) => { const agent = await AgentSocket.from(ws, request); diff --git a/apps/pty-proxy/src/controller/sockets.ts b/apps/pty-proxy/src/controller/sockets.ts index 1b0b73403..ef88047a9 100644 --- a/apps/pty-proxy/src/controller/sockets.ts +++ b/apps/pty-proxy/src/controller/sockets.ts @@ -1,5 +1,5 @@ -import type { AgentSocket } from "./agent-socket"; -import type { UserSocket } from "./user-socket"; +import type { AgentSocket } from "./agent-socket.js"; +import type { UserSocket } from "./user-socket.js"; export const agents = new Map(); export const users = new Map(); diff --git a/apps/pty-proxy/src/controller/user-socket.ts b/apps/pty-proxy/src/controller/user-socket.ts index e6a147b82..677522cda 100644 --- a/apps/pty-proxy/src/controller/user-socket.ts +++ b/apps/pty-proxy/src/controller/user-socket.ts @@ -1,13 +1,13 @@ import type { IncomingMessage } from "node:http"; import type WebSocket from "ws"; -import { createSessionSocket } from "@/sessions"; import { logger } from "@ctrlplane/logger"; import { sessionCreate, sessionResize } from "@ctrlplane/validators/session"; -import { getSession } from "../auth"; -import { agents } from "./sockets"; -import { ifMessage } from "./utils"; +import { getSession } from "../auth.js"; +import { createSessionSocket } from "../sessions/index.js"; +import { agents } from "./sockets.js"; +import { ifMessage } from "./utils.js"; type User = { id: string }; diff --git a/apps/pty-proxy/src/index.ts b/apps/pty-proxy/src/index.ts index 14dd1ab6d..cd85eaf0c 100644 --- a/apps/pty-proxy/src/index.ts +++ b/apps/pty-proxy/src/index.ts @@ -1,8 +1,8 @@ import ms from "ms"; -import { env } from "./config"; -import { addSocket } from "./routing"; -import { app } from "./server"; +import { env } from "./config.js"; +import { addSocket } from "./routing.js"; +import { app } from "./server.js"; const server = addSocket(app).listen(env.PORT, () => { console.log(`Server is running on port ${env.PORT}`); diff --git a/apps/pty-proxy/src/routing.ts b/apps/pty-proxy/src/routing.ts index 708b70c6d..35cf638c4 100644 --- a/apps/pty-proxy/src/routing.ts +++ b/apps/pty-proxy/src/routing.ts @@ -1,8 +1,8 @@ import { createServer } from "node:http"; import type { Express } from "express"; -import { controllerOnUpgrade } from "./controller"; -import { sessionOnUpgrade } from "./sessions"; +import { controllerOnUpgrade } from "./controller/index.js"; +import { sessionOnUpgrade } from "./sessions/index.js"; export const addSocket = (expressApp: Express) => { const server = createServer(expressApp); diff --git a/apps/pty-proxy/src/session-auditor.ts b/apps/pty-proxy/src/session-auditor.ts index f48b7ee7c..535c02b16 100644 --- a/apps/pty-proxy/src/session-auditor.ts +++ b/apps/pty-proxy/src/session-auditor.ts @@ -1,7 +1,7 @@ import type WebSocket from "ws"; import { z } from "zod"; -import { ifMessage } from "./controller/utils"; +import { ifMessage } from "./controller/utils.js"; export const auditSessions = (socket: WebSocket) => { socket.on( diff --git a/apps/pty-proxy/src/sessions/index.ts b/apps/pty-proxy/src/sessions/index.ts index d9419cc01..2cc446c94 100644 --- a/apps/pty-proxy/src/sessions/index.ts +++ b/apps/pty-proxy/src/sessions/index.ts @@ -4,7 +4,7 @@ import { WebSocketServer } from "ws"; import { logger } from "@ctrlplane/logger"; -import { sessionServers } from "./servers"; +import { sessionServers } from "./servers.js"; const MAX_HISTORY_BYTES = 1024;