@xrystal/core 3.18.7 → 3.18.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.18.7",
4
+ "version": "3.18.8",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -10,18 +10,14 @@ export default class ConfigsService {
10
10
  this.#systemService = systemService;
11
11
  }
12
12
  load = async ({}) => {
13
+ const cwd = process.cwd();
13
14
  const tmp = this.#systemService.tmp;
14
15
  const extendConfigs = tmp.configs.loaders.configs.loadPath;
15
- let importedModule;
16
- const cwd = process.cwd();
17
- if (extendConfigs.startsWith('@/')) {
18
- const fullPath = path.join(cwd, extendConfigs.slice(2));
19
- importedModule = await import(pathToFileURL(fullPath).href);
20
- }
21
- else {
22
- const fullPath = path.resolve(tmp.configs.rootFolderPath, extendConfigs);
23
- importedModule = await import(pathToFileURL(fullPath).href);
24
- }
16
+ const fullPath = extendConfigs.startsWith('@/')
17
+ ? path.join(process.cwd(), extendConfigs.slice(2))
18
+ : path.resolve(tmp.configs.rootFolderPath, extendConfigs);
19
+ const fileUrl = pathToFileURL(fullPath).href;
20
+ const modulePromise = import(fileUrl);
25
21
  this.config = {
26
22
  worker: process.env.WORKER === 'true' ? true : false || false,
27
23
  nodeEnv: process.env.NODE_ENV,
@@ -46,8 +42,18 @@ export default class ConfigsService {
46
42
  secret: process.env.SECRET,
47
43
  cwd,
48
44
  env: process.env.NODE_ENV,
49
- ...importedModule.configs,
50
45
  };
46
+ try {
47
+ const moduleData = await modulePromise;
48
+ const importedConfigs = moduleData?.default || moduleData?.configs || moduleData || {};
49
+ this.config = {
50
+ ...this.config,
51
+ ...(typeof importedConfigs === 'object' ? importedConfigs : {})
52
+ };
53
+ }
54
+ catch (e) {
55
+ // error
56
+ }
51
57
  };
52
58
  setConfig(newConfigs) {
53
59
  const mergedData = {
@@ -1,6 +1,7 @@
1
1
  import { IService } from "../../utils";
2
2
  export default class SystemService implements IService {
3
3
  _tmp: Record<string, any>;
4
+ cwd: string;
4
5
  load: ({ tmp, }: {
5
6
  tmp: any;
6
7
  }) => Promise<void>;
@@ -1,5 +1,6 @@
1
1
  export default class SystemService {
2
2
  _tmp = {};
3
+ cwd = process.cwd();
3
4
  load = async ({ tmp, }) => {
4
5
  this._tmp = tmp;
5
6
  await this._systemLoader({});
package/x/tmp.yml CHANGED
@@ -7,7 +7,7 @@ configs:
7
7
 
8
8
  loaders:
9
9
  configs:
10
- loadPath: '@/source/utils/models/classes/configs.project.ts'
10
+ loadPath: '@/source/utils/helpers/configs/index'
11
11
 
12
12
  loggers:
13
13
  loadPath: logs