Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e84372a
fix(ecs): rename createEntity to spawnEnity
Tchips46 Mar 21, 2025
2098d45
build: update dependencies
Exeloo Mar 25, 2025
99a488b
feat(common): add dependencies handler
Exeloo Mar 24, 2025
a9b57a1
feat: add dependencies to current libs
Exeloo Mar 24, 2025
cee49b5
feat: add dependencies handling
Exeloo Mar 24, 2025
8150abc
feat(core): add default libraries to constructor
Exeloo Mar 25, 2025
5e13419
feat(sound): init basic sound library
MartinFillon Sep 3, 2025
63ae1c9
feat(sound): add sound playing
MartinFillon Sep 4, 2025
f4c1fe6
feat(sound): add basic sound playing to example
MartinFillon Sep 8, 2025
7b30f7e
feat(app): add the ability to mute and unmute sounds
MartinFillon Sep 11, 2025
626947c
fix(exceptions): bad naming
MartinFillon Sep 14, 2025
3cb12d0
fix: change exception handling
Exeloo Sep 14, 2025
9e8bb4f
fix(common): update exception imports and adjust formatting in abstra…
Exeloo Sep 15, 2025
be1af91
feat(core): enhance type safety and execution context handling
Exeloo Sep 27, 2025
f4b4eff
feat(config): add initial configuration for libraries
Exeloo Sep 30, 2025
1e8d62e
chore(husky): update pre-push and commit-msg scripts for pnpm compati…
Exeloo Sep 30, 2025
839990d
build: upgrade dependencies and engines to latest versions
Exeloo Sep 30, 2025
84a77ec
chore(config): update nx and gitignore configurations, adjust prettie…
Exeloo Sep 30, 2025
df2e384
chore(example): update `pong` example to use workspace dependencies a…
Exeloo Sep 30, 2025
c4be159
feat(common, core, config): introduce configuration registry and vali…
Exeloo Sep 30, 2025
78da029
chore(husky): simplify pre-push script by adjusting pnpm command
Exeloo Sep 30, 2025
a7f4c8b
test(libs): include ConfigRegistry in library initialization test
Exeloo Sep 30, 2025
bac7cf8
fix(graphics-2d, ecs): update type handling in vertex buffer and libr…
Exeloo Sep 30, 2025
7e67a6e
feat(core): add `class-transformer` and `class-validator` dependencie…
Exeloo Sep 30, 2025
870bce1
feat(music): init basic music library
MartinFillon Sep 17, 2025
371eb7b
feat(music): finish music library and add an interface for mutable li…
MartinFillon Sep 30, 2025
cf61ce8
fix(music): versions issue
MartinFillon Sep 30, 2025
361aad0
chore: migrate to shared ESLint and Prettier configurations, remove p…
Exeloo Oct 1, 2025
925c7b5
chore: remove `pnpm-lock.yaml` to decouple dependency locking from th…
Exeloo Oct 1, 2025
7094038
chore: migrate packages to shared ESLint and Prettier configs
Exeloo Oct 2, 2025
940794c
chore: remove unnecessary `@types/node` and `typescript` dependencies…
Exeloo Oct 2, 2025
a502803
feat(ci): add build step to GitHub Actions tests workflow
Exeloo Oct 2, 2025
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
11 changes: 7 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:

- name: "Setup pnpm"
uses: pnpm/action-setup@v4
with:
run_install: false
# with:
# run_install: false

- name: "Setup node"
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "23.6.0"
node-version: 23.6.0
cache: "pnpm"

- name: "Install dependencies"
Expand All @@ -38,6 +38,9 @@ jobs:
with:
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}

- name: "Run build"
run: pnpm build

- name: "Run tests"
run: pnpm test:unit

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,5 @@ dist

# NX
.nx/
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
2 changes: 1 addition & 1 deletion .husky/commit-msg
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bun --no-install commitlint --edit "$1"
pnpm --no-install commitlint --edit "$1"
2 changes: 0 additions & 2 deletions .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pnpm lint-staged
pnpm fix
pnpm lint
5 changes: 4 additions & 1 deletion .husky/pre-push
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
bun nx run-many --target=lint,test:unit
pnpm clean
pnpm lint
pnpm build
pnpm test
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ pnpm-lock.yaml
package-lock.json
yarn.lock
bun.lock

