chore: fix usage issues
All checks were successful
Chromatic / chromatic (push) Successful in 5m54s
CI / ci (push) Successful in 4m24s
CI / commitlint (push) Successful in 18s

This commit is contained in:
Théo LUDWIG 2024-08-10 01:32:34 +01:00
parent 0f8b6c6b29
commit aa2fb4f5b9
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
13 changed files with 371 additions and 151 deletions

View File

@ -24,6 +24,10 @@ jobs:
- name: "Install dependencies"
run: "pnpm install --frozen-lockfile"
- run: "cp .env.example .env"
- run: "cp apps/website/.env.example apps/website/.env"
- run: "cp apps/api/.env.example apps/api/.env"
# - name: "Install Playwright"
# run: "pnpm exec playwright install --with-deps"

View File

@ -49,7 +49,7 @@ pnpm exec playwright install --with-deps
node --run dev
# Start the development Docker services (e.g: Database)
docker compose up --file compose.dev.yaml
docker compose --file compose.dev.yaml up
# Lint
node --run lint:editorconfig

16
TODO.md
View File

@ -29,9 +29,21 @@
- [ ] Update logic to create custom `internal_links` table to make it work with latest wikipedia dumps (notably concerning the change in `pagelinks.sql` where the title is not included anymore, but instead it uses `pl_target_id`, foreign key to `linktarget`), last tested dumb working `20240420`
- [ ] Handle redirects
- [ ] Implement REST API (`api`) with JSON responses ([AdonisJS](https://adonisjs.com/)) to get shortest paths between 2 pages
- [ ] Implement Wikipedia Game Solver (`website`) with inputs, button to submit, and list all pages to go from one to another, or none if it is not possible
- [ ] Implement toast notifications for errors, warnings, and success messages
- [x] Init AdonisJS project
- [ ] Create Lucid models and migrations for Wikipedia Database Dump: `pages` and `internal_links` tables
- [ ] Implement `GET /wikipedia/pages?title=Node.js` to search a page by title (not necessarily with the title sanitized, search with input by user to check if page exists)
- [ ] Implement `GET /wikipedia/pages/internal-links/paths?from=Node.js&to=Linux` to get all the possible paths between 2 pages with titles sanitized
- [ ] Implement Wikipedia Game Solver (`website`)
- [x] Init Next.js project
- [ ] Try to use <https://www.npmjs.com/package/@tuyau/client> for API calls
- [ ] Hard code 2 pages to test if it works with `console.log` in the browser
- [ ] Implement a form with inputs, button to submit, and list all pages to go from one to another, or none if it is not possible
- [ ] Add images, links to the pages + good UI/UX
- [ ] Implement toast notifications for errors, warnings, and success messages
- [ ] Autocompletion page titles
- [ ] Implement CLI (`cli`)
- [ ] Init Clipanion project
- [ ] Implement `wikipedia-game-solver internal-links --from="Node.js" --to="Linux"` command to get all the possible paths between 2 pages.
- [ ] Add docs to add locale/edit translations, create component, install a dependency in a package, create a new package, technology used, architecture, links where it's deployed, how to use/install for end users, how to update dependencies with `npx taze -l` etc.
- [ ] GitHub Mirror
- [ ] Delete `TODO.md` file and instead use issues for the remaining tasks

View File

@ -36,6 +36,9 @@ export default defineConfig({
},
],
preloads: [
async () => {
return await import("#start/database.js")
},
async () => {
return await import("#start/routes.js")
},

View File

@ -18,16 +18,18 @@ const AuthFinder = withAuthFinder(
export default class User extends compose(BaseModel, AuthFinder) {
protected tableName = "users"
@column({ columnName: "id", isPrimary: true })
@column({ columnName: "id", serializeAs: "id", isPrimary: true })
declare id: number
@column({
columnName: "full_name",
serializeAs: "fullName",
})
declare fullName: string | null
@column({
columnName: "email",
serializeAs: "email",
})
declare email: string
@ -36,12 +38,14 @@ export default class User extends compose(BaseModel, AuthFinder) {
@column.dateTime({
columnName: "created_at",
serializeAs: "createdAt",
autoCreate: true,
})
declare createdAt: DateTime
@column.dateTime({
columnName: "updated_at",
serializeAs: "updatedAt",
autoCreate: true,
autoUpdate: true,
})

View File

@ -1,7 +1,7 @@
import { defineConfig, drivers } from '@adonisjs/core/hash'
import { defineConfig, drivers } from "@adonisjs/core/hash"
const hashConfig = defineConfig({
default: 'scrypt',
default: "scrypt",
list: {
scrypt: drivers.scrypt({
@ -19,6 +19,6 @@ export default hashConfig
* Inferring types for the list of hashers you have configured
* in your application.
*/
declare module '@adonisjs/core/types' {
declare module "@adonisjs/core/types" {
export interface HashersList extends InferHashers<typeof hashConfig> {}
}

View File

@ -4,7 +4,7 @@ export default class CreateUsersTable extends BaseSchema {
protected tableName = "users"
public override async up(): Promise<void> {
await this.schema.createTable(this.tableName, (table) => {
void this.schema.createTable(this.tableName, (table) => {
table.increments("id").notNullable()
table.string("full_name").nullable()
table.string("email", 254).notNullable().unique()
@ -16,6 +16,6 @@ export default class CreateUsersTable extends BaseSchema {
}
public override async down(): Promise<void> {
await this.schema.dropTable(this.tableName)
void this.schema.dropTable(this.tableName)
}
}

View File

@ -4,7 +4,7 @@ export default class CreateAccessTokensTable extends BaseSchema {
protected tableName = "auth_access_tokens"
public override async up(): Promise<void> {
await this.schema.createTable(this.tableName, (table) => {
void this.schema.createTable(this.tableName, (table) => {
table.increments("id")
table
.integer("tokenable_id")
@ -26,6 +26,6 @@ export default class CreateAccessTokensTable extends BaseSchema {
}
public override async down(): Promise<void> {
await this.schema.dropTable(this.tableName)
void this.schema.dropTable(this.tableName)
}
}

View File

@ -0,0 +1,3 @@
import { BaseModel, CamelCaseNamingStrategy } from "@adonisjs/lucid/orm"
BaseModel.namingStrategy = new CamelCaseNamingStrategy()

View File

@ -9,7 +9,7 @@ services:
MARIADB_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_DATABASE: ${DATABASE_NAME}
command:
command: |
--innodb_buffer_pool_size=4G
--key-buffer-size=4G
--innodb_log_buffer_size=256M
@ -33,9 +33,9 @@ services:
environment:
ADMINER_DEFAULT_SERVER: "wikipedia-solver-dev-database"
volumes:
- "./adminer/default-orange.css:/var/www/html/adminer.css"
- "./adminer/logo.png:/var/www/html/logo.png"
- "./adminer/fonts/:/var/www/html/fonts"
- "./data/adminer/default-orange.css:/var/www/html/adminer.css"
- "./data/adminer/logo.png:/var/www/html/logo.png"
- "./data/adminer/fonts/:/var/www/html/fonts"
volumes:
wikipedia-solver-dev-mariadb-data:

View File

@ -35,7 +35,7 @@ services:
MARIADB_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_DATABASE: ${DATABASE_NAME}
command:
command: |
--innodb_buffer_pool_size=4G
--key-buffer-size=4G
--innodb_log_buffer_size=256M

View File

@ -9,7 +9,7 @@ services:
MARIADB_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MARIADB_DATABASE: ${DATABASE_NAME}
command:
command: |
--innodb_buffer_pool_size=4G
--key-buffer-size=4G
--innodb_log_buffer_size=256M

File diff suppressed because it is too large Load Diff