nextemos 5.0.5 → 5.0.7

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.
@@ -5,6 +5,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
7
  const path_1 = __importDefault(require("path"));
8
- const configPath = path_1.default.join(process.cwd(), "nextemos-config.json");
9
- const NEXTEMOS_CONFIG = JSON.parse(fs_1.default.readFileSync(configPath, "utf8"));
8
+ /**
9
+ * Ana projenin kök dizinini bul
10
+ */
11
+ const findProjectRoot = () => {
12
+ if (require.main) {
13
+ return path_1.default.dirname(require.main.filename);
14
+ }
15
+ return process.cwd();
16
+ };
17
+ /**
18
+ * Ana projedeki nextemos-config.json dosyasını oku
19
+ */
20
+ const loadConfig = () => {
21
+ const projectRoot = findProjectRoot();
22
+ const configPath = path_1.default.join(projectRoot, "nextemos-config.json");
23
+ try {
24
+ if (fs_1.default.existsSync(configPath)) {
25
+ const configData = fs_1.default.readFileSync(configPath, "utf-8");
26
+ return JSON.parse(configData);
27
+ }
28
+ else {
29
+ console.warn(`Config file not found at: ${configPath}`);
30
+ return null;
31
+ }
32
+ }
33
+ catch (error) {
34
+ console.error("Failed to read config file:", error);
35
+ return null;
36
+ }
37
+ };
38
+ // Config verisini al ve kullan
39
+ const NEXTEMOS_CONFIG = loadConfig();
10
40
  exports.default = NEXTEMOS_CONFIG;
@@ -3,4 +3,3 @@ export { default as toIntArray } from './toIntArray';
3
3
  export { default as toQueryString } from './toQueryString';
4
4
  export { default as cdn } from './cdn';
5
5
  export { default as decodeHTML } from './decodeHTML';
6
- export { default as getConfigs } from './getConfigs';
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getConfigs = exports.decodeHTML = exports.cdn = exports.toQueryString = exports.toIntArray = exports.fetchRequest = void 0;
6
+ exports.decodeHTML = exports.cdn = exports.toQueryString = exports.toIntArray = exports.fetchRequest = void 0;
7
7
  /// helpers
8
8
  var fetchRequest_1 = require("./fetchRequest");
9
9
  Object.defineProperty(exports, "fetchRequest", { enumerable: true, get: function () { return __importDefault(fetchRequest_1).default; } });
@@ -15,5 +15,3 @@ var cdn_1 = require("./cdn");
15
15
  Object.defineProperty(exports, "cdn", { enumerable: true, get: function () { return __importDefault(cdn_1).default; } });
16
16
  var decodeHTML_1 = require("./decodeHTML");
17
17
  Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return __importDefault(decodeHTML_1).default; } });
18
- var getConfigs_1 = require("./getConfigs");
19
- Object.defineProperty(exports, "getConfigs", { enumerable: true, get: function () { return __importDefault(getConfigs_1).default; } });
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getUrl = void 0;
4
- const helpers_1 = require("nextemos/helpers");
5
- const { API_URL, USE_API_URL } = (0, helpers_1.getConfigs)();
7
+ const getConfigs_1 = __importDefault(require("../helpers/getConfigs"));
8
+ const { API_URL, USE_API_URL } = getConfigs_1.default;
6
9
  exports.default = {
7
10
  Banner: {
8
11
  GetBannerById: "/{language}/Banner/v1/GetBannerById",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/dist/config.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/config.js DELETED
@@ -1,25 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const promises_1 = require("fs/promises");
13
- const getConfig = () => __awaiter(void 0, void 0, void 0, function* () {
14
- const packagePath = process.cwd();
15
- const configPath = `${packagePath}/nextemos-config.json`;
16
- try {
17
- const data = yield (0, promises_1.readFile)(configPath, "utf-8");
18
- return JSON.parse(data);
19
- }
20
- catch (error) {
21
- console.error("Failed to read config file:", error);
22
- return null;
23
- }
24
- });
25
- getConfig().then((config) => console.log(config));