entkapp 5.6.0 → 5.7.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.
@@ -4,6 +4,7 @@ import path from 'path';
4
4
  /**
5
5
  * ConfigLoader
6
6
  * Loads and merges entkapp configuration from multiple sources:
7
+ * - entkapp.json (root config)
7
8
  * - entkapp/config.json (project config)
8
9
  * - entkapp.config.js / entkapp.config.mjs (JS config)
9
10
  * - package.json "entkapp" key
@@ -17,21 +18,28 @@ export class ConfigLoader {
17
18
  async loadConfig(overrides = {}) {
18
19
  let config = this._defaultConfig();
19
20
 
20
- // 1. Try entkapp/config.json
21
+ // 1. Try entkapp.json (New in v5.7.0)
22
+ const rootJsonPath = path.join(this.cwd, 'entkapp.json');
23
+ try {
24
+ const raw = await fs.readFile(rootJsonPath, 'utf8');
25
+ const stripped = raw.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
26
+ const parsed = JSON.parse(stripped);
27
+ config = this._merge(config, parsed);
28
+ } catch (e) {}
29
+
30
+ // 2. Try entkapp/config.json
21
31
  const jsonConfigPath = path.join(this.cwd, 'entkapp', 'config.json');
22
32
  try {
23
33
  const raw = await fs.readFile(jsonConfigPath, 'utf8');
24
- // Strip comments from JSON (JSONC support)
25
34
  const stripped = raw.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
26
35
  const parsed = JSON.parse(stripped);
27
36
  config = this._merge(config, parsed);
28
37
  } catch (e) {}
29
38
 
30
- // 2. Try entkapp.config.js / entkapp.config.mjs
31
- for (const configFile of ['entkapp.config.mjs', 'entkapp.config.mjs', 'entkapp.config.cjs']) {
39
+ // 3. Try entkapp.config.js / entkapp.config.mjs
40
+ for (const configFile of ['entkapp.config.mjs', 'entkapp.config.js', 'entkapp.config.cjs']) {
32
41
  let jsConfigPath = path.join(this.cwd, configFile);
33
42
  try {
34
- // FIX: Windows compatibility for dynamic imports
35
43
  if (process.platform === 'win32') {
36
44
  jsConfigPath = 'file://' + jsConfigPath.replace(/\\/g, '/');
37
45
  }
@@ -44,7 +52,7 @@ export class ConfigLoader {
44
52
  } catch (e) {}
45
53
  }
46
54
 
47
- // 3. Try package.json "entkapp" key
55
+ // 4. Try package.json "entkapp" key
48
56
  const pkgPath = path.join(this.cwd, 'package.json');
49
57
  try {
50
58
  const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf8'));
@@ -53,7 +61,7 @@ export class ConfigLoader {
53
61
  }
54
62
  } catch (e) {}
55
63
 
56
- // 4. Apply CLI overrides
64
+ // 5. Apply CLI overrides
57
65
  config = this._merge(config, overrides);
58
66
 
59
67
  return config;