@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 'url';
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 environmentPath = environments[chosenEnvironment];
74
- const environmentAbsolutePath = pathToFileURL(path.join(srcPath, "..", environmentPath.file)).href;
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
  }
@@ -19,6 +19,7 @@ export class StelliaUtils {
19
19
  this.client.getEnvironment()
20
20
  .then((environment) => {
21
21
  this.environment = environment;
22
+ console.log("Environment loaded");
22
23
  })
23
24
  .catch((error) => console.error(error));
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stelliajs/framework",
3
- "version": "1.2.0-dev-1",
3
+ "version": "1.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {