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

+4
View File
@@ -16,6 +16,10 @@
"@fortawesome/free-regular-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/vue-fontawesome": "^3.0.3",
"@odyssey/constants": "workspace:*",
"@odyssey/file-graph": "workspace:*",
"@odyssey/game": "workspace:*",
"@odyssey/utils": "workspace:*",
"@trpc/client": "^11.1.0",
"@types/dompurify": "^3.0.5",
"axios": "^1.20.0",
+1 -1
View File
@@ -2,7 +2,7 @@
import { useI18n } from 'vue-i18n'
import { ref, onMounted, watch, computed } from 'vue'
import { useToast } from 'vue-toastification'
import { DAG } from '../../../packages/utils'
import { DAG } from '@odyssey/utils'
import { trpc } from '../utils/trpc'
import useUserProfile from '../store/userProfile'
import QuestIntro from './QuestIntro.vue'
+1 -1
View File
@@ -2,10 +2,10 @@
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useToast } from 'vue-toastification'
import type { QuestLocale } from '@odyssey/constants'
import { useSession } from '../../store/session'
import { openBugReport, openQuestSurvey } from '../../utils/formbricks'
import { trpc } from '../../utils/trpc'
import type { QuestLocale } from '../../../../packages/constants'
const { t, locale } = useI18n()
const toast = useToast()
@@ -1,11 +1,8 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import type { QuestLocale } from '@odyssey/constants'
import { SUPPORTED_LOCALES, LOCALE_NAME_MAP } from '@odyssey/constants'
import { setLocale } from '../../i18n'
import type { QuestLocale } from '../../../../packages/constants'
import {
SUPPORTED_LOCALES,
LOCALE_NAME_MAP,
} from '../../../../packages/constants'
const { t, locale } = useI18n({ useScope: 'global' })
+2 -2
View File
@@ -1,6 +1,6 @@
import { createI18n } from 'vue-i18n'
import type { QuestLocale } from '../../../packages/constants'
import { SUPPORTED_LOCALES } from '../../../packages/constants'
import type { QuestLocale } from '@odyssey/constants'
import { SUPPORTED_LOCALES } from '@odyssey/constants'
import en from './locales/en.json'
import zhTW from './locales/zh-TW.json'
+3 -6
View File
@@ -1,10 +1,7 @@
import { defineStore } from 'pinia'
import type { QuestLocale } from '../../../packages/constants'
import {
FileGraph,
type FileGraphUpdateEvent,
} from '../../../packages/file-graph'
import type { IResponse, ITask } from '../../../packages/game'
import type { QuestLocale } from '@odyssey/constants'
import { FileGraph, type FileGraphUpdateEvent } from '@odyssey/file-graph'
import type { IResponse, ITask } from '@odyssey/game'
import type { SessionDetail } from '../../../server/src/routers/sessionRouter'
import Socket from '../utils/socket'
import SocketTerminal from '../utils/terminal'
+2 -2
View File
@@ -1,5 +1,5 @@
import type { FileGraph } from '../../packages/file-graph'
import type { IResponse, ITask } from '../../packages/game'
import type { FileGraph } from '@odyssey/file-graph'
import type { IResponse, ITask } from '@odyssey/game'
export interface Task {
id: number
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { isValidUsername } from '../../../packages/utils'
import { isValidUsername } from '@odyssey/utils'
import AuthForm from '../components/AuthForm.vue'
import DynamicBackground from '../components/DynamicBackground.vue'
import HeaderPart from '../components/header/HeaderPart.vue'
+2 -2
View File
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import validator from 'validator'
import { isValidUsername } from '../../../packages/utils'
import { passwordPolicy } from '../../../packages/constants'
import { isValidUsername } from '@odyssey/utils'
import { passwordPolicy } from '@odyssey/constants'
import AuthForm from '../components/AuthForm.vue'
import DynamicBackground from '../components/DynamicBackground.vue'
import HeaderPart from '../components/header/HeaderPart.vue'
-10
View File
@@ -1,19 +1,9 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@game': path.resolve(__dirname, '../packages/game'),
'@models': path.resolve(__dirname, '../packages/models'),
'@utils': path.resolve(__dirname, '../packages/utils'),
'@constants': path.resolve(__dirname, '../packages/constants'),
'@file-graph': path.resolve(__dirname, '../packages/file-graph'),
},
},
server: {
host: '0.0.0.0',
proxy: {
+2753
View File
File diff suppressed because it is too large. Load diff
+16 -17
View File
@@ -13,19 +13,19 @@
"tests"
],
"scripts": {
"app": "yarn workspace app dev",
"build": "yarn workspace server build && yarn workspace app build && yarn workspace analytics build",
"dev": "concurrently -n \"App,Server\" -c \"bgBlue.bold,bgGreen.bold\" \"yarn workspace app dev\" \"yarn workspace server dev\"",
"server": "yarn workspace server dev",
"app": "bun run --filter app dev",
"build": "bun run --filter server build && bun run --filter app build && bun run --filter analytics build",
"dev": "concurrently -n \"App,Server\" -c \"bgBlue.bold,bgGreen.bold\" \"bun run --filter app dev\" \"bun run --filter server dev\"",
"server": "bun run --filter server dev",
"lint": "eslint .",
"format": "prettier --ignore-path .prettierignore --write app server",
"test": "yarn node --experimental-vm-modules --no-warnings $(yarn bin jest)",
"test:e2e": "yarn workspace tests test",
"test:open": "yarn workspace tests test:open",
"analytics": "yarn workspace analytics dev",
"setup": "yarn workspace server setup",
"clean": "yarn workspace server clean",
"build:quests": "yarn workspace server build:quests"
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
"test:e2e": "bun run --filter tests test",
"test:open": "bun run --filter tests test:open",
"analytics": "bun run --filter analytics dev",
"setup": "bun run --filter server setup",
"clean": "bun run --filter server clean",
"build:quests": "bun run --filter server build:quests"
},
"devDependencies": {
"@babel/core": "^7.29.6",
@@ -52,12 +52,11 @@
"prettier": "^3.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vue-eslint-parser": "^9.4.2",
"zod-to-json-schema": "^3.24.5"
"vue-eslint-parser": "^9.4.2"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"resolutions": {
"**/@mapbox/node-pre-gyp/tar": "^7.5.19",
"**/@cypress/request/form-data": "^2.5.4"
"packageManager": "bun@1.3.14",
"overrides": {
"@mapbox/node-pre-gyp/tar": "^7.5.19",
"@cypress/request/form-data": "^2.5.4"
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"name": "@odyssey/constants",
"version": "0.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts",
"exports": {
".": "./index.ts"
},
"dependencies": {
"zod": "^3.24.2"
}
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@odyssey/file-graph",
"version": "0.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts",
"exports": {
".": "./index.ts"
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"name": "@odyssey/game",
"version": "0.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts",
"exports": {
".": "./index.ts"
},
"dependencies": {
"@odyssey/file-graph": "workspace:*",
"zod": "^3.24.2",
"zod-to-json-schema": "^3.24.5"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { IFileNode } from '../../file-graph'
import { IFileNode } from '@odyssey/file-graph'
export * from './condition.js'
export * from './stage.js'
+13
View File
@@ -0,0 +1,13 @@
{
"name": "@odyssey/models",
"version": "0.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts",
"exports": {
".": "./index.ts"
},
"dependencies": {
"mongoose": "^8.24.1"
}
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@odyssey/utils",
"version": "0.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts",
"exports": {
".": "./index.ts"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { connectDB, User } from '../../packages/models'
import { connectDB, User } from '@odyssey/models'
async function migrate() {
await connectDB(
+5 -3
View File
@@ -12,6 +12,10 @@
"build:quests": "tsx src/cli/build.ts"
},
"dependencies": {
"@odyssey/constants": "workspace:*",
"@odyssey/game": "workspace:*",
"@odyssey/models": "workspace:*",
"@odyssey/utils": "workspace:*",
"@trpc/server": "^11.8.0",
"bcrypt": "^5.1.1",
"commander": "^11.0.0",
@@ -36,7 +40,6 @@
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"socket.io": "^4.7.1",
"ssh2": "^1.16.0",
"swagger-ui-express": "^5.0.0",
"tsx": "^4.19.3",
"validator": "^13.15.22",
@@ -50,6 +53,7 @@
"@types/bcrypt": "^5.0.2",
"@types/dockerode": "^3.3.23",
"@types/express": "^4.17.21",
"@types/express-serve-static-core": "^5.1.3",
"@types/express-session": "^1.17.10",
"@types/jsonwebtoken": "^9.0.5",
"@types/minimist": "^1.2.5",
@@ -60,11 +64,9 @@
"@types/passport-local": "^1.0.38",
"@types/passport-oauth2": "^1.4.15",
"@types/source-map-support": "^0",
"@types/ssh2": "^1.15.1",
"@types/swagger-ui-express": "^4.1.6",
"@types/validator": "^13.11.9",
"concurrently": "^8.2.2",
"jest": "^29.6.1",
"regenerator-runtime": "^0.14.1",
"source-map-support": "^0.5.21",
"typescript": "^5.3.3"
@@ -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'
+1
View File
@@ -11,6 +11,7 @@
"dev": "tsx watch src/index.ts"
},
"dependencies": {
"@odyssey/models": "workspace:*",
"dotenv": "^16.4.5",
"express": "^4.20.0",
"express-basic-auth": "^1.2.1",
+1 -1
View File
@@ -1,7 +1,7 @@
import express from 'express'
import { engine } from 'express-handlebars'
import basicAuth from 'express-basic-auth'
import { connectDB } from '../../../packages/models'
import { connectDB } from '@odyssey/models'
import config from './config'
import router from './router'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Command } from '../../../../packages/models'
import { Command } from '@odyssey/models'
import Pagination from './pagination'
// eslint-disable-next-line import/prefer-default-export
+1 -1
View File
@@ -1,4 +1,4 @@
import { UserProfile } from '../../../../packages/models'
import { UserProfile } from '@odyssey/models'
export interface QuestProgress {
_id: string
+1 -1
View File
@@ -1,4 +1,4 @@
import { Command, Session } from '../../../../packages/models'
import { Command, Session } from '@odyssey/models'
import Pagination from './pagination'
import {
CommandObject,
+1 -1
View File
@@ -1,5 +1,5 @@
import { HydratedDocument, Types } from 'mongoose'
import { Session, User, IUser, ISession } from '../../../../packages/models'
import { Session, User, IUser, ISession } from '@odyssey/models'
import Pagination from './pagination'
import { UserSessionDetail } from '../interface'
-8725
View File
File diff suppressed because it is too large. Load diff