Compare commits

...

3 Commits

12 changed files with 31 additions and 12 deletions

View File

@ -1,7 +1,12 @@
# Wikipedia Game Solver # Wikipedia Game Solver
> \[!IMPORTANT\] > \[!IMPORTANT\]
> This project is a work in progress, at an early stage of development. > The project is a work in progress, at an early stage of development.
> \[!NOTE\]
> The project is also a way to learn and experiment with a clean monorepo architecture, with [Turborepo](https://turbo.build/repo), and [TypeScript](https://www.typescriptlang.org/) as the main language.
>
> The project setup **can be used as a template/boilerplate for new projects**.
## About ## About
@ -11,11 +16,6 @@ The Wikipedia Game involves players competing to navigate from one [Wikipedia](h
Available online: <https://wikipedia-game-solver.theoludwig.fr> Available online: <https://wikipedia-game-solver.theoludwig.fr>
> \[!NOTE\]
> The project is also a way to learn and experiment with a monorepo architecture, with [Turborepo](https://turbo.build/repo), and [TypeScript](https://www.typescriptlang.org/) as the main language.
>
> The project setup **can be used as a template/boilerplate for new projects**.
## Getting Started ## Getting Started
### Prerequisites ### Prerequisites
@ -51,6 +51,9 @@ node --run dev
# Start the development Docker services (e.g: Database) # Start the development Docker services (e.g: Database)
docker compose --file compose.dev.yaml up docker compose --file compose.dev.yaml up
# Database migrations
node --run database:migrate
# Lint # Lint
node --run lint:editorconfig node --run lint:editorconfig
node --run lint:prettier node --run lint:prettier
@ -73,6 +76,10 @@ node --run ace -- list
```sh ```sh
# Setup and run all the services for you # Setup and run all the services for you
docker compose up --build docker compose up --build
# To execute database migrations
docker compose exec wikipedia-game-solver-api sh
node --run database:migrate
``` ```
#### Services started #### Services started

View File

@ -2,11 +2,13 @@ FROM node:22.4.1-slim AS node-pnpm
ENV PNPM_HOME="/pnpm" ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH" ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable RUN corepack enable
ENV TURBO_TELEMETRY_DISABLED=1
ENV DO_NOT_TRACK=1
WORKDIR /usr/src/app WORKDIR /usr/src/app
FROM node-pnpm AS builder FROM node-pnpm AS builder
RUN pnpm install --global turbo@2.0.14
COPY ./ ./ COPY ./ ./
RUN pnpm install --global turbo@2.0.14
RUN turbo prune @repo/api --docker RUN turbo prune @repo/api --docker
FROM node-pnpm AS installer FROM node-pnpm AS installer

View File

@ -15,6 +15,7 @@
"ace": "node --import=tsx ./bin/console.ts", "ace": "node --import=tsx ./bin/console.ts",
"tuyau": "node --run ace -- tuyau:generate && node --run ace -- tuyau:generate:openapi --destination=\".adonisjs/openapi.yaml\"", "tuyau": "node --run ace -- tuyau:generate && node --run ace -- tuyau:generate:openapi --destination=\".adonisjs/openapi.yaml\"",
"build": "node --run tuyau", "build": "node --run tuyau",
"database:migrate": "node --run ace -- migration:run",
"test": "c8 node --import=tsx ./bin/test.ts", "test": "c8 node --import=tsx ./bin/test.ts",
"test-shortest-paths": "node --import=tsx ./shortest-paths-tests.ts", "test-shortest-paths": "node --import=tsx ./shortest-paths-tests.ts",
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives", "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives",

View File

@ -1,6 +1,7 @@
import "@repo/config-tailwind/styles.css" import "@repo/config-tailwind/styles.css"
import { defaultTranslationValues, Locale } from "@repo/i18n/config" import { defaultTranslationValues } from "@repo/i18n/config"
import i18nMessagesEnglish from "@repo/i18n/translations/en-US.json" import i18nMessagesEnglish from "@repo/i18n/translations/en-US.json"
import type { Locale } from "@repo/utils/constants"
import type { Preview } from "@storybook/react" import type { Preview } from "@storybook/react"
import { NextIntlClientProvider } from "next-intl" import { NextIntlClientProvider } from "next-intl"
import { ThemeProvider as NextThemeProvider } from "next-themes" import { ThemeProvider as NextThemeProvider } from "next-themes"

View File

@ -5,7 +5,6 @@ import { checkA11y, configureAxe, injectAxe } from "axe-playwright"
/* /*
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api * See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
* to learn more about the test-runner hooks API.
*/ */
const config: TestRunnerConfig = { const config: TestRunnerConfig = {
async preVisit(page) { async preVisit(page) {

View File

@ -16,6 +16,7 @@
"@repo/config-tailwind": "workspace:*", "@repo/config-tailwind": "workspace:*",
"@repo/i18n": "workspace:*", "@repo/i18n": "workspace:*",
"@repo/ui": "workspace:*", "@repo/ui": "workspace:*",
"@repo/utils": "workspace:*",
"@repo/wikipedia-game-solver": "workspace:*", "@repo/wikipedia-game-solver": "workspace:*",
"next": "catalog:", "next": "catalog:",
"next-intl": "catalog:", "next-intl": "catalog:",

View File

@ -1,3 +1,4 @@
TZ=UTC
HOSTNAME=0.0.0.0 HOSTNAME=0.0.0.0
PORT=5000 PORT=5000
NEXT_TELEMETRY_DISABLED=1 NEXT_TELEMETRY_DISABLED=1

View File

@ -2,11 +2,13 @@ FROM node:22.4.1-slim AS node-pnpm
ENV PNPM_HOME="/pnpm" ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH" ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable RUN corepack enable
ENV TURBO_TELEMETRY_DISABLED=1
ENV DO_NOT_TRACK=1
WORKDIR /usr/src/app WORKDIR /usr/src/app
FROM node-pnpm AS builder FROM node-pnpm AS builder
RUN pnpm install --global turbo@2.0.14
COPY ./ ./ COPY ./ ./
RUN pnpm install --global turbo@2.0.14
RUN turbo prune @repo/website --docker RUN turbo prune @repo/website --docker
FROM node-pnpm AS installer FROM node-pnpm AS installer

View File

@ -36,8 +36,6 @@ services:
POSTGRES_DB: ${DATABASE_NAME} POSTGRES_DB: ${DATABASE_NAME}
command: | command: |
--max_wal_size=4GB --max_wal_size=4GB
ports:
- "${DATABASE_PORT-5432}:${DATABASE_PORT-5432}"
volumes: volumes:
- "wikipedia-solver-postgres-data:/var/lib/postgresql/data" - "wikipedia-solver-postgres-data:/var/lib/postgresql/data"
- "./data:/data/" - "./data:/data/"

View File

@ -11,6 +11,7 @@
"scripts": { "scripts": {
"dev": "turbo run dev --parallel", "dev": "turbo run dev --parallel",
"start": "turbo run start --parallel", "start": "turbo run start --parallel",
"database:migrate": "turbo run database:migrate",
"build": "turbo run build", "build": "turbo run build",
"test": "turbo run test", "test": "turbo run test",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",

3
pnpm-lock.yaml generated
View File

@ -432,6 +432,9 @@ importers:
'@repo/ui': '@repo/ui':
specifier: workspace:* specifier: workspace:*
version: link:../../packages/ui version: link:../../packages/ui
'@repo/utils':
specifier: workspace:*
version: link:../../packages/utils
'@repo/wikipedia-game-solver': '@repo/wikipedia-game-solver':
specifier: workspace:* specifier: workspace:*
version: link:../../packages/wikipedia-game-solver version: link:../../packages/wikipedia-game-solver

View File

@ -31,6 +31,9 @@
"start": { "start": {
"dependsOn": ["build"], "dependsOn": ["build"],
"persistent": true "persistent": true
},
"database:migrate": {
"cache": false
} }
} }
} }