@icgio/clients-config 1.0.324 → 1.0.326

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,2 @@
1
- secretread.js:f4c6120009b776e0f627347cbd677375260644f7244e0cadbd63471ad45b746d
1
+ secretread.js:b9a60c111ee1556eff4253db02e3a522e7b9aaa8bff51ba0922833553a5e1bd8
2
2
  data-source.js:440e328f62856d665e4b66a66f55406e0c9f3a974d2be3c000041fd1c552652b
package/config.json CHANGED
@@ -78,8 +78,7 @@
78
78
  "Xt": ["B3TRUSDT"]
79
79
  },
80
80
  "CCDOG": {
81
- "Bitmart": ["CCDOGUSDT"],
82
- "Mexc": ["CCDOGUSDT"]
81
+ "Bitmart": ["CCDOGUSDT"]
83
82
  },
84
83
  "HKBITEX-BTC": {
85
84
  "Hkbitex": ["BTCUSD", "BTCHKD"]
@@ -164,7 +163,7 @@
164
163
  "B3TRUSDT": ["Mexc"]
165
164
  },
166
165
  "CCDOG": {
167
- "CCDOGUSDT": ["Mexc"]
166
+ "CCDOGUSDT": ["Bitmart"]
168
167
  },
169
168
  "HKBITEX-BTC": {
170
169
  "BTCHKD": ["Hkbitex"],
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@icgio/clients-config",
3
- "version": "1.0.324",
3
+ "version": "1.0.326",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "postinstall": "node ./scripts/reveal-secrets-on-install.js"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const { spawnSync } = require('child_process')
6
+
7
+ const pkgRoot = path.resolve(__dirname, '..')
8
+ const requiredFiles = ['secretread.js', 'data-source.js']
9
+ const encryptedFiles = requiredFiles.map((f) => `${f}.secret`)
10
+
11
+ function run(cmd, args) {
12
+ const result = spawnSync(cmd, args, {
13
+ cwd: pkgRoot,
14
+ encoding: 'utf8',
15
+ stdio: 'pipe',
16
+ })
17
+
18
+ if (result.error) throw result.error
19
+ if (result.status !== 0) {
20
+ const detail = (result.stderr || result.stdout || '').trim()
21
+ throw new Error(`${cmd} ${args.join(' ')} failed${detail ? `: ${detail}` : ''}`)
22
+ }
23
+ }
24
+
25
+ function exists(relPath) {
26
+ return fs.existsSync(path.join(pkgRoot, relPath))
27
+ }
28
+
29
+ const missingPlainFiles = requiredFiles.filter((f) => !exists(f))
30
+ if (missingPlainFiles.length === 0) {
31
+ process.exit(0)
32
+ }
33
+
34
+ const hasEncryptedFiles = encryptedFiles.every((f) => exists(f))
35
+ if (!hasEncryptedFiles) {
36
+ console.warn('[clients-config] Missing plaintext secrets and encrypted source files; skipping reveal.')
37
+ process.exit(0)
38
+ }
39
+
40
+ const gitAvailable = spawnSync('git', ['--version'], { encoding: 'utf8', stdio: 'pipe' }).status === 0
41
+ const gitSecretAvailable = spawnSync('git', ['secret', '--version'], { encoding: 'utf8', stdio: 'pipe' }).status === 0
42
+
43
+ if (!gitAvailable || !gitSecretAvailable) {
44
+ console.warn('[clients-config] git/git-secret not available; secrets remain encrypted.')
45
+ process.exit(0)
46
+ }
47
+
48
+ try {
49
+ if (!exists('.git')) {
50
+ run('git', ['init', '-q'])
51
+ }
52
+
53
+ run('git', ['secret', 'reveal'])
54
+
55
+ const unresolved = requiredFiles.filter((f) => !exists(f))
56
+ if (unresolved.length > 0) {
57
+ throw new Error(`Reveal completed but missing files: ${unresolved.join(', ')}`)
58
+ }
59
+
60
+ console.log('[clients-config] Revealed secretread.js and data-source.js')
61
+ } catch (error) {
62
+ console.warn(`[clients-config] Failed to auto-reveal secrets: ${error.message}`)
63
+ }
Binary file