/.nx/cache
/.nx/workspace-data
11 changes: 0 additions & 11 deletions .prettierrc

This file was deleted.

46 changes: 2 additions & 44 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
import pluginJs from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
import tseslint from "typescript-eslint";
import config from "@nanoforge/utils-eslint-config";

export default [
{ files: ["src/**/*.{ts}"] },
{ languageOptions: { globals: globals.node } },

pluginJs.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.strict,
eslintConfigPrettier,
{ ignores: ["**/*.js"] },
{
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{
disallowTypeAnnotations: true,
fixStyle: "inline-type-imports",
prefer: "type-imports",
},
],
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/member-ordering": [
"error",
{
default: [
"static-field",
"field",
"public-static-method",
"constructor",
"method",
"protected-method",
"private-method",
],
},
],
},
},
];
export default config;
2 changes: 1 addition & 1 deletion example/pong/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Allow you to build project and copy it to the loader, and then run the loader (C

```shell
./run.sh Loader
```
```
1,842 changes: 1,811 additions & 31 deletions example/pong/bun.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion example/pong/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import globals from "globals";
import tseslint from "typescript-eslint";

export default [
{ files: ["src/**/*.{js,mjs,cjs,ts}"] },
{
files: ["src/**/*.{ts}"],
},
{ languageOptions: { globals: globals.node } },

pluginJs.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.strict,
eslintConfigPrettier,
{ ignores: ["**/*.js", "**/*.d.ts"] },
{
rules: {
"@typescript-eslint/consistent-type-imports": [
Expand Down
23 changes: 15 additions & 8 deletions example/pong/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,28 @@
"typescript": "^5"
},
"optionalDependencies": {
"@nanoforge/common": "latest",
"@nanoforge/core": "latest",
"@nanoforge/asset-manager": "latest",
"@nanoforge/ecs": "latest",
"@nanoforge/graphics-2d": "latest"
"@nanoforge/common": "workspace:^",
"@nanoforge/core": "workspace:^",
"@nanoforge/asset-manager": "workspace:^",
"@nanoforge/config": "workspace:^",
"@nanoforge/ecs": "workspace:^",
"@nanoforge/graphics-2d": "workspace:^",
"@nanoforge/sound": "workspace:^"
},
"engines": {
"node": "23.6.0",
"bun": "1.2.4"
"bun": "1.2.23"
},
"packageManager": "[email protected].4",
"packageManager": "[email protected].23",
"lint-staged": {
"**/*.{js,ts,html,css}": [
"eslint --fix",
"prettier --write"
]
}
},
"workspaces": [
".",
"../../packages/*",
"../../libs/*"
]
}
20 changes: 13 additions & 7 deletions example/pong/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ECSLibrary } from "@nanoforge/ecs";
import { Graphics2DLibrary } from "@nanoforge/graphics-2d";
import { InputLibrary } from "@nanoforge/input";
import { InputEnum } from "@nanoforge/input";
import { SoundLibrary } from "@nanoforge/sound";

import {
Bounce,
Expand All @@ -22,16 +23,21 @@ export const ecsLibrary = new ECSLibrary();
export const app = NanoforgeFactory.createClient();
export const graphics = new Graphics2DLibrary();
export const inputs = new InputLibrary();
export const sounds = new SoundLibrary();
export const assetManager = new AssetManagerLibrary();

export const main = async (options: IRunOptions) => {
app.useGraphics(graphics);
app.useComponentSystem(ecsLibrary);
app.useAssetManager(new AssetManagerLibrary());
app.useAssetManager(assetManager);
app.useInput(inputs);
app.useSound(sounds);

await app.init(options);

const ball = ecsLibrary.createEntity();
sounds.load("test", "https://universal-soundbank.com/sounds/18782.mp3");

const ball = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(ball, new Velocity(0.04, 0));
ecsLibrary.addComponent(ball, new Position(0.5, 0));
ecsLibrary.addComponent(ball, new Bounce());
Expand All @@ -45,7 +51,7 @@ export const main = async (options: IRunOptions) => {
),
);

const bg = ecsLibrary.createEntity();
const bg = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(
bg,
new RectangleComponent(
Expand All @@ -57,7 +63,7 @@ export const main = async (options: IRunOptions) => {
),
);

const topWall = ecsLibrary.createEntity();
const topWall = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(
topWall,
new RectangleComponent(
Expand All @@ -69,7 +75,7 @@ export const main = async (options: IRunOptions) => {
ecsLibrary.addComponent(topWall, new Position(-1.8, 0.91));
ecsLibrary.addComponent(topWall, new Hitbox(3.6, 0.1));

const botWall = ecsLibrary.createEntity();
const botWall = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(
botWall,
new RectangleComponent(
Expand All @@ -81,7 +87,7 @@ export const main = async (options: IRunOptions) => {
ecsLibrary.addComponent(botWall, new Position(-1.8, -1));
ecsLibrary.addComponent(botWall, new Hitbox(3.6, 0.1));

const player1 = ecsLibrary.createEntity();
const player1 = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(player1, new Position(-1.8, -0.3));
ecsLibrary.addComponent(player1, new Velocity(0, 0.1));
ecsLibrary.addComponent(player1, new Hitbox(0.1, 0.5));
Expand All @@ -95,7 +101,7 @@ export const main = async (options: IRunOptions) => {
),
);

const player2 = ecsLibrary.createEntity();
const player2 = ecsLibrary.spawnEntity();
ecsLibrary.addComponent(player2, new Position(1.7, -0.3));
ecsLibrary.addComponent(player2, new Velocity(0, 0.1));
ecsLibrary.addComponent(player2, new Hitbox(0.1, 0.5));
Expand Down
6 changes: 5 additions & 1 deletion example/pong/src/systems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
RectangleComponent,
Velocity,
} from "./components";
import { ecsLibrary, graphics, inputs } from "./index";
import { ecsLibrary, graphics, inputs, sounds } from "./index";

export function move() {
const entities = ecsLibrary.getZipper([Bounce, Position, Velocity]);
Expand All @@ -25,9 +25,13 @@ export function bounce() {
entities.forEach((entity) => {
if (entity.Position.x >= 1.6 || entity.Position.x <= -1.6) {
entity.Velocity.x = -entity.Velocity.x;

sounds.play("test");
}
if (entity.Position.y >= 1 || entity.Position.y <= -1) {
entity.Velocity.y = -entity.Velocity.y;

sounds.play("test");
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions example/pong/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"paths": {
}
"paths": {}
}
}
7 changes: 0 additions & 7 deletions example/pong/update.sh

This file was deleted.

3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"packages": [
"packages/*"
"packages/*",
"utils/*"
],
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"cache": true
}
}
}
}
37 changes: 13 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,28 @@
"test:unit": "lerna run test:unit",
"test:e2e": "lerna run test:e2e",
"prepare": "husky",
"taze": "taze major -w && lerna run taze",
"lint-staged": "lint-staged"
"taze": "taze major -w && lerna run taze"
},
"dependencies": {
"tslib": "^2.8.1"
},
"devDependencies": {
"@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0",
"@eslint/js": "^9.22.0",
"@commitlint/cli": "^20.0.0",
"@commitlint/config-conventional": "^20.0.0",
"@nanoforge/utils-eslint-config": "workspace:^",
"@nanoforge/utils-prettier-config": "workspace:^",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/node": "^22.13.10",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-format": "^1.0.1",
"eslint-plugin-prettier": "^5.2.3",
"globals": "^16.0.0",
"@types/node": "^22.18.7",
"eslint": "^9.36.0",
"husky": "^9.1.7",
"lerna": "^8.2.1",
"lint-staged": "^15.4.3",
"prettier": "^3.5.3",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.0"
"lerna": "^8.2.4",
"prettier": "^3.6.2",
"taze": "^19.7.0",
"typescript": "^5.9.2"
},
"engines": {
"node": "23.6.0",
"pnpm": "10.6.2"
"pnpm": "10.17.1"
},
"packageManager": "[email protected]",
"lint-staged": {
"**/*.{js,ts}": [
"eslint --fix",
"prettier --write"
]
}
"packageManager": "[email protected]"
}
11 changes: 0 additions & 11 deletions packages/asset-manager/.prettierrc

This file was deleted.

Loading
Loading