mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
feat/deno (#219)
* update bun version * fix module manager's em reference * add basic deno example * finalize
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "bknd-deno-example",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bknd": "file:../../app"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user