refactor: use bun for package management

+ add package.json to each packages
+ update import path
This commit is contained in:
Justin Lin committed 2026-10-11 16:50:01 +11:00
1 parent fb7dc0eb73
commit 2feedc329c
47 files changed
+2893 -8818

No files matched your search

@@ -1,6 +1,6 @@
import type { Request, Response } from 'express'
import { GameSession, commandSchema } from '../../../../packages/game'
import { Command, Session } from '../../../../packages/models'
import { GameSession, commandSchema } from '@odyssey/game'
import { Command, Session } from '@odyssey/models'
import { pushToSession } from '../socket'
import { finishSession } from '../../models/sessionManager'
import { asyncHandler } from '../../middleware/error'
+1 -1
View File
@@ -1,7 +1,7 @@
import { Router, Request, Response, Express } from 'express'
import passport from 'passport'
import { NextFunction } from 'express-serve-static-core'
import { LoginAttempt } from '../../../../packages/models'
import { LoginAttempt } from '@odyssey/models'
import enabledMethods from '../../auth/passport.js'
import {
+1 -1
View File
@@ -2,7 +2,7 @@ import { Server } from 'socket.io'
import type { Socket } from 'socket.io'
import validator from 'validator'
import type { Server as HttpServer } from 'http'
import { Session } from '../../../packages/models'
import { Session } from '@odyssey/models'
import SessionMiddleware from '../middleware/session.js'
import logger from '../utils/logger.js'
+3 -3
View File
@@ -1,8 +1,8 @@
import { check } from 'express-validator'
import { isValidUsername, isValidEmail } from '../../../../packages/utils'
import { User } from '../../../../packages/models'
import { passwordPolicy } from '../../../../packages/constants'
import { isValidUsername, isValidEmail } from '@odyssey/utils'
import { User } from '@odyssey/models'
import { passwordPolicy } from '@odyssey/constants'
import { noError } from '../../middleware/validator.js'
const checkUsername = () =>
+1 -1
View File
@@ -1,6 +1,6 @@
import type { Profile } from 'passport'
import type { VerifyCallback } from 'passport-oauth2'
import { User } from '../../../packages/models'
import { User } from '@odyssey/models'
import logger from '../utils/logger.js'
export default async function oauthVerify(
+1 -1
View File
@@ -1,6 +1,6 @@
import passport from 'passport'
import type { Express } from 'express'
import { UserProfile } from '../../../packages/models'
import { UserProfile } from '@odyssey/models'
import passwordStrategy from './passwordStrategy.js'
import jwtStrategy from './jwtStrategy.js'
import googleStrategy from './googleStrategy.js'
+1 -1
View File
@@ -3,7 +3,7 @@ import bcrypt from 'bcrypt'
import { Strategy as LocalStrategy } from 'passport-local'
import type { IVerifyOptions } from 'passport-local'
import type { Express } from 'express'
import { User } from '../../../packages/models'
import { User } from '@odyssey/models'
async function verifyPassword(
username: string,
+1 -1
View File
@@ -1,4 +1,4 @@
import { connectDB } from '../../../packages/models'
import { connectDB } from '@odyssey/models'
import { removeExpired } from '../containers/expiryChecker'
import config from '../config'
import logger from '../utils/logger'
+2 -2
View File
@@ -1,7 +1,7 @@
import { execFile } from 'child_process'
import { buildFileCheckCmd } from '../../../packages/utils'
import type { IFileExistenceChecker, IFileInput } from '../../../packages/game'
import { buildFileCheckCmd } from '@odyssey/utils'
import type { IFileExistenceChecker, IFileInput } from '@odyssey/game'
function sanitizeId(id: string) {
return id.replace(/[^a-zA-Z0-9]/g, '')
+1 -1
View File
@@ -1,6 +1,6 @@
import fs from 'fs/promises'
import Docker from 'dockerode'
import type { QuestLocale } from '../../../packages/constants'
import type { QuestLocale } from '@odyssey/constants'
import config, { getQuestImage } from '../config.js'
import logger from '../utils/logger.js'
+2 -2
View File
@@ -1,7 +1,7 @@
import schedule from 'node-schedule'
import type { HydratedDocument } from 'mongoose'
import { Session } from '../../../packages/models'
import type { ISession } from '../../../packages/models'
import { Session } from '@odyssey/models'
import type { ISession } from '@odyssey/models'
import config from '../config.js'
import { deleteContainer } from './docker.js'
import logger from '../utils/logger.js'
+1 -1
View File
@@ -5,7 +5,7 @@ import YAML from 'yaml'
import swaggerUI from 'swagger-ui-express'
import passport from 'passport'
import * as trpcExpress from '@trpc/server/adapters/express'
import { connectDB } from '../../packages/models'
import { connectDB } from '@odyssey/models'
import './auth/passport.js'
import socketServer from './api/socket.js'
+1 -1
View File
@@ -1,8 +1,8 @@
import rateLimit from 'express-rate-limit'
import type { Options } from 'express-rate-limit'
import type { Request, Response, NextFunction } from 'express'
import { LoginAttempt } from '@odyssey/models'
import config from '../config.js'
import { LoginAttempt } from '../../../packages/models'
import logger from '../utils/logger.js'
function createRateLimiter(options: Partial<Options>) {
+3 -7
View File
@@ -3,13 +3,9 @@ import fs from 'fs/promises'
import path from 'path'
import yaml from 'yaml'
import type { QuestLocale } from '../../../packages/constants'
import { SUPPORTED_LOCALES } from '../../../packages/constants'
import {
questSchema,
globalExceptionSchema,
IQuest,
} from '../../../packages/game'
import type { QuestLocale } from '@odyssey/constants'
import { SUPPORTED_LOCALES } from '@odyssey/constants'
import { questSchema, globalExceptionSchema, IQuest } from '@odyssey/game'
import logger from '../utils/logger.js'
import config from '../config.js'
+4 -4
View File
@@ -1,8 +1,8 @@
import { HydratedDocument } from 'mongoose'
import type { QuestLocale } from '../../../packages/constants'
import { LOCALE_NAME_MAP } from '../../../packages/constants'
import { Session, UserProfile } from '../../../packages/models'
import type { ISession, IUser } from '../../../packages/models'
import type { QuestLocale } from '@odyssey/constants'
import { LOCALE_NAME_MAP } from '@odyssey/constants'
import { Session, UserProfile } from '@odyssey/models'
import type { ISession, IUser } from '@odyssey/models'
import {
createContainer,
deleteContainer,
+1 -1
View File
@@ -1,6 +1,6 @@
import { Express } from 'express'
import { format } from 'date-fns'
import { User, UserProfile } from '../../../packages/models'
import { User, UserProfile } from '@odyssey/models'
import { hashPassword } from '../utils/auth.js'
export async function createUser(
+1 -1
View File
@@ -1,8 +1,8 @@
import { TRPCError } from '@trpc/server'
import { z } from 'zod'
import { SUPPORTED_LOCALES } from '@odyssey/constants'
import { router, publicProcedure } from '../trpc.js'
import { questManager } from '../models/quest.js'
import { SUPPORTED_LOCALES } from '../../../packages/constants'
export const questRouter = router({
getQuests: publicProcedure
+3 -3
View File
@@ -1,8 +1,8 @@
import { TRPCError } from '@trpc/server'
import { z } from 'zod'
import { SUPPORTED_LOCALES } from '../../../packages/constants'
import { ISession, Session } from '../../../packages/models'
import { GameSession, VoidFileExistenceChecker } from '../../../packages/game'
import { SUPPORTED_LOCALES } from '@odyssey/constants'
import { ISession, Session } from '@odyssey/models'
import { GameSession, VoidFileExistenceChecker } from '@odyssey/game'
import { createNewSession, isQuestUnlocked } from '../models/sessionManager.js'
import config from '../config.js'
import { protectedProcedure, router } from '../trpc.js'
+1 -1
View File
@@ -1,5 +1,5 @@
import { TRPCError } from '@trpc/server'
import { UserProfile } from '../../../packages/models'
import { UserProfile } from '@odyssey/models'
import { protectedProcedure, router } from '../trpc.js'
export const userRouter = router({
+1 -1
View File
@@ -1,4 +1,4 @@
import { User } from '../../../packages/models'
import { User } from '@odyssey/models'
import config from '../config.js'
import { createUser } from '../models/userManager.js'
import logger from './logger.js'