feat/deno (#219)

* update bun version

* fix module manager's em reference

* add basic deno example

* finalize
This commit is contained in:
dswbx
2025-07-22 20:32:07 +02:00
committed by GitHub
parent ca55503e66
commit bebf9e0411
6 changed files with 33 additions and 2 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
- name: Setup Bun - name: Setup Bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: "1.2.14" bun-version: "1.2.19"
- name: Install dependencies - name: Install dependencies
working-directory: ./app working-directory: ./app
+1
View File
@@ -13,6 +13,7 @@
"bugs": { "bugs": {
"url": "https://github.com/bknd-io/bknd/issues" "url": "https://github.com/bknd-io/bknd/issues"
}, },
"packageManager": "bun@1.2.19",
"engines": { "engines": {
"node": ">=22" "node": ">=22"
}, },
+7
View File
@@ -67,6 +67,13 @@ export class EntityManager<TBD extends object = DefaultDB> {
return new EntityManager(this._entities, this.connection, this._relations, this._indices); return new EntityManager(this._entities, this.connection, this._relations, this._indices);
} }
clear(): this {
this._entities = [];
this._relations = [];
this._indices = [];
return this;
}
get entities(): Entity[] { get entities(): Entity[] {
return this._entities; return this._entities;
} }
+3 -1
View File
@@ -267,7 +267,9 @@ export class ModuleManager {
ctx(rebuild?: boolean): ModuleBuildContext { ctx(rebuild?: boolean): ModuleBuildContext {
if (rebuild) { if (rebuild) {
this.rebuildServer(); this.rebuildServer();
this.em = new EntityManager([], this.connection, [], [], this.emgr); this.em = this.em
? this.em.clear()
: new EntityManager([], this.connection, [], [], this.emgr);
this.guard = new Guard(); this.guard = new Guard();
} }
+14
View File
@@ -0,0 +1,14 @@
import { createRuntimeApp } from "bknd/adapter";
const app = await createRuntimeApp({
connection: {
url: "file:./data.db",
},
adminOptions: {
// currently needs a hosted version of the static assets
assetsPath: "https://cdn.bknd.io/bknd/static/0.15.0-rc.9/",
},
});
// @ts-ignore
Deno.serve(app.fetch);
+7
View File
@@ -0,0 +1,7 @@
{
"name": "bknd-deno-example",
"private": true,
"dependencies": {
"bknd": "file:../../app"
}
}