@xrystal/core 3.45.0 → 3.45.1
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
CHANGED
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
> **EN** — Microservice runtime: Express or Elysia HTTP, DI loaders, live `tmp.yml`, standardized API responses.
|
|
4
4
|
> **TR** — Microservice runtime: Express veya Elysia HTTP, DI loader'lar, canlı `tmp.yml`, standart API cevapları.
|
|
5
5
|
|
|
6
|
-
**CLI:** `xry` · **Version:** `3.45.
|
|
6
|
+
**CLI:** `xry` · **Version:** `3.45.1` · [npm](https://www.npmjs.com/package/@xrystal/core)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## What's new in 3.45.
|
|
10
|
+
## What's new in 3.45.1 / 3.45.1'da ne değişti
|
|
11
11
|
|
|
12
12
|
| Change / Değişiklik | EN | TR |
|
|
13
13
|
|---------------------|----|----|
|
|
14
|
-
| **
|
|
15
|
-
| **
|
|
16
|
-
| **Publish helpers** | Source/dist paths from defaults + tmp seed | Publish path SSOT |
|
|
14
|
+
| **No silent fallbacks** | Missing `cliBinFile` / `paths.source` throws | Eksikse uyarır, sessiz fallback yok |
|
|
15
|
+
| **Doctor labels** | Uses `paths.*` keys from tmp | Klasör adı hardcode değil |
|
|
17
16
|
|
|
18
|
-
Carried from **3.
|
|
17
|
+
Carried from **3.45.0:** CLI identity = `@xrystal/core`, brand hardcode cleanup, publish path SSOT.
|
|
19
18
|
|
|
20
19
|
```bash
|
|
21
20
|
npx xry sync # force-apply tmp.yml → tsconfig (usually auto)
|
|
@@ -80,7 +79,7 @@ npx xry doctor # EN: optional health check · TR: isteğe bağlı sağlı
|
|
|
80
79
|
```json
|
|
81
80
|
{
|
|
82
81
|
"dependencies": {
|
|
83
|
-
"@xrystal/core": "^3.45.
|
|
82
|
+
"@xrystal/core": "^3.45.1",
|
|
84
83
|
"elysia": "^1.4.19"
|
|
85
84
|
},
|
|
86
85
|
"scripts": {
|
package/package.json
CHANGED
|
@@ -73,11 +73,12 @@ export function registerDoctorCommand(cli, { cliName = CLI_PRIMARY_NAME } = {})
|
|
|
73
73
|
printSection('Project')
|
|
74
74
|
console.log(` ${'root'.padEnd(18)}${chalk.bold(root)}`)
|
|
75
75
|
if (distLayout) {
|
|
76
|
-
|
|
77
|
-
console.log(` ${'
|
|
78
|
-
console.log(` ${'
|
|
76
|
+
const layout = distLayout.layout
|
|
77
|
+
console.log(` ${'paths.root'.padEnd(18)}${chalk.bold(distLayout.rootFolderPath)}`)
|
|
78
|
+
console.log(` ${'paths.source'.padEnd(18)}${chalk.bold(layout.mainFolderPath)}`)
|
|
79
|
+
console.log(` ${'paths.special.dist'.padEnd(18)}${chalk.bold(distLayout.distPrefix)}`)
|
|
79
80
|
} else {
|
|
80
|
-
console.log(chalk.yellow(` layout: tmp.yml not resolved — run ${CLI_PRIMARY_NAME} tmp`))
|
|
81
|
+
console.log(chalk.yellow(` layout: tmp.yml not resolved — run ${CLI_PRIMARY_NAME} tmp (then sync heals tsconfig)`))
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
printSection('CLI (tool)')
|
|
@@ -143,15 +144,15 @@ export function registerDoctorCommand(cli, { cliName = CLI_PRIMARY_NAME } = {})
|
|
|
143
144
|
|
|
144
145
|
printSection('Toolchain')
|
|
145
146
|
const toolchain = resolveToolchainPathsFromProject(root)
|
|
146
|
-
console.log(` ${'source'.padEnd(18)}${chalk.bold(toolchain.mainSourceRel)}`)
|
|
147
|
-
console.log(` ${'outDir'.padEnd(18)}${chalk.bold(toolchain.outDir)}`)
|
|
147
|
+
console.log(` ${'paths.source'.padEnd(18)}${chalk.bold(toolchain.mainSourceRel)}`)
|
|
148
|
+
console.log(` ${'outDir'.padEnd(18)}${chalk.bold(toolchain.outDir)} ${chalk.gray('(← paths.special.dist)')}`)
|
|
148
149
|
const tsAudit = auditTsconfigAlignment(root)
|
|
149
150
|
if (tsAudit.missing) {
|
|
150
|
-
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}missing
|
|
151
|
+
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}missing — will auto-heal on next command / ${CLI_PRIMARY_NAME} sync`))
|
|
151
152
|
} else if (tsAudit.ok) {
|
|
152
153
|
console.log(chalk.green(` ${'tsconfig'.padEnd(18)}aligned with tmp.yml`))
|
|
153
154
|
} else {
|
|
154
|
-
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}drift
|
|
155
|
+
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}drift — auto-heal on next command / ${CLI_PRIMARY_NAME} sync`))
|
|
155
156
|
for (const note of tsAudit.notes) console.log(chalk.gray(` · ${note}`))
|
|
156
157
|
}
|
|
157
158
|
console.log(` ${'eslint'.padEnd(18)}${toolchain.eslintFiles.join(', ')}`)
|
|
@@ -10,22 +10,81 @@ import {
|
|
|
10
10
|
const here = path.dirname(fileURLToPath(import.meta.url))
|
|
11
11
|
const packageRoot = path.resolve(here, '..', '..', '..')
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const REQUIRED_IDENTITY_KEYS = [
|
|
14
|
+
'packageName',
|
|
15
|
+
'packageRootFolder',
|
|
16
|
+
'cliName',
|
|
17
|
+
'cliBinFile',
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
function findAuthoredDefaultsPath(root) {
|
|
21
|
+
const matches = []
|
|
22
|
+
|
|
23
|
+
function walk(dir, depth = 0) {
|
|
24
|
+
if (depth > 6 || !fs.existsSync(dir)) return
|
|
25
|
+
let entries
|
|
26
|
+
try {
|
|
27
|
+
entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
28
|
+
} catch {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'x') continue
|
|
33
|
+
const full = path.join(dir, entry.name)
|
|
34
|
+
if (entry.isDirectory()) {
|
|
35
|
+
walk(full, depth + 1)
|
|
36
|
+
continue
|
|
37
|
+
}
|
|
38
|
+
if (entry.name === 'defaults.json' && full.replace(/\\/g, '/').endsWith('utils/constants/defaults.json')) {
|
|
39
|
+
matches.push(full)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
walk(root)
|
|
45
|
+
return matches[0] ?? null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function assertIdentityDefaults(raw, sourceLabel) {
|
|
49
|
+
const missing = REQUIRED_IDENTITY_KEYS.filter((key) => {
|
|
50
|
+
const value = raw?.[key]
|
|
51
|
+
return value == null || String(value).trim() === ''
|
|
52
|
+
})
|
|
53
|
+
if (missing.length > 0) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`package defaults incomplete (${sourceLabel}): missing ${missing.join(', ')}`,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
if (!Array.isArray(raw.cliBinNames) || raw.cliBinNames.length === 0) {
|
|
59
|
+
if (!raw.cliName) {
|
|
60
|
+
throw new Error(`package defaults incomplete (${sourceLabel}): cliBinNames or cliName required`)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
14
64
|
|
|
15
65
|
function loadRawDefaults() {
|
|
16
|
-
|
|
17
|
-
|
|
66
|
+
const authoredPath = findAuthoredDefaultsPath(packageRoot)
|
|
67
|
+
if (authoredPath && fs.existsSync(authoredPath)) {
|
|
68
|
+
const raw = JSON.parse(fs.readFileSync(authoredPath, 'utf8'))
|
|
69
|
+
assertIdentityDefaults(raw, authoredPath)
|
|
70
|
+
return raw
|
|
18
71
|
}
|
|
19
72
|
if (packageIdentityDefaults && typeof packageIdentityDefaults === 'object') {
|
|
73
|
+
assertIdentityDefaults(packageIdentityDefaults, 'embedded packageIdentityDefaults')
|
|
20
74
|
return packageIdentityDefaults
|
|
21
75
|
}
|
|
22
76
|
throw new Error(
|
|
23
|
-
|
|
77
|
+
'package defaults missing. Expected utils/constants/defaults.json in package root or embedded packageIdentityDefaults',
|
|
24
78
|
)
|
|
25
79
|
}
|
|
26
80
|
|
|
27
81
|
const raw = loadRawDefaults()
|
|
28
82
|
const seed = loadSeedLayoutFromBundledTmp(packageRoot, raw)
|
|
83
|
+
if (!seed?.mainSourceFolder || !String(seed.mainSourceFolder).trim()) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
`${raw.packageName}: bundled tmp seed missing paths.source — cannot resolve main source folder`,
|
|
86
|
+
)
|
|
87
|
+
}
|
|
29
88
|
|
|
30
89
|
export const packageDefaults = Object.freeze({
|
|
31
90
|
...raw,
|
|
@@ -46,7 +105,7 @@ export const semverVersionPattern = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9
|
|
|
46
105
|
export const PACKAGE_NAME = packageDefaults.packageName
|
|
47
106
|
export const CLI_PRIMARY_NAME = packageDefaults.cliName
|
|
48
107
|
export const CLI_BIN_NAMES = packageDefaults.cliBinNames
|
|
49
|
-
export const CLI_BIN_FILE = packageDefaults.cliBinFile
|
|
108
|
+
export const CLI_BIN_FILE = packageDefaults.cliBinFile
|
|
50
109
|
|
|
51
110
|
/** Commander / banner description from brand SSOT. */
|
|
52
111
|
export function packageCliDescription() {
|
|
@@ -54,7 +113,10 @@ export function packageCliDescription() {
|
|
|
54
113
|
const title = [brand.primary, brand.secondary].filter(Boolean).join(' ')
|
|
55
114
|
const tagline = brand.tagline ? String(brand.tagline) : ''
|
|
56
115
|
if (title && tagline) return `${title} — ${tagline}`
|
|
57
|
-
|
|
116
|
+
if (!tagline) {
|
|
117
|
+
throw new Error(`${PACKAGE_NAME}: brand.tagline missing in defaults`)
|
|
118
|
+
}
|
|
119
|
+
return tagline
|
|
58
120
|
}
|
|
59
121
|
|
|
60
122
|
/** Log / error prefix: always the npm package name. */
|
|
@@ -64,12 +126,19 @@ export function packageLogTag() {
|
|
|
64
126
|
|
|
65
127
|
/** Relative bin entry for package.json / manifests. */
|
|
66
128
|
export function resolveCliBinEntry() {
|
|
129
|
+
if (!packageDefaults.packageRootFolder || !CLI_BIN_FILE) {
|
|
130
|
+
throw new Error(`${PACKAGE_NAME}: packageRootFolder/cliBinFile missing — check defaults.json`)
|
|
131
|
+
}
|
|
67
132
|
return `./${packageDefaults.packageRootFolder}/bin/${CLI_BIN_FILE}`
|
|
68
133
|
}
|
|
69
134
|
|
|
70
|
-
/**
|
|
135
|
+
/** Main source folder segment from tmp seed (no silent fallback). */
|
|
71
136
|
export function resolveMainSourceRel() {
|
|
72
|
-
|
|
137
|
+
const folder = packageDefaults.mainSourceFolder
|
|
138
|
+
if (!folder || !String(folder).trim()) {
|
|
139
|
+
throw new Error(`${PACKAGE_NAME}: paths.source missing from tmp seed — run sync / fix tmp.yml`)
|
|
140
|
+
}
|
|
141
|
+
return String(folder).replace(/^\.\//, '')
|
|
73
142
|
}
|
|
74
143
|
|
|
75
144
|
export function resolveInvokedAs(argv = process.argv) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"node:path";import{packageRootDir as q}from"../../utils/package-root";import b from"./defaults.json" with { type: 'json' };import{seedFromTmp as j}from"../../utils/helpers/tmp/seed-from-tmp";export const packageDefaults=Object.freeze({...b,mainSourceFolder:j.sourceFolder,framework:j.framework,layoutPaths:Object.freeze({...j.layout}),brand:Object.freeze({...b.brand}),buildDefaults:Object.freeze({...b.buildDefaults}),tmpWatchDefaults:Object.freeze({...b.tmpWatchDefaults}),cliBinNames:Object.freeze([...b.cliBinNames??[b.cliName]])}),coreVersionPattern=/^\d{2}\.\d{2}\.\d{2}-v\d+$/,semverVersionPattern=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?$/;const v=`${packageDefaults.tmpBaseName}${packageDefaults.tmpExtension}`;export class Constants{static packageName=packageDefaults.packageName;static packageRootFolder=packageDefaults.packageRootFolder;static tmpBaseName=packageDefaults.tmpBaseName;static tmpExtension=packageDefaults.tmpExtension;static publicFolderName=packageDefaults.publicFolderName;static kafkaLogsTopic=packageDefaults.kafkaLogsTopic;static templateRepoUri=packageDefaults.templateRepoUri;static cliName=packageDefaults.cliName;static cliBinNames=packageDefaults.cliBinNames;static pathAliasKey=packageDefaults.pathAliasKey;static brand=packageDefaults.brand;static mainSourceFolder=packageDefaults.mainSourceFolder;static framework=packageDefaults.framework;static layoutPaths=packageDefaults.layoutPaths;static cliBinFile=packageDefaults.cliBinFile
|
|
1
|
+
import n from"node:path";import{packageRootDir as q}from"../../utils/package-root";import b from"./defaults.json" with { type: 'json' };import{seedFromTmp as j}from"../../utils/helpers/tmp/seed-from-tmp";export const packageDefaults=Object.freeze({...b,mainSourceFolder:j.sourceFolder,framework:j.framework,layoutPaths:Object.freeze({...j.layout}),brand:Object.freeze({...b.brand}),buildDefaults:Object.freeze({...b.buildDefaults}),tmpWatchDefaults:Object.freeze({...b.tmpWatchDefaults}),cliBinNames:Object.freeze([...b.cliBinNames??[b.cliName]])}),coreVersionPattern=/^\d{2}\.\d{2}\.\d{2}-v\d+$/,semverVersionPattern=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?$/;const v=`${packageDefaults.tmpBaseName}${packageDefaults.tmpExtension}`;export class Constants{static packageName=packageDefaults.packageName;static packageRootFolder=packageDefaults.packageRootFolder;static tmpBaseName=packageDefaults.tmpBaseName;static tmpExtension=packageDefaults.tmpExtension;static publicFolderName=packageDefaults.publicFolderName;static kafkaLogsTopic=packageDefaults.kafkaLogsTopic;static templateRepoUri=packageDefaults.templateRepoUri;static cliName=packageDefaults.cliName;static cliBinNames=packageDefaults.cliBinNames;static pathAliasKey=packageDefaults.pathAliasKey;static brand=packageDefaults.brand;static mainSourceFolder=packageDefaults.mainSourceFolder;static framework=packageDefaults.framework;static layoutPaths=packageDefaults.layoutPaths;static cliBinFile=packageDefaults.cliBinFile;static logTag=packageDefaults.packageName;static bundledCoreTmpPath=n.join(q,packageDefaults.packageRootFolder,v)}export{seedFromTmp,loadSeedFromBundledTmp}from"../../utils/helpers/tmp/seed-from-tmp";
|