adminforth 1.1.84 → 1.1.86
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.
|
@@ -62,7 +62,7 @@ class CodeInjector {
|
|
|
62
62
|
return __awaiter(this, arguments, void 0, function* ({ command, verbose = false, cwd }) {
|
|
63
63
|
const nodeBinary = process.execPath; // Path to the Node.js binary running this script
|
|
64
64
|
const npmPath = path.join(path.dirname(nodeBinary), 'npm'); // Path to the npm executable
|
|
65
|
-
const env = Object.assign({
|
|
65
|
+
const env = Object.assign({ VITE_ADMINFORTH_PUBLIC_PATH: this.adminforth.config.baseUrl, FORCE_COLOR: '1' }, process.env);
|
|
66
66
|
console.log(`⚙️ Running npm ${command}...`);
|
|
67
67
|
console.time(`npm ${command} done in`);
|
|
68
68
|
const { stdout: out, stderr: err } = yield execAsync(`${nodeBinary} ${npmPath} ${command}`, {
|
|
@@ -525,7 +525,7 @@ class CodeInjector {
|
|
|
525
525
|
console.log(`⚙️ Running npm ${command}...`);
|
|
526
526
|
const nodeBinary = process.execPath;
|
|
527
527
|
const npmPath = path.join(path.dirname(nodeBinary), 'npm');
|
|
528
|
-
const env = Object.assign({
|
|
528
|
+
const env = Object.assign({ VITE_ADMINFORTH_PUBLIC_PATH: this.adminforth.config.baseUrl, FORCE_COLOR: '1' }, process.env);
|
|
529
529
|
const devServer = spawn(`${nodeBinary}`, [`${npmPath}`, ...command.split(' ')], {
|
|
530
530
|
cwd,
|
|
531
531
|
env,
|
|
@@ -17,7 +17,8 @@ export async function callApi({path, method, body=undefined}: {
|
|
|
17
17
|
},
|
|
18
18
|
body: JSON.stringify(body),
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
console.log('calling api, import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH', import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH);
|
|
21
|
+
const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
|
|
21
22
|
const r = await fetch(fullPath, options);
|
|
22
23
|
if (r.status == 401 ) {
|
|
23
24
|
useUserStore().unauthorize();
|
|
@@ -38,7 +38,7 @@ const customLogger = {
|
|
|
38
38
|
|
|
39
39
|
// https://vitejs.dev/config/
|
|
40
40
|
export default defineConfig({
|
|
41
|
-
base: process.env.
|
|
41
|
+
base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
|
|
42
42
|
server: {
|
|
43
43
|
port: 5173,
|
|
44
44
|
strictPort: true, // better predictability
|
package/modules/codeInjector.ts
CHANGED
|
@@ -75,7 +75,7 @@ class CodeInjector implements CodeInjectorType {
|
|
|
75
75
|
const npmPath = path.join(path.dirname(nodeBinary), 'npm'); // Path to the npm executable
|
|
76
76
|
|
|
77
77
|
const env = {
|
|
78
|
-
|
|
78
|
+
VITE_ADMINFORTH_PUBLIC_PATH: this.adminforth.config.baseUrl,
|
|
79
79
|
FORCE_COLOR: '1',
|
|
80
80
|
...process.env,
|
|
81
81
|
};
|
|
@@ -607,7 +607,7 @@ async watchForReprepare({ verbose }) {
|
|
|
607
607
|
const nodeBinary = process.execPath;
|
|
608
608
|
const npmPath = path.join(path.dirname(nodeBinary), 'npm');
|
|
609
609
|
const env = {
|
|
610
|
-
|
|
610
|
+
VITE_ADMINFORTH_PUBLIC_PATH: this.adminforth.config.baseUrl,
|
|
611
611
|
FORCE_COLOR: '1',
|
|
612
612
|
...process.env,
|
|
613
613
|
};
|
package/package.json
CHANGED
package/spa/src/utils.ts
CHANGED
|
@@ -17,7 +17,8 @@ export async function callApi({path, method, body=undefined}: {
|
|
|
17
17
|
},
|
|
18
18
|
body: JSON.stringify(body),
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
console.log('calling api, import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH', import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH);
|
|
21
|
+
const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
|
|
21
22
|
const r = await fetch(fullPath, options);
|
|
22
23
|
if (r.status == 401 ) {
|
|
23
24
|
useUserStore().unauthorize();
|
package/spa/vite.config.ts
CHANGED
|
@@ -38,7 +38,7 @@ const customLogger = {
|
|
|
38
38
|
|
|
39
39
|
// https://vitejs.dev/config/
|
|
40
40
|
export default defineConfig({
|
|
41
|
-
base: process.env.
|
|
41
|
+
base: process.env.VITE_ADMINFORTH_PUBLIC_PATH || '/',
|
|
42
42
|
server: {
|
|
43
43
|
port: 5173,
|
|
44
44
|
strictPort: true, // better predictability
|