nextemos 5.0.10 → 5.0.11

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.
@@ -6,6 +6,5 @@ export interface NextemosConfig {
6
6
  KEYCLOAK_URL: string;
7
7
  }
8
8
  export declare const defaultConfig: NextemosConfig;
9
- declare let cachedConfig: NextemosConfig;
10
- export declare function getConfig(): Promise<NextemosConfig>;
11
- export default cachedConfig;
9
+ declare const NEXTEMOS_CONFIG: NextemosConfig;
10
+ export default NEXTEMOS_CONFIG;
@@ -1,71 +1,23 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.defaultConfig = void 0;
13
- exports.getConfig = getConfig;
14
- const cosmiconfig_1 = require("cosmiconfig");
15
4
  exports.defaultConfig = {
16
- API_URL: "https://api.proj-e.com",
5
+ API_URL: "",
17
6
  USE_API_URL: true,
18
- CDN_URL: "https://cdn.proj-e.com",
19
- CDN_PROVIDER: "medianova",
20
- KEYCLOAK_URL: "https://identity.proj-e.com",
7
+ CDN_URL: "",
8
+ CDN_PROVIDER: "",
9
+ KEYCLOAK_URL: "",
21
10
  };
22
- function getConfigPath() {
23
- // For Node.js/Next.js environments
24
- if (typeof process !== 'undefined' && process.cwd) {
25
- return process.cwd();
26
- }
27
- // For React Native, we need to handle the case differently
28
- // as process.cwd() might not be available
29
- if (typeof __dirname !== 'undefined') {
30
- return __dirname;
31
- }
32
- // Fallback for browser environments
33
- return '.';
11
+ // Try to read the config file synchronously at build time
12
+ let loadedConfig;
13
+ try {
14
+ // Using require to load the config file at build time
15
+ // require will resolve the path relative to the current file
16
+ loadedConfig = require(`${__dirname}/../../../nextemos-config.json`);
34
17
  }
35
- const explorer = (0, cosmiconfig_1.cosmiconfig)('nextemos', {
36
- searchPlaces: [
37
- 'nextemos-config.json',
38
- 'nextemos.config.js',
39
- 'nextemos.config.json',
40
- '.nextemosrc',
41
- '.nextemosrc.json',
42
- '.nextemosrc.yaml',
43
- '.nextemosrc.yml',
44
- '.nextemosrc.js',
45
- 'package.json',
46
- ]
47
- });
48
- let cachedConfig = exports.defaultConfig;
49
- function getConfig() {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- try {
52
- const configPath = getConfigPath();
53
- const result = yield explorer.search(configPath);
54
- if (!result || !result.config) {
55
- return exports.defaultConfig;
56
- }
57
- // Merge with default config to ensure all required fields exist
58
- cachedConfig = Object.assign(Object.assign({}, exports.defaultConfig), result.config);
59
- return cachedConfig;
60
- }
61
- catch (error) {
62
- console.warn('Failed to load nextemos config, using default config:', error);
63
- return exports.defaultConfig;
64
- }
65
- });
18
+ catch (error) {
19
+ loadedConfig = exports.defaultConfig;
66
20
  }
67
- // Initialize the config
68
- getConfig().catch(console.error);
69
- // Export the cached config for synchronous access
70
- // This will use default values until the async load completes
71
- exports.default = cachedConfig;
21
+ // Merge with default config to ensure all required fields exist
22
+ const NEXTEMOS_CONFIG = Object.assign(Object.assign({}, exports.defaultConfig), loadedConfig);
23
+ exports.default = NEXTEMOS_CONFIG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.0.10",
3
+ "version": "5.0.11",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",