@xrystal/core 3.55.69 → 3.55.72
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.
- package/README.md +46 -2
- package/package.json +1 -1
- package/x/bin/commands/config.mjs +102 -19
- package/x/bin/commands/telepresence.mjs +28 -14
- package/x/bin/helpers/.generated/tmp-schema.mjs +33 -33
- package/x/bin/helpers/build-config.mjs +7 -7
- package/x/bin/helpers/config-sync.mjs +145 -0
- package/x/bin/helpers/resolve-tls-bundle.mjs +109 -0
- package/x/bin/helpers/telepresence-install.mjs +16 -0
- package/x/bin/helpers/telepresence-layout.mjs +18 -2
- package/x/bin/helpers/telepresence-runtime.mjs +109 -66
- package/x/bin/helpers/telepresence-tls-path-rewrite.mjs +69 -0
- package/x/bin/helpers/workspace-scaffold.mjs +4 -1
- package/x/bin/helpers/xrystal-config.mjs +55 -13
- package/x/bin/scripts/telepresence-client-install.sh +27 -0
- package/x/templates/api-service/docker/Dockerfile +2 -2
- package/x/templates/api-service/docker/Dockerfile.dev +2 -2
- package/x/templates/api-service/docker/docker-compose.dev.yml +2 -2
- package/x/templates/api-service/docker/docker-compose.yml +1 -1
- package/x/bin/helpers/resolve-infra-helper.mjs +0 -90
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
|
|
5
|
-
import { getCliConfigInfraDir } from './xrystal-config.mjs'
|
|
6
|
-
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
-
const HELPERS_DIR = 'scripts/helpers'
|
|
9
|
-
|
|
10
|
-
function infraRootHasHelpers(root) {
|
|
11
|
-
if (!root) return false
|
|
12
|
-
return fs.existsSync(path.join(root, HELPERS_DIR))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** Walk cwd → parents; sibling `-infrastructure-` next to each ancestor folder. */
|
|
16
|
-
export function walkUpForInfraRoot(start = process.cwd(), { maxDepth = 12 } = {}) {
|
|
17
|
-
let dir = path.resolve(start)
|
|
18
|
-
for (let depth = 0; depth < maxDepth; depth += 1) {
|
|
19
|
-
const sibling = path.join(path.dirname(dir), '-infrastructure-')
|
|
20
|
-
if (infraRootHasHelpers(sibling)) return sibling
|
|
21
|
-
|
|
22
|
-
const parent = path.dirname(dir)
|
|
23
|
-
if (parent === dir) break
|
|
24
|
-
dir = parent
|
|
25
|
-
}
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function listInfraRootCandidates(start = process.cwd()) {
|
|
30
|
-
const seen = new Set()
|
|
31
|
-
const out = []
|
|
32
|
-
|
|
33
|
-
const push = (value) => {
|
|
34
|
-
const resolved = value ? path.resolve(String(value)) : null
|
|
35
|
-
if (!resolved || seen.has(resolved)) return
|
|
36
|
-
seen.add(resolved)
|
|
37
|
-
out.push(resolved)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
push(process.env.XRYSTAL_INFRA_DIR)
|
|
41
|
-
push(process.env.XRYSTAL_INFRA_ROOT)
|
|
42
|
-
push(getCliConfigInfraDir())
|
|
43
|
-
push(walkUpForInfraRoot(start))
|
|
44
|
-
push(path.resolve(start, '../-infrastructure-'))
|
|
45
|
-
push(path.resolve(start, '../../-infrastructure-'))
|
|
46
|
-
push(path.resolve(__dirname, '../../../..', '-infrastructure-'))
|
|
47
|
-
|
|
48
|
-
return out
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function findHelperScriptUnderRoot(root, name) {
|
|
52
|
-
const base = path.join(root, HELPERS_DIR)
|
|
53
|
-
const direct = path.join(base, name)
|
|
54
|
-
if (fs.existsSync(direct)) return direct
|
|
55
|
-
|
|
56
|
-
let entries
|
|
57
|
-
try {
|
|
58
|
-
entries = fs.readdirSync(base, { withFileTypes: true })
|
|
59
|
-
} catch {
|
|
60
|
-
return null
|
|
61
|
-
}
|
|
62
|
-
for (const ent of entries) {
|
|
63
|
-
if (!ent.isDirectory()) continue
|
|
64
|
-
const nested = path.join(base, ent.name, name)
|
|
65
|
-
if (fs.existsSync(nested)) return nested
|
|
66
|
-
}
|
|
67
|
-
return null
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Resolve a script under -infrastructure-/scripts/helpers (incl. domain subdirs). */
|
|
71
|
-
export function resolveInfraHelperScript(name, { cwd = process.cwd() } = {}) {
|
|
72
|
-
for (const root of listInfraRootCandidates(cwd)) {
|
|
73
|
-
const script = findHelperScriptUnderRoot(root, name)
|
|
74
|
-
if (script) return script
|
|
75
|
-
}
|
|
76
|
-
return null
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function formatInfraResolveHint({ cliName = 'xry', cwd = process.cwd() } = {}) {
|
|
80
|
-
const walked = walkUpForInfraRoot(cwd)
|
|
81
|
-
const lines = [
|
|
82
|
-
'Set infra repo path (one of):',
|
|
83
|
-
` ${cliName} config infra /path/to/-infrastructure-`,
|
|
84
|
-
' export XRYSTAL_INFRA_DIR=/path/to/-infrastructure-',
|
|
85
|
-
]
|
|
86
|
-
if (walked) {
|
|
87
|
-
lines.push(` detected near cwd: ${walked}`)
|
|
88
|
-
}
|
|
89
|
-
return lines.join('\n')
|
|
90
|
-
}
|