diff --git a/.dockerignore b/.dockerignore index a23c257..6ab80c4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ .git **/dist **/tsconfig.tsbuildinfo -data \ No newline at end of file +data +postgres-data diff --git a/.eslintignore b/.eslintignore index 3b69be6..1f8f984 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,5 @@ vite.config.js .gitignore data mongo-init.js -dist \ No newline at end of file +dist +postgres-data diff --git a/.eslintrc.js b/.eslintrc.js index 2d350ea..e2ba77a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,7 +2,9 @@ module.exports = { root: true, env: { node: true, - jest: true, + }, + globals: { + Bun: 'readonly', }, plugins: ['@typescript-eslint', 'cypress', 'vue'], extends: [ diff --git a/.github/workflows/ci-checks.yml b/.github/workflows/ci-checks.yml index 82f5cd8..f7766ae 100644 --- a/.github/workflows/ci-checks.yml +++ b/.github/workflows/ci-checks.yml @@ -11,18 +11,21 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: oven-sh/setup-bun@v2 with: - node-version: 20 + bun-version: 1.3.14 - name: Install dependencies - run: yarn install + run: bun install --frozen-lockfile + + - name: Type check + run: bun run type-check - name: Build - run: yarn build + run: bun run build - name: Lint - run: yarn lint + run: bun run lint - name: Test - run: yarn test + run: bun run test diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9bf278c..3c784a7 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -14,7 +14,7 @@ jobs: run: docker-compose -f docker-compose.testing.yml build base backend app-test cypress - name: Build Test Quests - run: docker-compose -f docker-compose.testing.yml run --rm backend yarn build:quests + run: docker-compose -f docker-compose.testing.yml run --rm backend bun run build:quests - name: Run Cypress Tests env: diff --git a/.vscode/launch.json b/.vscode/launch.json index 91e6bfc..7f729ea 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,10 +4,10 @@ { "type": "node", "request": "launch", - "name": "File Graph Yarn Jest", - "runtimeExecutable": "yarn", - "args": ["test", "--runInBand"], - "cwd": "${workspaceFolder}/packages/file-graph", + "name": "File Graph Tests", + "runtimeExecutable": "bun", + "args": ["test", "packages/file-graph"], + "cwd": "${workspaceFolder}", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } diff --git a/README.md b/README.md index 7643e06..3dcaa89 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,15 @@ ## TLDR - yarn install + bun install cp .env.sample .env docker compose up -d - yarn dev + bun run dev ## Requirements -- NodeJS v20+ +- Bun: v1.3+ - Docker -- Yarn: v1.22 ## Known Issues @@ -26,7 +25,7 @@ Windows user please refer to [docs/windows-setup.md](docs/windows-setup.md) for git clone https://github.com/lancatlin/linux-odyssey.git cd linux-odyssey - yarn install + bun install ## Project Structures @@ -104,7 +103,7 @@ Customized `entrypoint.sh` for each quest is not yet supported. To build all quests: - yarn build:quests + bun run build:quests The base image is built with docker-compose, so you can use `docker compose build base` to rebuild it. Once you rebuild the base image, you have to rebuild all quests. @@ -134,11 +133,11 @@ Copy `.env.sample` to `.env` and customize it for your needs. Run dev server (frontend, backend): - yarn dev + bun run dev To develop analytics dashboard: - yarn analytics + bun run analytics The default username and password is `alex` and `Alex1234`. @@ -146,12 +145,12 @@ The default username and password is `alex` and `Alex1234`. Unit tests: - yarn test:unit + bun run test Run Cypress locally, using the current development containers: docker compose up -d - yarn test:e2e + bun run test:e2e Run Cypress in container, create brand-new containers along with it: @@ -183,7 +182,7 @@ Start the service # Server side docker compose -f docker-compose.prod.yml pull - yarn build:quests + bun run build:quests docker compose -f docker-compose.prod.yml up -d ### Necessary Configuration @@ -197,4 +196,4 @@ You can copy from `.env.sample` You can generate a random key by running - yarn setup + bun run setup diff --git a/app/Dockerfile b/app/Dockerfile index 3c3e03b..8ede7a2 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,17 +1,24 @@ # Base stage -FROM node:20-alpine AS build +FROM oven/bun:1.3.14-alpine AS build WORKDIR /app -COPY package.json yarn.lock ./ +COPY package.json bun.lock ./ COPY app/package.json ./app/package.json COPY server/package.json ./server/package.json -RUN yarn install --frozen-lockfile +COPY services/analytics/package.json ./services/analytics/package.json +COPY tests/package.json ./tests/package.json +COPY packages/constants/package.json ./packages/constants/package.json +COPY packages/file-graph/package.json ./packages/file-graph/package.json +COPY packages/game/package.json ./packages/game/package.json +COPY packages/models/package.json ./packages/models/package.json +COPY packages/utils/package.json ./packages/utils/package.json +RUN bun install --frozen-lockfile --filter app COPY tsconfig.json ./tsconfig.json COPY server ./server COPY packages ./packages COPY app ./app -RUN yarn workspace app build +RUN bun run --filter app build # Production stage FROM nginx:stable-alpine AS prod diff --git a/app/package.json b/app/package.json index 1c7000c..2d2e776 100644 --- a/app/package.json +++ b/app/package.json @@ -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", diff --git a/app/src/components/QuestMap.vue b/app/src/components/QuestMap.vue index 935a107..fedbef2 100644 --- a/app/src/components/QuestMap.vue +++ b/app/src/components/QuestMap.vue @@ -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' diff --git a/app/src/components/game/ControlPalette.vue b/app/src/components/game/ControlPalette.vue index 9bd2542..33affb0 100644 --- a/app/src/components/game/ControlPalette.vue +++ b/app/src/components/game/ControlPalette.vue @@ -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() diff --git a/app/src/components/header/LanguageSelector.vue b/app/src/components/header/LanguageSelector.vue index 81011ac..42c2ab6 100644 --- a/app/src/components/header/LanguageSelector.vue +++ b/app/src/components/header/LanguageSelector.vue @@ -1,11 +1,8 @@