mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
refactor: use bun for package management
+ add package.json to each packages + update import path
This commit is contained in:
1 parent
fb7dc0eb73
commit
2feedc329c
47 files changed
+2893
-8818
No files matched your search
@@ -16,6 +16,10 @@
|
|||||||
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||||
"@fortawesome/vue-fontawesome": "^3.0.3",
|
"@fortawesome/vue-fontawesome": "^3.0.3",
|
||||||
|
"@odyssey/constants": "workspace:*",
|
||||||
|
"@odyssey/file-graph": "workspace:*",
|
||||||
|
"@odyssey/game": "workspace:*",
|
||||||
|
"@odyssey/utils": "workspace:*",
|
||||||
"@trpc/client": "^11.1.0",
|
"@trpc/client": "^11.1.0",
|
||||||
"@types/dompurify": "^3.0.5",
|
"@types/dompurify": "^3.0.5",
|
||||||
"axios": "^1.20.0",
|
"axios": "^1.20.0",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { ref, onMounted, watch, computed } from 'vue'
|
import { ref, onMounted, watch, computed } from 'vue'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import { DAG } from '../../../packages/utils'
|
import { DAG } from '@odyssey/utils'
|
||||||
import { trpc } from '../utils/trpc'
|
import { trpc } from '../utils/trpc'
|
||||||
import useUserProfile from '../store/userProfile'
|
import useUserProfile from '../store/userProfile'
|
||||||
import QuestIntro from './QuestIntro.vue'
|
import QuestIntro from './QuestIntro.vue'
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import { useSession } from '../../store/session'
|
import { useSession } from '../../store/session'
|
||||||
import { openBugReport, openQuestSurvey } from '../../utils/formbricks'
|
import { openBugReport, openQuestSurvey } from '../../utils/formbricks'
|
||||||
import { trpc } from '../../utils/trpc'
|
import { trpc } from '../../utils/trpc'
|
||||||
import type { QuestLocale } from '../../../../packages/constants'
|
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n'
|
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 { setLocale } from '../../i18n'
|
||||||
import type { QuestLocale } from '../../../../packages/constants'
|
|
||||||
import {
|
|
||||||
SUPPORTED_LOCALES,
|
|
||||||
LOCALE_NAME_MAP,
|
|
||||||
} from '../../../../packages/constants'
|
|
||||||
|
|
||||||
const { t, locale } = useI18n({ useScope: 'global' })
|
const { t, locale } = useI18n({ useScope: 'global' })
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createI18n } from 'vue-i18n'
|
import { createI18n } from 'vue-i18n'
|
||||||
import type { QuestLocale } from '../../../packages/constants'
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import { SUPPORTED_LOCALES } from '../../../packages/constants'
|
import { SUPPORTED_LOCALES } from '@odyssey/constants'
|
||||||
import en from './locales/en.json'
|
import en from './locales/en.json'
|
||||||
import zhTW from './locales/zh-TW.json'
|
import zhTW from './locales/zh-TW.json'
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { QuestLocale } from '../../../packages/constants'
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import {
|
import { FileGraph, type FileGraphUpdateEvent } from '@odyssey/file-graph'
|
||||||
FileGraph,
|
import type { IResponse, ITask } from '@odyssey/game'
|
||||||
type FileGraphUpdateEvent,
|
|
||||||
} from '../../../packages/file-graph'
|
|
||||||
import type { IResponse, ITask } from '../../../packages/game'
|
|
||||||
import type { SessionDetail } from '../../../server/src/routers/sessionRouter'
|
import type { SessionDetail } from '../../../server/src/routers/sessionRouter'
|
||||||
import Socket from '../utils/socket'
|
import Socket from '../utils/socket'
|
||||||
import SocketTerminal from '../utils/terminal'
|
import SocketTerminal from '../utils/terminal'
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import type { FileGraph } from '../../packages/file-graph'
|
import type { FileGraph } from '@odyssey/file-graph'
|
||||||
import type { IResponse, ITask } from '../../packages/game'
|
import type { IResponse, ITask } from '@odyssey/game'
|
||||||
|
|
||||||
export interface Task {
|
export interface Task {
|
||||||
id: number
|
id: number
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { isValidUsername } from '../../../packages/utils'
|
import { isValidUsername } from '@odyssey/utils'
|
||||||
import AuthForm from '../components/AuthForm.vue'
|
import AuthForm from '../components/AuthForm.vue'
|
||||||
import DynamicBackground from '../components/DynamicBackground.vue'
|
import DynamicBackground from '../components/DynamicBackground.vue'
|
||||||
import HeaderPart from '../components/header/HeaderPart.vue'
|
import HeaderPart from '../components/header/HeaderPart.vue'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import validator from 'validator'
|
import validator from 'validator'
|
||||||
import { isValidUsername } from '../../../packages/utils'
|
import { isValidUsername } from '@odyssey/utils'
|
||||||
import { passwordPolicy } from '../../../packages/constants'
|
import { passwordPolicy } from '@odyssey/constants'
|
||||||
import AuthForm from '../components/AuthForm.vue'
|
import AuthForm from '../components/AuthForm.vue'
|
||||||
import DynamicBackground from '../components/DynamicBackground.vue'
|
import DynamicBackground from '../components/DynamicBackground.vue'
|
||||||
import HeaderPart from '../components/header/HeaderPart.vue'
|
import HeaderPart from '../components/header/HeaderPart.vue'
|
||||||
|
|||||||
@@ -1,19 +1,9 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
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: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|||||||
+16
-17
@@ -13,19 +13,19 @@
|
|||||||
"tests"
|
"tests"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"app": "yarn workspace app dev",
|
"app": "bun run --filter app dev",
|
||||||
"build": "yarn workspace server build && yarn workspace app build && yarn workspace analytics build",
|
"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\" \"yarn workspace app dev\" \"yarn workspace server dev\"",
|
"dev": "concurrently -n \"App,Server\" -c \"bgBlue.bold,bgGreen.bold\" \"bun run --filter app dev\" \"bun run --filter server dev\"",
|
||||||
"server": "yarn workspace server dev",
|
"server": "bun run --filter server dev",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"format": "prettier --ignore-path .prettierignore --write app server",
|
"format": "prettier --ignore-path .prettierignore --write app server",
|
||||||
"test": "yarn node --experimental-vm-modules --no-warnings $(yarn bin jest)",
|
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
|
||||||
"test:e2e": "yarn workspace tests test",
|
"test:e2e": "bun run --filter tests test",
|
||||||
"test:open": "yarn workspace tests test:open",
|
"test:open": "bun run --filter tests test:open",
|
||||||
"analytics": "yarn workspace analytics dev",
|
"analytics": "bun run --filter analytics dev",
|
||||||
"setup": "yarn workspace server setup",
|
"setup": "bun run --filter server setup",
|
||||||
"clean": "yarn workspace server clean",
|
"clean": "bun run --filter server clean",
|
||||||
"build:quests": "yarn workspace server build:quests"
|
"build:quests": "bun run --filter server build:quests"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.29.6",
|
"@babel/core": "^7.29.6",
|
||||||
@@ -52,12 +52,11 @@
|
|||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vue-eslint-parser": "^9.4.2",
|
"vue-eslint-parser": "^9.4.2"
|
||||||
"zod-to-json-schema": "^3.24.5"
|
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
"packageManager": "bun@1.3.14",
|
||||||
"resolutions": {
|
"overrides": {
|
||||||
"**/@mapbox/node-pre-gyp/tar": "^7.5.19",
|
"@mapbox/node-pre-gyp/tar": "^7.5.19",
|
||||||
"**/@cypress/request/form-data": "^2.5.4"
|
"@cypress/request/form-data": "^2.5.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "@odyssey/file-graph",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"main": "index.ts",
|
||||||
|
"types": "index.ts",
|
||||||
|
"exports": {
|
||||||
|
".": "./index.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,4 +1,4 @@
|
|||||||
import { IFileNode } from '../../file-graph'
|
import { IFileNode } from '@odyssey/file-graph'
|
||||||
|
|
||||||
export * from './condition.js'
|
export * from './condition.js'
|
||||||
export * from './stage.js'
|
export * from './stage.js'
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "@odyssey/utils",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"main": "index.ts",
|
||||||
|
"types": "index.ts",
|
||||||
|
"exports": {
|
||||||
|
".": "./index.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { connectDB, User } from '../../packages/models'
|
import { connectDB, User } from '@odyssey/models'
|
||||||
|
|
||||||
async function migrate() {
|
async function migrate() {
|
||||||
await connectDB(
|
await connectDB(
|
||||||
|
|||||||
+5
-3
@@ -12,6 +12,10 @@
|
|||||||
"build:quests": "tsx src/cli/build.ts"
|
"build:quests": "tsx src/cli/build.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@odyssey/constants": "workspace:*",
|
||||||
|
"@odyssey/game": "workspace:*",
|
||||||
|
"@odyssey/models": "workspace:*",
|
||||||
|
"@odyssey/utils": "workspace:*",
|
||||||
"@trpc/server": "^11.8.0",
|
"@trpc/server": "^11.8.0",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"commander": "^11.0.0",
|
"commander": "^11.0.0",
|
||||||
@@ -36,7 +40,6 @@
|
|||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
"socket.io": "^4.7.1",
|
"socket.io": "^4.7.1",
|
||||||
"ssh2": "^1.16.0",
|
|
||||||
"swagger-ui-express": "^5.0.0",
|
"swagger-ui-express": "^5.0.0",
|
||||||
"tsx": "^4.19.3",
|
"tsx": "^4.19.3",
|
||||||
"validator": "^13.15.22",
|
"validator": "^13.15.22",
|
||||||
@@ -50,6 +53,7 @@
|
|||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/dockerode": "^3.3.23",
|
"@types/dockerode": "^3.3.23",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
"@types/express-serve-static-core": "^5.1.3",
|
||||||
"@types/express-session": "^1.17.10",
|
"@types/express-session": "^1.17.10",
|
||||||
"@types/jsonwebtoken": "^9.0.5",
|
"@types/jsonwebtoken": "^9.0.5",
|
||||||
"@types/minimist": "^1.2.5",
|
"@types/minimist": "^1.2.5",
|
||||||
@@ -60,11 +64,9 @@
|
|||||||
"@types/passport-local": "^1.0.38",
|
"@types/passport-local": "^1.0.38",
|
||||||
"@types/passport-oauth2": "^1.4.15",
|
"@types/passport-oauth2": "^1.4.15",
|
||||||
"@types/source-map-support": "^0",
|
"@types/source-map-support": "^0",
|
||||||
"@types/ssh2": "^1.15.1",
|
|
||||||
"@types/swagger-ui-express": "^4.1.6",
|
"@types/swagger-ui-express": "^4.1.6",
|
||||||
"@types/validator": "^13.11.9",
|
"@types/validator": "^13.11.9",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^8.2.2",
|
||||||
"jest": "^29.6.1",
|
|
||||||
"regenerator-runtime": "^0.14.1",
|
"regenerator-runtime": "^0.14.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
import { GameSession, commandSchema } from '../../../../packages/game'
|
import { GameSession, commandSchema } from '@odyssey/game'
|
||||||
import { Command, Session } from '../../../../packages/models'
|
import { Command, Session } from '@odyssey/models'
|
||||||
import { pushToSession } from '../socket'
|
import { pushToSession } from '../socket'
|
||||||
import { finishSession } from '../../models/sessionManager'
|
import { finishSession } from '../../models/sessionManager'
|
||||||
import { asyncHandler } from '../../middleware/error'
|
import { asyncHandler } from '../../middleware/error'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Router, Request, Response, Express } from 'express'
|
import { Router, Request, Response, Express } from 'express'
|
||||||
import passport from 'passport'
|
import passport from 'passport'
|
||||||
import { NextFunction } from 'express-serve-static-core'
|
import { NextFunction } from 'express-serve-static-core'
|
||||||
import { LoginAttempt } from '../../../../packages/models'
|
import { LoginAttempt } from '@odyssey/models'
|
||||||
import enabledMethods from '../../auth/passport.js'
|
import enabledMethods from '../../auth/passport.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Server } from 'socket.io'
|
|||||||
import type { Socket } from 'socket.io'
|
import type { Socket } from 'socket.io'
|
||||||
import validator from 'validator'
|
import validator from 'validator'
|
||||||
import type { Server as HttpServer } from 'http'
|
import type { Server as HttpServer } from 'http'
|
||||||
import { Session } from '../../../packages/models'
|
import { Session } from '@odyssey/models'
|
||||||
import SessionMiddleware from '../middleware/session.js'
|
import SessionMiddleware from '../middleware/session.js'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { check } from 'express-validator'
|
import { check } from 'express-validator'
|
||||||
|
|
||||||
import { isValidUsername, isValidEmail } from '../../../../packages/utils'
|
import { isValidUsername, isValidEmail } from '@odyssey/utils'
|
||||||
import { User } from '../../../../packages/models'
|
import { User } from '@odyssey/models'
|
||||||
import { passwordPolicy } from '../../../../packages/constants'
|
import { passwordPolicy } from '@odyssey/constants'
|
||||||
import { noError } from '../../middleware/validator.js'
|
import { noError } from '../../middleware/validator.js'
|
||||||
|
|
||||||
const checkUsername = () =>
|
const checkUsername = () =>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Profile } from 'passport'
|
import type { Profile } from 'passport'
|
||||||
import type { VerifyCallback } from 'passport-oauth2'
|
import type { VerifyCallback } from 'passport-oauth2'
|
||||||
import { User } from '../../../packages/models'
|
import { User } from '@odyssey/models'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
export default async function oauthVerify(
|
export default async function oauthVerify(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import passport from 'passport'
|
import passport from 'passport'
|
||||||
import type { Express } from 'express'
|
import type { Express } from 'express'
|
||||||
import { UserProfile } from '../../../packages/models'
|
import { UserProfile } from '@odyssey/models'
|
||||||
import passwordStrategy from './passwordStrategy.js'
|
import passwordStrategy from './passwordStrategy.js'
|
||||||
import jwtStrategy from './jwtStrategy.js'
|
import jwtStrategy from './jwtStrategy.js'
|
||||||
import googleStrategy from './googleStrategy.js'
|
import googleStrategy from './googleStrategy.js'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import bcrypt from 'bcrypt'
|
|||||||
import { Strategy as LocalStrategy } from 'passport-local'
|
import { Strategy as LocalStrategy } from 'passport-local'
|
||||||
import type { IVerifyOptions } from 'passport-local'
|
import type { IVerifyOptions } from 'passport-local'
|
||||||
import type { Express } from 'express'
|
import type { Express } from 'express'
|
||||||
import { User } from '../../../packages/models'
|
import { User } from '@odyssey/models'
|
||||||
|
|
||||||
async function verifyPassword(
|
async function verifyPassword(
|
||||||
username: string,
|
username: string,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { connectDB } from '../../../packages/models'
|
import { connectDB } from '@odyssey/models'
|
||||||
import { removeExpired } from '../containers/expiryChecker'
|
import { removeExpired } from '../containers/expiryChecker'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import logger from '../utils/logger'
|
import logger from '../utils/logger'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { execFile } from 'child_process'
|
import { execFile } from 'child_process'
|
||||||
|
|
||||||
import { buildFileCheckCmd } from '../../../packages/utils'
|
import { buildFileCheckCmd } from '@odyssey/utils'
|
||||||
import type { IFileExistenceChecker, IFileInput } from '../../../packages/game'
|
import type { IFileExistenceChecker, IFileInput } from '@odyssey/game'
|
||||||
|
|
||||||
function sanitizeId(id: string) {
|
function sanitizeId(id: string) {
|
||||||
return id.replace(/[^a-zA-Z0-9]/g, '')
|
return id.replace(/[^a-zA-Z0-9]/g, '')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import fs from 'fs/promises'
|
import fs from 'fs/promises'
|
||||||
import Docker from 'dockerode'
|
import Docker from 'dockerode'
|
||||||
import type { QuestLocale } from '../../../packages/constants'
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import config, { getQuestImage } from '../config.js'
|
import config, { getQuestImage } from '../config.js'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import schedule from 'node-schedule'
|
import schedule from 'node-schedule'
|
||||||
import type { HydratedDocument } from 'mongoose'
|
import type { HydratedDocument } from 'mongoose'
|
||||||
import { Session } from '../../../packages/models'
|
import { Session } from '@odyssey/models'
|
||||||
import type { ISession } from '../../../packages/models'
|
import type { ISession } from '@odyssey/models'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
import { deleteContainer } from './docker.js'
|
import { deleteContainer } from './docker.js'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import YAML from 'yaml'
|
|||||||
import swaggerUI from 'swagger-ui-express'
|
import swaggerUI from 'swagger-ui-express'
|
||||||
import passport from 'passport'
|
import passport from 'passport'
|
||||||
import * as trpcExpress from '@trpc/server/adapters/express'
|
import * as trpcExpress from '@trpc/server/adapters/express'
|
||||||
import { connectDB } from '../../packages/models'
|
import { connectDB } from '@odyssey/models'
|
||||||
|
|
||||||
import './auth/passport.js'
|
import './auth/passport.js'
|
||||||
import socketServer from './api/socket.js'
|
import socketServer from './api/socket.js'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import rateLimit from 'express-rate-limit'
|
import rateLimit from 'express-rate-limit'
|
||||||
import type { Options } from 'express-rate-limit'
|
import type { Options } from 'express-rate-limit'
|
||||||
import type { Request, Response, NextFunction } from 'express'
|
import type { Request, Response, NextFunction } from 'express'
|
||||||
|
import { LoginAttempt } from '@odyssey/models'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
import { LoginAttempt } from '../../../packages/models'
|
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
function createRateLimiter(options: Partial<Options>) {
|
function createRateLimiter(options: Partial<Options>) {
|
||||||
|
|||||||
@@ -3,13 +3,9 @@ import fs from 'fs/promises'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import yaml from 'yaml'
|
import yaml from 'yaml'
|
||||||
|
|
||||||
import type { QuestLocale } from '../../../packages/constants'
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import { SUPPORTED_LOCALES } from '../../../packages/constants'
|
import { SUPPORTED_LOCALES } from '@odyssey/constants'
|
||||||
import {
|
import { questSchema, globalExceptionSchema, IQuest } from '@odyssey/game'
|
||||||
questSchema,
|
|
||||||
globalExceptionSchema,
|
|
||||||
IQuest,
|
|
||||||
} from '../../../packages/game'
|
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { HydratedDocument } from 'mongoose'
|
import { HydratedDocument } from 'mongoose'
|
||||||
import type { QuestLocale } from '../../../packages/constants'
|
import type { QuestLocale } from '@odyssey/constants'
|
||||||
import { LOCALE_NAME_MAP } from '../../../packages/constants'
|
import { LOCALE_NAME_MAP } from '@odyssey/constants'
|
||||||
import { Session, UserProfile } from '../../../packages/models'
|
import { Session, UserProfile } from '@odyssey/models'
|
||||||
import type { ISession, IUser } from '../../../packages/models'
|
import type { ISession, IUser } from '@odyssey/models'
|
||||||
import {
|
import {
|
||||||
createContainer,
|
createContainer,
|
||||||
deleteContainer,
|
deleteContainer,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Express } from 'express'
|
import { Express } from 'express'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { User, UserProfile } from '../../../packages/models'
|
import { User, UserProfile } from '@odyssey/models'
|
||||||
import { hashPassword } from '../utils/auth.js'
|
import { hashPassword } from '../utils/auth.js'
|
||||||
|
|
||||||
export async function createUser(
|
export async function createUser(
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { SUPPORTED_LOCALES } from '@odyssey/constants'
|
||||||
import { router, publicProcedure } from '../trpc.js'
|
import { router, publicProcedure } from '../trpc.js'
|
||||||
import { questManager } from '../models/quest.js'
|
import { questManager } from '../models/quest.js'
|
||||||
import { SUPPORTED_LOCALES } from '../../../packages/constants'
|
|
||||||
|
|
||||||
export const questRouter = router({
|
export const questRouter = router({
|
||||||
getQuests: publicProcedure
|
getQuests: publicProcedure
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { SUPPORTED_LOCALES } from '../../../packages/constants'
|
import { SUPPORTED_LOCALES } from '@odyssey/constants'
|
||||||
import { ISession, Session } from '../../../packages/models'
|
import { ISession, Session } from '@odyssey/models'
|
||||||
import { GameSession, VoidFileExistenceChecker } from '../../../packages/game'
|
import { GameSession, VoidFileExistenceChecker } from '@odyssey/game'
|
||||||
import { createNewSession, isQuestUnlocked } from '../models/sessionManager.js'
|
import { createNewSession, isQuestUnlocked } from '../models/sessionManager.js'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
import { protectedProcedure, router } from '../trpc.js'
|
import { protectedProcedure, router } from '../trpc.js'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { UserProfile } from '../../../packages/models'
|
import { UserProfile } from '@odyssey/models'
|
||||||
import { protectedProcedure, router } from '../trpc.js'
|
import { protectedProcedure, router } from '../trpc.js'
|
||||||
|
|
||||||
export const userRouter = router({
|
export const userRouter = router({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { User } from '../../../packages/models'
|
import { User } from '@odyssey/models'
|
||||||
import config from '../config.js'
|
import config from '../config.js'
|
||||||
import { createUser } from '../models/userManager.js'
|
import { createUser } from '../models/userManager.js'
|
||||||
import logger from './logger.js'
|
import logger from './logger.js'
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"dev": "tsx watch src/index.ts"
|
"dev": "tsx watch src/index.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@odyssey/models": "workspace:*",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.20.0",
|
"express": "^4.20.0",
|
||||||
"express-basic-auth": "^1.2.1",
|
"express-basic-auth": "^1.2.1",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { engine } from 'express-handlebars'
|
import { engine } from 'express-handlebars'
|
||||||
import basicAuth from 'express-basic-auth'
|
import basicAuth from 'express-basic-auth'
|
||||||
import { connectDB } from '../../../packages/models'
|
import { connectDB } from '@odyssey/models'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from '../../../../packages/models'
|
import { Command } from '@odyssey/models'
|
||||||
import Pagination from './pagination'
|
import Pagination from './pagination'
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { UserProfile } from '../../../../packages/models'
|
import { UserProfile } from '@odyssey/models'
|
||||||
|
|
||||||
export interface QuestProgress {
|
export interface QuestProgress {
|
||||||
_id: string
|
_id: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command, Session } from '../../../../packages/models'
|
import { Command, Session } from '@odyssey/models'
|
||||||
import Pagination from './pagination'
|
import Pagination from './pagination'
|
||||||
import {
|
import {
|
||||||
CommandObject,
|
CommandObject,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { HydratedDocument, Types } from 'mongoose'
|
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 Pagination from './pagination'
|
||||||
import { UserSessionDetail } from '../interface'
|
import { UserSessionDetail } from '../interface'
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user