@pixelated-tech/components 3.7.12 → 3.7.13

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.
@@ -3,25 +3,35 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  const debug = false;
5
5
  /**
6
- * Read the full master config blob from environment or local file.
6
+ * Read the full master config blob from local file.
7
7
  * This function is intended for server-side use only.
8
8
  */
9
9
  export function getFullPixelatedConfig() {
10
10
  let raw = '';
11
11
  let source = 'none';
12
- // Try reading from the conventional file location
13
- const configPath = path.join(process.cwd(), 'src/app/config/pixelated.config.json');
14
- if (fs.existsSync(configPath)) {
15
- try {
16
- raw = fs.readFileSync(configPath, 'utf8');
17
- source = 'src/app/config/pixelated.config.json';
18
- }
19
- catch (err) {
20
- console.error(`Failed to read config file at ${configPath}`, err);
12
+ // Focus strictly on the config file.
13
+ // Search multiple locations to handle different production/standalone environments.
14
+ const filename = 'pixelated.config.json';
15
+ const paths = [
16
+ path.join(process.cwd(), 'src/app/config', filename),
17
+ path.join(process.cwd(), 'app/config', filename),
18
+ path.join(process.cwd(), filename),
19
+ path.join(process.cwd(), '.next/server', filename), // Sometimes moved here in build
20
+ ];
21
+ for (const configPath of paths) {
22
+ if (fs.existsSync(configPath)) {
23
+ try {
24
+ raw = fs.readFileSync(configPath, 'utf8');
25
+ source = configPath;
26
+ break;
27
+ }
28
+ catch (err) {
29
+ console.error(`Failed to read config file at ${configPath}`, err);
30
+ }
21
31
  }
22
32
  }
23
33
  if (!raw) {
24
- console.error('PIXELATED_CONFIG not found: src/app/config/pixelated.config.json is not available.');
34
+ console.error('PIXELATED_CONFIG not found. Ensure src/app/config/pixelated.config.json is available.');
25
35
  return {};
26
36
  }
27
37
  // Handle decryption if the content is encrypted
@@ -34,7 +44,7 @@ export function getFullPixelatedConfig() {
34
44
  try {
35
45
  raw = decrypt(raw, key);
36
46
  if (debug)
37
- console.log(`PIXELATED_CONFIG decrypted using key from environment.`);
47
+ console.log(`PIXELATED_CONFIG decrypted using key.`);
38
48
  }
39
49
  catch (err) {
40
50
  console.error('Failed to decrypt PIXELATED_CONFIG', err);
@@ -44,11 +54,11 @@ export function getFullPixelatedConfig() {
44
54
  try {
45
55
  const parsed = JSON.parse(raw);
46
56
  if (debug)
47
- console.log(`PIXELATED_CONFIG loaded from ${source}; raw length=${raw.length}`);
57
+ console.log(`PIXELATED_CONFIG loaded from ${source}`);
48
58
  return parsed;
49
59
  }
50
60
  catch (err) {
51
- console.error('Failed to parse PIXELATED_CONFIG JSON; source=', source, 'rawLength=', raw.length, err);
61
+ console.error('Failed to parse PIXELATED_CONFIG JSON; source=', source, err);
52
62
  return {};
53
63
  }
54
64
  }
@@ -1,6 +1,6 @@
1
1
  import type { PixelatedConfig } from './config.types';
2
2
  /**
3
- * Read the full master config blob from environment or local file.
3
+ * Read the full master config blob from local file.
4
4
  * This function is intended for server-side use only.
5
5
  */
6
6
  export declare function getFullPixelatedConfig(): PixelatedConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CA4CxD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,eAAe,CA0BpF"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CAuDxD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,eAAe,CA0BpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelated-tech/components",
3
- "version": "3.7.12",
3
+ "version": "3.7.13",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Pixelated Technologies",