@stelliajs/framework 1.2.0-dev-1 → 1.2.0
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.
|
@@ -11,6 +11,7 @@ export declare class StelliaClient<Ready extends boolean = boolean> extends Clie
|
|
|
11
11
|
getEnvironment: <CustomEnvironment extends EnvironmentConfiguration>() => Promise<CustomEnvironment>;
|
|
12
12
|
handleInteraction: (interaction: AnyInteraction) => Promise<void>;
|
|
13
13
|
private areManagersLoaded;
|
|
14
|
+
private static convertFilePathToProduction;
|
|
14
15
|
}
|
|
15
16
|
interface StelliaOptions {
|
|
16
17
|
managers: {
|
|
@@ -3,7 +3,7 @@ import { AutoCompleteManager, ButtonManager, CommandManager, ContextMenuManager,
|
|
|
3
3
|
import { StelliaUtils } from "./index.js";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
|
-
import { pathToFileURL } from
|
|
6
|
+
import { pathToFileURL } from "url";
|
|
7
7
|
export class StelliaClient extends Client {
|
|
8
8
|
utils;
|
|
9
9
|
managers = {};
|
|
@@ -70,8 +70,9 @@ export class StelliaClient extends Client {
|
|
|
70
70
|
if (!Object.keys(environments).includes(chosenEnvironment)) {
|
|
71
71
|
return reject(new Error("Invalid environment"));
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const
|
|
73
|
+
const environmentData = environments[chosenEnvironment];
|
|
74
|
+
const environmentPath = environmentData.production ? StelliaClient.convertFilePathToProduction(environmentData.file) : environmentData.file;
|
|
75
|
+
const environmentAbsolutePath = pathToFileURL(path.join(srcPath, "..", environmentPath)).href;
|
|
75
76
|
const environmentFile = await import(environmentAbsolutePath);
|
|
76
77
|
resolve(environmentFile.environment);
|
|
77
78
|
}
|
|
@@ -88,4 +89,7 @@ export class StelliaClient extends Client {
|
|
|
88
89
|
const managers = Object.values(this.managers);
|
|
89
90
|
return managers.length === 0 ? true : managers.every((manager) => manager.isManagerLoaded());
|
|
90
91
|
};
|
|
92
|
+
static convertFilePathToProduction = (filePath) => {
|
|
93
|
+
return filePath.replace("src", "dist").replace(".ts", ".js");
|
|
94
|
+
};
|
|
91
95
|
}
|