adminizer 4.5.0 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAdminizerViteDevMode(): boolean;
|
package/helpers/viteHelper.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
+
import { isAdminizerViteDevMode } from "./runtimeMode.js";
|
|
4
5
|
export function viteRender(routePrefix, assetName) {
|
|
5
|
-
const isViteDev =
|
|
6
|
+
const isViteDev = isAdminizerViteDevMode();
|
|
6
7
|
if (isViteDev) {
|
|
7
8
|
return `/${assetName}`;
|
|
8
9
|
}
|
package/lib/Adminizer.js
CHANGED
|
@@ -34,6 +34,7 @@ import { bindAiAssistant } from "../system/bindAiAssistant.js";
|
|
|
34
34
|
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler.js";
|
|
35
35
|
import { bindCors } from "../system/bindCors.js";
|
|
36
36
|
import bindHistory from "../system/bindHistory.js";
|
|
37
|
+
import { isAdminizerViteDevMode } from "../helpers/runtimeMode.js";
|
|
37
38
|
export class Adminizer {
|
|
38
39
|
// Preconfigures
|
|
39
40
|
/**
|
|
@@ -168,7 +169,7 @@ export class Adminizer {
|
|
|
168
169
|
// set cookie parser
|
|
169
170
|
this.app.use(cookieParser());
|
|
170
171
|
// Set vite middleware
|
|
171
|
-
const isViteDev =
|
|
172
|
+
const isViteDev = isAdminizerViteDevMode();
|
|
172
173
|
if (isViteDev)
|
|
173
174
|
await this.viteMiddleware();
|
|
174
175
|
this.emitter.emit('adminizer:init');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isAdminizerViteDevMode } from "../../helpers/runtimeMode.js";
|
|
2
2
|
export class WidgetHandler {
|
|
3
3
|
widgets = [];
|
|
4
4
|
adminizer;
|
|
@@ -108,7 +108,7 @@ export class WidgetHandler {
|
|
|
108
108
|
name: i18n.__(widget.name),
|
|
109
109
|
backgroundCSS: widget.backgroundCSS ?? null,
|
|
110
110
|
size: widget.size ?? null,
|
|
111
|
-
scriptUrl:
|
|
111
|
+
scriptUrl: isAdminizerViteDevMode() ? widget.jsPath.dev : widget.jsPath.production,
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.1",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.js",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"test:watch": "vitest --reporter verbose",
|
|
14
14
|
"start": "cross-env NO_SEED_DATA=true ORM=sequelize tsx --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
15
15
|
"start:waterline": "cross-env NO_SEED_DATA=true ORM=waterline tsx --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
16
|
-
"dev": "cross-env VITE_ENV=dev ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
17
|
-
"dev:no-seed": "cross-env VITE_ENV=dev NO_SEED_DATA=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
18
|
-
"dev:no-seed-clean": "cross-env VITE_ENV=dev NO_SEED_DATA=true CLEAN_TMP=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
19
|
-
"dev:waterline": "cross-env VITE_ENV=dev ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
20
|
-
"dev:waterline:no-seed": "cross-env VITE_ENV=dev NO_SEED_DATA=true ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
21
|
-
"dev:cors": "cross-env VITE_ENV=dev NO_SEED_DATA=true ORM=waterline FRONTEND_URL=http://localhost:8080 tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
16
|
+
"dev": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
17
|
+
"dev:no-seed": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev NO_SEED_DATA=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
18
|
+
"dev:no-seed-clean": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev NO_SEED_DATA=true CLEAN_TMP=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
19
|
+
"dev:waterline": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
20
|
+
"dev:waterline:no-seed": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev NO_SEED_DATA=true ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
21
|
+
"dev:cors": "cross-env ADMINIZER_VITE_ENV=dev VITE_ENV=dev NO_SEED_DATA=true ORM=waterline FRONTEND_URL=http://localhost:8080 tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
22
22
|
"build:assets": "vite build",
|
|
23
23
|
"compile:backend": "tsc -p src/tsconfig.json && node ./scripts/appendJsExtension.js",
|
|
24
24
|
"compile:ui": "tsc -p tsconfig.ui.json",
|
package/system/bindInertia.js
CHANGED
|
@@ -3,9 +3,10 @@ import inertia from "../lib/inertia/inertiaAdapter.js";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { InertiaMenuHelper } from "../helpers/inertiaMenuHelper.js";
|
|
6
|
+
import { isAdminizerViteDevMode } from "../helpers/runtimeMode.js";
|
|
6
7
|
export function bindInertia(adminizer) {
|
|
7
8
|
const viteRender = () => {
|
|
8
|
-
if (
|
|
9
|
+
if (isAdminizerViteDevMode()) {
|
|
9
10
|
return `
|
|
10
11
|
<script type="module">
|
|
11
12
|
import RefreshRuntime from "/@react-refresh"
|