adminforth 2.5.0 → 2.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.
package/commands/callTsProxy.js
CHANGED
|
@@ -3,18 +3,28 @@ import { spawn } from "child_process";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
+
import dotenv from "dotenv";
|
|
6
7
|
|
|
7
8
|
const currentFilePath = import.meta.url;
|
|
8
9
|
const currentFileFolder = path.dirname(currentFilePath).replace("file:", "");
|
|
9
10
|
|
|
10
11
|
export function callTsProxy(tsCode, silent=false) {
|
|
11
12
|
|
|
13
|
+
const currentDirectory = process.cwd();
|
|
14
|
+
const envPath = path.resolve(currentDirectory, ".env");
|
|
15
|
+
const envLocalPath = path.resolve(currentDirectory, ".env.local");
|
|
16
|
+
if (fs.existsSync(envLocalPath)) {
|
|
17
|
+
dotenv.config({ path: envLocalPath, override: true });
|
|
18
|
+
}
|
|
19
|
+
if (fs.existsSync(envPath)) {
|
|
20
|
+
dotenv.config({ path: envPath, override: true });
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
process.env.HEAVY_DEBUG && console.log("🌐 Calling tsproxy with code:", path.join(currentFileFolder, "proxy.ts"));
|
|
13
24
|
return new Promise((resolve, reject) => {
|
|
14
|
-
const child = spawn("tsx", [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
const child = spawn("tsx", [path.join(currentFileFolder, "proxy.ts")], {
|
|
26
|
+
env: process.env,
|
|
27
|
+
});
|
|
18
28
|
let stdout = "";
|
|
19
29
|
let stderr = "";
|
|
20
30
|
|
|
@@ -3,9 +3,6 @@ import AdminForth from 'adminforth';
|
|
|
3
3
|
import usersResource from "./resources/adminuser.js";
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import dotenv from "dotenv";
|
|
7
|
-
dotenv.config({ path: '.env.local', override: true });
|
|
8
|
-
dotenv.config({ path: '.env', override: true });
|
|
9
6
|
|
|
10
7
|
const ADMIN_BASE_URL = '';
|
|
11
8
|
|