-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description - Split web app & create a `chessboard` package
- Loading branch information
1 parent
716d3c8
commit 6cc487a
Showing
63 changed files
with
210 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"web": minor | ||
"@chess-d/chessboard": patch | ||
--- | ||
|
||
# Logs | ||
|
||
- refactor: split web app | ||
- Split web app & create a `chessboard` package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
"web": patch | ||
"@chess-d/chessboard": patch | ||
--- | ||
|
||
# Logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
{ | ||
"name": "web", | ||
"private": true, | ||
"version": "0.1.1", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite --clearScreen false --host", | ||
"build": "lint && vite build", | ||
"build": "pnpm run lint && vite build", | ||
"preview": "vite preview", | ||
"lint": "tsc && eslint \"src/**/*.ts\"", | ||
"test": "jest --passWithNoTests" | ||
}, | ||
"devDependencies": { | ||
"@chess-d/configs": "workspace:*", | ||
"@types/three": "^0.166.0", | ||
"reflect-metadata": "^0.2.0", | ||
"tsyringe": "^4.8.0" | ||
}, | ||
"dependencies": { | ||
"@chess-d/rapier-physics": "workspace:*", | ||
"@chess-d/ai": "workspace:*", | ||
"@chess-d/chessboard": "workspace:*", | ||
"@quick-threejs/reactive": "^0.1.14", | ||
"@quick-threejs/utils": "^0.1.9", | ||
"chess.js": "1.0.0-beta.8", | ||
"rxjs": "^7.8.1", | ||
"threads": "^1.7.0", | ||
"three": "^0.166.1", | ||
"typescript-ioc": "^3.2.2" | ||
"three": "^0.166.1" | ||
}, | ||
"devDependencies": { | ||
"@chess-d/configs": "workspace:*", | ||
"@types/three": "^0.166.0", | ||
"reflect-metadata": "^0.2.0", | ||
"tsyringe": "^4.8.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { expose } from "threads/worker"; | ||
import { Subject } from "rxjs"; | ||
import { Chess } from "chess.js"; | ||
import { register, SupportedAiModel } from "@chess-d/ai"; | ||
import { AppLifecycleState } from "@quick-threejs/reactive"; | ||
import { ExposedAppModule } from "@quick-threejs/reactive/worker"; | ||
|
||
const lifecycle$$ = new Subject<AppLifecycleState>(); | ||
const lifecycle$ = lifecycle$$.pipe(); | ||
|
||
export const performAI = () => { | ||
console.log("AI is performing..."); | ||
|
||
const game = new Chess(); | ||
const aiModel = register(SupportedAiModel.zeyu, game); | ||
|
||
const bestMove = aiModel?.getMove(game.turn()); | ||
|
||
if (bestMove) game.move(bestMove); | ||
|
||
console.log("Best move:", bestMove); | ||
}; | ||
|
||
performAI(); | ||
|
||
expose({ | ||
lifecycle$: () => lifecycle$ | ||
} satisfies ExposedAppModule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import "reflect-metadata"; | ||
|
||
import { register } from "@quick-threejs/reactive"; | ||
import { register, RegisterModule } from "@quick-threejs/reactive"; | ||
import { GUI } from "three/examples/jsm/libs/lil-gui.module.min.js"; | ||
|
||
import "./assets/styles/main.css"; | ||
|
||
const location = new URL( | ||
"./main.worker.ts", | ||
import.meta.url | ||
) as unknown as string; | ||
const enableDebug = !!import.meta.env?.DEV; | ||
|
||
const onReady = (app: RegisterModule) => { | ||
const gui = app.gui() as GUI | undefined; | ||
gui?.close(); | ||
|
||
app.workerPool().run({ | ||
payload: { | ||
path: new URL("./ai.worker.ts", import.meta.url) as unknown as string, | ||
subject: {} | ||
} | ||
}); | ||
}; | ||
|
||
register({ | ||
location: new URL("./main.worker.ts", import.meta.url) as unknown as string, | ||
enableDebug: !!import.meta.env?.DEV, | ||
location, | ||
enableDebug, | ||
axesSizes: 5, | ||
gridSizes: 10, | ||
withMiniCamera: true, | ||
onReady: (app) => { | ||
const gui = app.gui() as GUI | undefined; | ||
gui?.close(); | ||
} | ||
onReady | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
import "reflect-metadata"; | ||
|
||
import { launchApp } from "@quick-threejs/reactive/worker"; | ||
import { setup as onReady } from "@chess-d/chessboard"; | ||
|
||
import { setupCoreModule } from "./core/core.util"; | ||
|
||
launchApp({ | ||
onReady: (app) => setupCoreModule(app) | ||
}); | ||
launchApp({ onReady }); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
const configs = { | ||
files: ["./src/**/*.js?(x)", "./src/**/*.ts?(x)"], | ||
languageOptions: { | ||
parserOptions: { | ||
project: true | ||
} | ||
} | ||
}; | ||
|
||
export default [ | ||
...compat.extends("./node_modules/@chess-d/configs/eslint/base.js"), | ||
configs | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import configs from "@chess-d/configs/jest/base.js"; | ||
|
||
/** @type {import('jest').Config} */ | ||
export default { | ||
...configs | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@chess-d/chessboard", | ||
"private": true, | ||
"version": "0.1.1", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "tsc --watch", | ||
"build": "tsc", | ||
"test": "jest --passWithNoTests" | ||
}, | ||
"main": "./dist/main.js", | ||
"types": "./dist/main.d.ts", | ||
"dependencies": { | ||
"chess.js": "1.0.0-beta.8", | ||
"@quick-threejs/utils": "^0.1.9", | ||
"@chess-d/rapier-physics": "workspace:*", | ||
"@quick-threejs/reactive": "^0.1.14", | ||
"rxjs": "^7.8.1", | ||
"threads": "^1.7.0", | ||
"three": "^0.166.1", | ||
"typescript-ioc": "^3.2.2" | ||
}, | ||
"devDependencies": { | ||
"@chess-d/configs": "workspace:*", | ||
"@types/three": "^0.166.0", | ||
"reflect-metadata": "^0.2.0", | ||
"tsyringe": "^4.8.0", | ||
"typescript": "^5.5.3" | ||
}, | ||
"keywords": [ | ||
"chess", | ||
"chessboard" | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./core/core.util"; | ||
export * from "./shared"; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "@chess-d/configs/typescript/base.json", | ||
"compilerOptions": { | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
|
||
"isolatedModules": false, | ||
|
||
"outDir": "./dist" | ||
}, | ||
"include": ["src"], | ||
"exclude": ["*.config.cjs", "*.config.js", "*.config.ts"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.