Skip to content

Commit

Permalink
feat: import tool with ts-node
Browse files Browse the repository at this point in the history
  • Loading branch information
7185 committed Jan 8, 2025
1 parent 0982977 commit a2bb7c2
Show file tree
Hide file tree
Showing 18 changed files with 965 additions and 527 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ $ prisma generate --schema backend/prisma/schema.prisma --generator client-py
```
### Create an empty database and import the dump files

> [!CAUTION]
> If the database already exists, the world data will be overwritten.
>
#### Node backend
```bash
$ npx -w backend prisma db push --skip-generate
$ cd backend
$ node --import 'data:text/javascript,import {register} from "node:module"; import {pathToFileURL} from "node:url"; register("ts-node/esm", pathToFileURL("./"));' src/tools/import-lemuria.mts
```
> [!WARNING]
> There is no node script to import worlds yet, so you have to use the python one instead.

#### Python backend
```bash
Expand All @@ -74,8 +77,6 @@ $ python tools/import_lemuria.py
```

This will create and init the database `backend/app.db` using the data in `dumps/atlemuria.txt` and `dumps/proplemuria.txt`.
> [!CAUTION]
> If the database already exists, the world data will be overwritten.

### Serve the world resource files

Expand Down
4 changes: 2 additions & 2 deletions action-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
},
"devDependencies": {
"@eslint/js": "^9.10.0",
"@swc/core": "^1.10.4",
"@swc/core": "^1.10.6",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^9.17.0",
"globals": "^15.14.0",
"jiti": "^2.4.2",
"prettier": "^3.4.2",
"ts-node": "^10.9.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.19.0",
"typescript-eslint": "^8.19.1",
"unplugin-swc": "^1.5.1",
"vitest": "^2.1.6"
}
Expand Down
9 changes: 3 additions & 6 deletions action-parser/src/action.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ export const colorStringToRGB = (color: string) => {
// AW considers everything white at this point
return rgb(255, 255, 255)
}
const red = (colorValue >> 16) % 256
const green = (colorValue >> 8) % 256
const blue = (colorValue >> 0) % 256
return rgb(
red < 0 ? red + 256 : red,
green < 0 ? green + 256 : green,
blue < 0 ? blue + 256 : blue
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255
)
}

Expand Down
8 changes: 4 additions & 4 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@nestjs/platform-fastify": "^10.4.15",
"@nestjs/platform-ws": "^10.4.15",
"@nestjs/websockets": "^10.4.15",
"@prisma/client": "^6.1.0",
"@prisma/client": "^6.2.1",
"axios": "^1.7.9",
"cache-manager": "^5.7.6",
"class-validator": "^0.14.1",
Expand All @@ -50,22 +50,22 @@
"@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.15",
"@swc/cli": "^0.5.2",
"@swc/core": "^1.10.4",
"@swc/core": "^1.10.6",
"@types/node": "^20.17.7",
"@types/supertest": "^6.0.2",
"@types/ws": "^8.5.13",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^9.17.0",
"jiti": "^2.4.2",
"prettier": "^3.4.2",
"prisma": "^6.1.0",
"prisma": "^6.2.1",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.19.0",
"typescript-eslint": "^8.19.1",
"unplugin-swc": "^1.5.1",
"vitest": "^2.1.6"
}
Expand Down
Loading

0 comments on commit a2bb7c2

Please sign in to comment.