nextemos 5.0.7 → 5.0.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.
@@ -1,2 +1,3 @@
1
- declare const NEXTEMOS_CONFIG: any;
2
- export default NEXTEMOS_CONFIG;
1
+ export declare const getConfig: () => any;
2
+ declare const NEXT_CONFIG: any;
3
+ export default NEXT_CONFIG;
@@ -1,40 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
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
- }
3
+ exports.getConfig = void 0;
4
+ const cosmiconfig_1 = require("cosmiconfig");
5
+ const getConfig = () => {
6
+ // `nextemos.config.js`, `.nextemosrc.json` vb. dosyalara bakar
7
+ const explorer = (0, cosmiconfig_1.cosmiconfigSync)("nextemos");
8
+ const result = explorer.search();
9
+ return result ? result.config : {};
37
10
  };
38
- // Config verisini al ve kullan
39
- const NEXTEMOS_CONFIG = loadConfig();
40
- exports.default = NEXTEMOS_CONFIG;
11
+ exports.getConfig = getConfig;
12
+ const NEXT_CONFIG = (0, exports.getConfig)();
13
+ exports.default = NEXT_CONFIG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -39,6 +39,7 @@
39
39
  "nextemos"
40
40
  ],
41
41
  "dependencies": {
42
+ "cosmiconfig": "^9.0.0",
42
43
  "html-entities": "^2.5.2"
43
44
  }
44
45
  }