mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
fix createApp() fn doesn't require config, fix admin controller main entry
This commit is contained in:
@@ -132,7 +132,7 @@ export class App<DB = any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createApp(config: CreateAppConfig) {
|
export function createApp(config: CreateAppConfig = {}) {
|
||||||
let connection: Connection | undefined = undefined;
|
let connection: Connection | undefined = undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const htmlBkndContextReplace = "<!-- BKND_CONTEXT -->";
|
|||||||
export type AdminControllerOptions = {
|
export type AdminControllerOptions = {
|
||||||
basepath?: string;
|
basepath?: string;
|
||||||
html?: string;
|
html?: string;
|
||||||
forceDev?: boolean;
|
forceDev?: boolean | { mainPath: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
export class AdminController implements ClassController {
|
export class AdminController implements ClassController {
|
||||||
@@ -108,7 +108,10 @@ export class AdminController implements ClassController {
|
|||||||
|
|
||||||
if (this.options.html) {
|
if (this.options.html) {
|
||||||
if (this.options.html.includes(htmlBkndContextReplace)) {
|
if (this.options.html.includes(htmlBkndContextReplace)) {
|
||||||
return this.options.html.replace(htmlBkndContextReplace, bknd_context);
|
return this.options.html.replace(
|
||||||
|
htmlBkndContextReplace,
|
||||||
|
"<script>" + bknd_context + "</script>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.warn(
|
console.warn(
|
||||||
@@ -119,6 +122,10 @@ export class AdminController implements ClassController {
|
|||||||
|
|
||||||
const configs = this.app.modules.configs();
|
const configs = this.app.modules.configs();
|
||||||
const isProd = !isDebug() && !this.options.forceDev;
|
const isProd = !isDebug() && !this.options.forceDev;
|
||||||
|
const mainPath =
|
||||||
|
typeof this.options.forceDev === "object" && "mainPath" in this.options.forceDev
|
||||||
|
? this.options.forceDev.mainPath
|
||||||
|
: "/src/ui/main.tsx";
|
||||||
|
|
||||||
const assets = {
|
const assets = {
|
||||||
js: "main.js",
|
js: "main.js",
|
||||||
@@ -172,13 +179,14 @@ export class AdminController implements ClassController {
|
|||||||
)}
|
)}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="root" />
|
||||||
<div id="app" />
|
<div id="app" />
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: bknd_context
|
__html: bknd_context
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!isProd && <script type="module" src="/src/ui/main.tsx" />}
|
{!isProd && <script type="module" src={mainPath} />}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user