Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
cache: "pnpm"
- run: make install
- run: make build
Expand All @@ -24,11 +24,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
cache: "pnpm"
- run: make install
- run: make build
Expand Down
42 changes: 42 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# lefun SDK

Necessary libraries to build games at [lefun.fun][0] .

## Repo structure

This is a pnpm mono repo.
We use typescript.

The main packages are in `packages/<name>`.

Test games at `games/<game>`

## Checks

You can run these checks are the root when you want to make sure everything is ok.

### Fixable linting

```sh
make fix
```

### Check linting, types, etc

```sh
make check
```

### Test

```sh
make test
```

### Building

```sh
make build
```

[0]: https://lefun.fun
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default tseslint.config(
},
},
},
reactHooks.configs["recommended-latest"],
reactHooks.configs["flat"]["recommended-latest"],
// simple-import-sort
{
plugins: {
Expand Down
2 changes: 1 addition & 1 deletion games/game1-v2.7.0/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [["@babel/preset-react", { "runtime": "automatic" }]],
"plugins": ["macros"]
"plugins": ["@lingui/babel-plugin-lingui-macro"]
}
7 changes: 2 additions & 5 deletions games/game1-v2.7.0/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { LinguiConfig } from "@lingui/conf";
import { formatter } from "@lingui/format-po";

import { lefunExtractor } from "@lefun/ui/lefunExtractor";

Expand All @@ -7,18 +8,14 @@ import { game } from "./src/game";
const config: LinguiConfig = {
locales: ["en", "fr"],
sourceLocale: "en",
compileNamespace: "es",
catalogs: [
{
path: "<rootDir>/src/locales/{locale}/messages",
include: ["src"],
},
],
format: "po",
format: formatter({ lineNumbers: false }),
extractors: [lefunExtractor(game)],
formatOptions: {
lineNumbers: false,
},
};

export default config;
45 changes: 20 additions & 25 deletions games/game1-v2.7.0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,34 @@
"./index.css": "./dist/index.css"
},
"scripts": {
"build": "rm -rf ./dist && pnpm rollup --config",
"watch": "pnpm rollup --config --watch",
"build": "rm -rf ./dist && vite build && cp -r src/locales dist/ && tsc --emitDeclarationOnly",
"watch": "vite build --watch",
"dev": "pnpm vite --host",
"lingui:compile": "pnpm lingui compile",
"lingui:extract": "pnpm lingui extract",
"test": "pnpm vitest run"
},
"devDependencies": {
"@babel/preset-react": "^7.24.7",
"@babel/preset-react": "^7.28.5",
"@lefun/core": "workspace:*",
"@lefun/dev-server": "workspace:*",
"@lefun/game": "workspace:*",
"@lefun/ui": "workspace:*",
"@lingui/cli": "^4.11.2",
"@lingui/conf": "^4.11.2",
"@lingui/macro": "^4.11.2",
"@lingui/react": "^4.11.2",
"@lingui/vite-plugin": "^4.11.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup": "^4.18.1",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-postcss": "^4.0.2",
"typescript": "^5.5.4",
"vite": "^5.3.4",
"vitest": "^2.0.5"
"@lingui/babel-plugin-lingui-macro": "^6.0.1",
"@lingui/cli": "^6.0.1",
"@lingui/conf": "^6.0.1",
"@lingui/format-po": "^6.0.1",
"@lingui/react": "^6.0.1",
"@lingui/vite-plugin": "^6.0.1",
"@rolldown/plugin-babel": "^0.2.3",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.2",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"typescript": "^6.0.3",
"vite": "^8.0.13",
"vitest": "^4.1.6"
},
"dependencies": {
"classnames": "^2.5.1"
Expand All @@ -63,7 +58,7 @@
"@lefun/core": "workspace:*",
"@lefun/game": "workspace:*",
"@lefun/ui": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "^19.2.6",
"react-dom": "^19.2.6"
}
}
45 changes: 0 additions & 45 deletions games/game1-v2.7.0/rollup.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion games/game1-v2.7.0/src/Board.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./index.css";

import { Trans } from "@lingui/macro";
import { Trans } from "@lingui/react/macro";
import classNames from "classnames";
import { useEffect, useState } from "react";

Expand Down
1 change: 1 addition & 0 deletions games/game1-v2.7.0/src/css.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "*.css";
1 change: 0 additions & 1 deletion games/game1-v2.7.0/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { messages as fr } from "./locales/fr/messages";
await render({
board: async () => {
const { default: Board } = await import("./Board");
// @ts-expect-error the import is there even if TS does not see it!
await import("./index.css");
return <Board />;
},
Expand Down
3 changes: 2 additions & 1 deletion games/game1-v2.7.0/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"esModuleInterop": true,
"outDir": "dist",
"declarationDir": "dist/types",
"rootDir": "./src",
"jsx": "preserve",
"moduleResolution": "bundler"
},
"include": ["src/**/*", "lingui.config.ts"]
"include": ["src/**/*"]
}
38 changes: 29 additions & 9 deletions games/game1-v2.7.0/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
import { lingui } from "@lingui/vite-plugin";
import { lingui, linguiTransformerBabelPreset } from "@lingui/vite-plugin";
import babel from "@rolldown/plugin-babel";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
react({
babel: {
plugins: ["macros"],
},
}),
react(),
babel({ presets: [linguiTransformerBabelPreset()] }),
lingui(),
],
resolve: {
dedupe: ["react", "react-dom"],
mainFields: ["module", "main"],
build: {
lib: {
entry: {
game: "src/game.ts",
ui: "src/ui.tsx",
backend: "src/backend.ts",
},
formats: ["es"],
},
rollupOptions: {
external: [
"@lingui/react",
"react",
"react/jsx-runtime",
"react-dom",
"@lefun/core",
"@lefun/game",
"@lefun/ui",
],
output: {
assetFileNames: (info) =>
info.name?.endsWith(".css") ? "index.css" : "[name][extname]",
},
},
sourcemap: true,
},
});
29 changes: 20 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,29 @@
"check": "pnpm check-eslint && pnpm check-prettier && pnpm check-types"
},
"dependencies": {
"lerna": "^8.1.6"
"lerna": "^9.0.7"
},
"private": true,
"devDependencies": {
"@eslint/js": "^9.31.0",
"@eslint/js": "^10.0.1",
"@types/eslint": "^9.6.1",
"eslint": "^9.31.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.37.0"
"eslint": "^10.4.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-simple-import-sort": "^13.0.0",
"prettier": "^3.8.3",
"typescript": "^6.0.3",
"typescript-eslint": "^8.59.3"
},
"packageManager": "pnpm@9.4.0"
"pnpm": {
"overrides": {
"handlebars": ">=4.7.9"
}
},
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": ">=11.0.0",
"onFail": "download"
}
}
}
14 changes: 5 additions & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
"scripts": {
"build": "pnpm run clean && pnpm run compile",
"clean": "rm -rf ./dist",
"compile": "rollup --config",
"watch": "rollup --config --watch",
"compile": "esbuild src/index.ts --bundle --format=esm --outdir=dist/esm --sourcemap --packages=external && tsc --emitDeclarationOnly",
"watch": "esbuild src/index.ts --bundle --format=esm --outdir=dist/esm --sourcemap --packages=external --watch",
"test": "vitest run src"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"rollup": "^2.79.1",
"rollup-plugin-typescript2": "^0.31.2",
"tslib": "^2.6.3",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
"esbuild": "^0.28.0",
"typescript": "^6.0.3",
"vitest": "^4.1.6"
}
}
13 changes: 0 additions & 13 deletions packages/core/rollup.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const metaAddUserToMatch = ({

// Index at which we add the user. If it's a bot, we add them at the end. If it's a
// human we add him before the bots.
let index = 0;
let index: number;
if (isBot) {
index = meta.players.allIds.length;
} else {
Expand Down
Loading