@xrystal/core 3.52.5 → 3.52.7
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 +8 -2
- package/package.json +1 -1
- package/x/bin/commands/create.mjs +2 -4
- package/x/bin/commands/project-info.mjs +94 -0
- package/x/bin/commands/projects.mjs +1 -1
- package/x/bin/commands/sync.mjs +67 -101
- package/x/bin/commands/tmp.mjs +12 -9
- package/x/bin/helpers/.generated/seed-from-tmp.mjs +1 -0
- package/x/bin/helpers/.generated/tmp-schema.mjs +1 -0
- package/x/bin/helpers/.generated/workspace.mjs +3 -2
- package/x/bin/helpers/.generated/xrystal-home-registry.mjs +192 -44
- package/x/bin/helpers/cli-help.mjs +43 -13
- package/x/bin/helpers/project-context.mjs +147 -0
- package/x/bin/helpers/scaffold-service.mjs +2 -3
- package/x/bin/helpers/sync-project.mjs +76 -0
- package/x/bin/helpers/sync-scope.mjs +71 -0
- package/x/bin/helpers/tmp-config.mjs +25 -0
- package/x/bin/helpers/tmp-layout.mjs +2 -3
- package/x/bin/helpers/tmp-schema-version.mjs +46 -0
- package/x/bin/helpers/workspace-scaffold.mjs +4 -9
- package/x/bin/main-cli.js +10 -1
- package/x/dist/loader/kafka/index.js +7 -2
- package/x/dist/loader/logger/index.js +8 -6
- package/x/dist/loader/mongo/index.js +9 -0
- package/x/dist/loader/redis/index.js +9 -0
- package/x/dist/project/index.d.ts +1 -0
- package/x/dist/project/index.js +21 -14
- package/x/dist/utils/constants/defaults.json +1 -0
- package/x/dist/utils/helpers/loader-options/index.d.ts +5 -0
- package/x/dist/utils/helpers/loader-options/index.js +16 -0
- package/x/dist/utils/helpers/tmp/index.d.ts +1 -0
- package/x/dist/utils/helpers/tmp/index.js +1 -0
- package/x/dist/utils/helpers/tmp/loader-boot-plan.d.ts +10 -0
- package/x/dist/utils/helpers/tmp/loader-boot-plan.js +36 -0
- package/x/dist/utils/helpers/workspace/index.d.ts +1 -1
- package/x/dist/utils/helpers/workspace/index.js +2 -2
- package/x/templates/api-service/tmp.yml +7 -1
- package/x/templates/frontend/tmp.yml +61 -0
- package/x/tmp.yml +1 -1
- package/x/bin/helpers/tmp-end-version.mjs +0 -35
package/README.md
CHANGED
|
@@ -253,13 +253,19 @@ bun run dev
|
|
|
253
253
|
| Command / Komut | EN | TR |
|
|
254
254
|
|-----------------|----|----|
|
|
255
255
|
| `xry create [name] [path]` | Start project from template + `tmp.yml` | Template + `tmp.yml` ile proje başlat |
|
|
256
|
-
| `xry
|
|
257
|
-
| `xry
|
|
256
|
+
| `xry project` | **Context**: workspace root, inner service, standalone, or core library | **Bağlam**: workspace / servis / core |
|
|
257
|
+
| `xry workspaces` | **Global registry** `~/.xrystal` (not tmp.yml) | Global kayıt defteri |
|
|
258
|
+
| `xry create <name> --workspace` | Outer `./tmp.yml` + **api/general** + admin/web | Dış tmp + api/general |
|
|
259
|
+
| `xry tmp` | Inner `x/tmp.yml` or outer workspace tmp; **`end.version` = schema (1)** | tmp.yml · şema sürümü |
|
|
260
|
+
| `xry sync` | Inner tsconfig + pin `@xrystal/core` + registry (workspace mode) | tsconfig + core pin |
|
|
261
|
+
| `xry tp connect` / `xry tp dev <deploy>` | Telepresence cluster connect / local intercept | Telepresence bağlan / local intercept |
|
|
262
|
+
| `xry workspaces` | List `~/.xrystal` workspaces + linked projects | Kayıtlı workspace listesi |
|
|
258
263
|
| `xry dev` | Watch `source/index.ts` + dev env | `source/index.ts` watch + dev env |
|
|
259
264
|
| `xry build` | `tsc` full tree → dist (auto default) + alias/fix post-steps | `tsc` ile tüm `source/` → dist |
|
|
260
265
|
| `xry start` | Run `x/dist` + prod env | `x/dist` + prod env |
|
|
261
266
|
| `xry test` | Run `x/tests` | `x/tests` çalıştır |
|
|
262
267
|
| `xry doctor` | CLI, runtime, package health | CLI, runtime, paket uyumu |
|
|
268
|
+
| `xry tag` | Core release: tag + npm publish | Core release tag + npm |
|
|
263
269
|
|
|
264
270
|
---
|
|
265
271
|
|
package/package.json
CHANGED
|
@@ -61,14 +61,12 @@ export function registerCreateCommand(cli, { cliName = CLI_PRIMARY_NAME, runtime
|
|
|
61
61
|
const version = readCliPackageJson().version
|
|
62
62
|
printCommandHeader({ cliName, command: 'create (workspace)', version })
|
|
63
63
|
const result = scaffoldWorkspace(targetPath, name, {
|
|
64
|
-
coreVersion: version,
|
|
65
64
|
installCommand,
|
|
66
65
|
cliName,
|
|
67
66
|
})
|
|
68
67
|
console.log(chalk.green('\n✓ Workspace ready\n'))
|
|
69
68
|
console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.tmpPath) || result.tmpPath}`))
|
|
70
|
-
console.log(chalk.gray(
|
|
71
|
-
console.log(chalk.gray(' folders: api/, admin/, web/'))
|
|
69
|
+
console.log(chalk.gray(' outer tmp: ./tmp.yml (workspace) · inner: each api|admin|web project'))
|
|
72
70
|
if (result.general) {
|
|
73
71
|
console.log(chalk.green(' api/general: monolith scaffold (gpt template)'))
|
|
74
72
|
console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.general.tmpFilePath) || result.general.tmpFilePath}`))
|
|
@@ -80,7 +78,7 @@ export function registerCreateCommand(cli, { cliName = CLI_PRIMARY_NAME, runtime
|
|
|
80
78
|
syncRegistryFromPath(result.root)
|
|
81
79
|
console.log(chalk.gray(' registered in ~/.xrystal'))
|
|
82
80
|
} catch {}
|
|
83
|
-
console.log(chalk.cyan(` ${cliName} sync`))
|
|
81
|
+
console.log(chalk.cyan(` ${cliName} sync --all`))
|
|
84
82
|
console.log(chalk.cyan(` ${cliName} telepresence dev general`))
|
|
85
83
|
printCommandFooter({ version })
|
|
86
84
|
} catch (error) {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
|
|
4
|
+
import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
|
|
5
|
+
import { packageDefaults } from '../helpers/package-defaults.mjs'
|
|
6
|
+
import { resolveProjectContext } from '../helpers/project-context.mjs'
|
|
7
|
+
import { readCliPackageJson } from '../helpers/project-root.mjs'
|
|
8
|
+
import { ensureTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
|
|
9
|
+
|
|
10
|
+
function line(label, value) {
|
|
11
|
+
console.log(` ${label.padEnd(20)}${value}`)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function printTmpLayer(title, meta, schemaExpected, { heal = false } = {}) {
|
|
15
|
+
if (!meta?.path) return
|
|
16
|
+
console.log(chalk.bold.cyan(`\n ${title}`))
|
|
17
|
+
line('path', chalk.gray(meta.path))
|
|
18
|
+
if (meta.projectName) line('project.name', chalk.bold(meta.projectName))
|
|
19
|
+
if (meta.globalType) line('global.type', meta.globalType)
|
|
20
|
+
if (meta.schemaVersion != null) {
|
|
21
|
+
const ok = String(meta.schemaVersion) === String(schemaExpected)
|
|
22
|
+
line('end.version', ok ? chalk.green(`${meta.schemaVersion} (schema)`) : chalk.yellow(`${meta.schemaVersion} (expected schema ${schemaExpected})`))
|
|
23
|
+
}
|
|
24
|
+
if (heal) ensureTmpSchemaVersion(meta.path)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function registerProjectInfoCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
28
|
+
cli
|
|
29
|
+
.command('project')
|
|
30
|
+
.description('Show workspace / service context for current directory')
|
|
31
|
+
.option('--heal-schema', 'Fix tmp.yml end.version if missing or mistaken core semver')
|
|
32
|
+
.action((options) => {
|
|
33
|
+
const version = readCliPackageJson().version
|
|
34
|
+
printCommandHeader({ cliName, command: 'project', version })
|
|
35
|
+
|
|
36
|
+
const ctx = resolveProjectContext()
|
|
37
|
+
console.log(chalk.bold.white(`\n ${ctx.label}`))
|
|
38
|
+
line('cwd', ctx.cwd)
|
|
39
|
+
line('scope', ctx.kind)
|
|
40
|
+
if (ctx.projectRoot !== ctx.cwd) line('project root', ctx.projectRoot)
|
|
41
|
+
if (ctx.workspaceRoot) line('workspace root', ctx.workspaceRoot)
|
|
42
|
+
|
|
43
|
+
if (ctx.package) {
|
|
44
|
+
console.log(chalk.bold.cyan('\n Package'))
|
|
45
|
+
line('name', chalk.bold(ctx.package.name))
|
|
46
|
+
line('version', ctx.package.version ?? '—')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(chalk.bold.cyan('\n @xrystal/core (global library)'))
|
|
50
|
+
line('CLI (this xry)', chalk.bold(`v${ctx.core.cli}`))
|
|
51
|
+
if (ctx.core.declared) line('declared', ctx.core.declared)
|
|
52
|
+
if (ctx.core.installed) {
|
|
53
|
+
const match = ctx.core.installed === ctx.core.cli
|
|
54
|
+
line('installed', `${ctx.core.installed} ${match ? chalk.green('(matches CLI)') : chalk.yellow('(drift)')}`)
|
|
55
|
+
} else if (!ctx.core.isGlobalLibrary) {
|
|
56
|
+
line('installed', chalk.yellow('not in node_modules'))
|
|
57
|
+
}
|
|
58
|
+
if (ctx.core.isGlobalLibrary) {
|
|
59
|
+
line('role', chalk.green('library source — npm package for all services/workspaces'))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (ctx.outerTmp) {
|
|
63
|
+
printTmpLayer('Outer tmp (workspace)', ctx.outerTmp, ctx.schemaVersionExpected, { heal: options.healSchema })
|
|
64
|
+
}
|
|
65
|
+
if (ctx.innerTmp) {
|
|
66
|
+
printTmpLayer('Inner tmp (project)', ctx.innerTmp, ctx.schemaVersionExpected, { heal: options.healSchema })
|
|
67
|
+
} else if (!ctx.outerTmp) {
|
|
68
|
+
console.log(chalk.yellow('\n No tmp.yml found — run xry tmp'))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (ctx.selfEntry) {
|
|
72
|
+
console.log(chalk.bold.cyan('\n Workspace link'))
|
|
73
|
+
line('name', `${ctx.selfEntry.name} [${ctx.selfEntry.type}]`)
|
|
74
|
+
line('slot', ctx.selfEntry.slot)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (ctx.workspaceEntries.length > 0 && ctx.kind === 'workspace-root') {
|
|
78
|
+
console.log(chalk.bold.cyan(`\n Linked projects (${ctx.workspaceEntries.length})`))
|
|
79
|
+
for (const entry of ctx.workspaceEntries) {
|
|
80
|
+
console.log(` • ${chalk.white(entry.name)} [${entry.type}] ${chalk.gray(entry.path)}`)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (ctx.hints?.length) {
|
|
85
|
+
console.log(chalk.bold.cyan('\n Next'))
|
|
86
|
+
for (const hint of ctx.hints) {
|
|
87
|
+
console.log(` ${chalk.gray('→')} ${hint}`)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log(chalk.dim(`\n Registry (all workspaces): ${cliName} workspaces · inner tmp: ${cliName} tmp`))
|
|
92
|
+
printCommandFooter({ version })
|
|
93
|
+
})
|
|
94
|
+
}
|
|
@@ -81,7 +81,7 @@ export function registerWorkspacesCommand(cli, { cliName = CLI_PRIMARY_NAME } =
|
|
|
81
81
|
attachRegistryCommand(
|
|
82
82
|
cli
|
|
83
83
|
.command('workspaces [action]')
|
|
84
|
-
.description('
|
|
84
|
+
.description('Global ~/.xrystal registry — workspaces & linked projects (not repo tmp.yml)'),
|
|
85
85
|
{ cliName, label: 'workspaces' },
|
|
86
86
|
)
|
|
87
87
|
}
|
package/x/bin/commands/sync.mjs
CHANGED
|
@@ -3,137 +3,103 @@ import path from 'node:path'
|
|
|
3
3
|
|
|
4
4
|
import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
|
|
5
5
|
import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
|
|
6
|
-
import {
|
|
7
|
-
import { auditTsconfigAlignment, syncProjectToolchain } from '../helpers/toolchain-config.mjs'
|
|
6
|
+
import { readCliPackageJson } from '../helpers/project-root.mjs'
|
|
8
7
|
import { ensureTmpFile } from '../helpers/tmp-layout.mjs'
|
|
9
|
-
import {
|
|
10
|
-
import { findEntries, findWorkspaceRoot } from '../helpers/workspace-resolve.mjs'
|
|
11
|
-
import { syncCliRuntime } from '../helpers/project-artifacts.mjs'
|
|
12
|
-
import { syncCoreDependency } from '../helpers/sync-core-dependency.mjs'
|
|
13
|
-
import { packageDefaults } from '../helpers/package-defaults.mjs'
|
|
8
|
+
import { ensureTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
|
|
14
9
|
import { syncRegistryFromPath } from '../helpers/xrystal-registry.mjs'
|
|
10
|
+
import { resolveSyncScope } from '../helpers/sync-scope.mjs'
|
|
11
|
+
import { printSyncProjectResult, syncOneProject } from '../helpers/sync-project.mjs'
|
|
12
|
+
import { formatSyncHelp } from '../helpers/cli-help.mjs'
|
|
15
13
|
|
|
16
|
-
/** Sync tsconfig
|
|
14
|
+
/** Sync tsconfig + @xrystal/core pin from tmp.yml layout. */
|
|
17
15
|
export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
18
16
|
const run = (options) => {
|
|
19
|
-
const cwd = process.cwd()
|
|
20
|
-
const workspaceRoot = findWorkspaceRoot(cwd)
|
|
21
17
|
const coreVersion = readCliPackageJson().version
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
console.
|
|
19
|
+
let scope
|
|
20
|
+
try {
|
|
21
|
+
scope = resolveSyncScope(process.cwd(), { ...options, cliName })
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error(chalk.red(`\n✗ ${error.message}\n`))
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
printCommandHeader({ cliName, command: 'sync', version: coreVersion })
|
|
28
|
+
console.log(chalk.gray(` scope: ${scope.label} (${scope.mode})`))
|
|
29
|
+
if (scope.workspaceRoot) {
|
|
30
|
+
console.log(chalk.gray(` workspace: ${scope.workspaceRoot}`))
|
|
31
|
+
}
|
|
32
|
+
console.log(chalk.gray(` projects: ${scope.entries.length}`))
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
if (scope.mode === 'workspace-all' && scope.workspaceRoot) {
|
|
35
|
+
const wsTmp = path.join(scope.workspaceRoot, 'tmp.yml')
|
|
30
36
|
if (!options.dryRun) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
37
|
+
const wsSchema = ensureTmpSchemaVersion(wsTmp)
|
|
38
|
+
if (wsSchema.patched) {
|
|
39
|
+
console.log(chalk.green(` outer tmp end.version → ${wsSchema.schemaVersion} (schema)`))
|
|
40
|
+
}
|
|
33
41
|
}
|
|
42
|
+
}
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
if (scope.entries.length === 0) {
|
|
45
|
+
console.log(chalk.yellow('\n no projects to sync'))
|
|
46
|
+
if (scope.mode === 'workspace-all') {
|
|
47
|
+
console.log(chalk.gray(' link services under api/ admin/ web/ then re-run'))
|
|
39
48
|
}
|
|
49
|
+
printCommandFooter({ version: coreVersion })
|
|
50
|
+
return
|
|
51
|
+
}
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
console.log(chalk.gray(` ${packageDefaults.packageName}@${coreVersion} (ok)`))
|
|
53
|
-
}
|
|
54
|
-
continue
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
syncCliRuntime(entry.path, { force: false })
|
|
58
|
-
const result = syncProjectToolchain(entry.path, { write: true })
|
|
59
|
-
console.log(result.created
|
|
60
|
-
? chalk.green(` created ${result.tsconfigRel}`)
|
|
61
|
-
: chalk.green(` updated ${result.tsconfigRel}`))
|
|
62
|
-
const core = syncCoreDependency(entry.path, coreVersion, { dryRun: options.dryRun })
|
|
63
|
-
if (core.synced) {
|
|
64
|
-
const label = options.dryRun
|
|
65
|
-
? chalk.gray(` would pin ${packageDefaults.packageName}@${coreVersion}`)
|
|
66
|
-
: chalk.green(` pinned ${packageDefaults.packageName}@${coreVersion}`)
|
|
67
|
-
console.log(label)
|
|
68
|
-
} else if (core.reason === 'up-to-date') {
|
|
69
|
-
console.log(chalk.gray(` ${packageDefaults.packageName}@${coreVersion} (ok)`))
|
|
70
|
-
}
|
|
71
|
-
if (!options.dryRun) {
|
|
72
|
-
const end = patchTmpEndVersion(entry.tmp, coreVersion)
|
|
73
|
-
if (end.patched) console.log(chalk.green(` end.version → ${coreVersion}`))
|
|
74
|
-
}
|
|
75
|
-
} catch (error) {
|
|
76
|
-
failed += 1
|
|
77
|
-
console.log(chalk.red(` failed: ${error.message}`))
|
|
78
|
-
}
|
|
53
|
+
let failed = 0
|
|
54
|
+
for (const entry of scope.entries) {
|
|
55
|
+
if (options.dryRun) {
|
|
56
|
+
const preview = syncOneProject(entry, coreVersion, { dryRun: true, tmpPath: entry.tmp ?? null })
|
|
57
|
+
printSyncProjectResult(preview)
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let tmpPath = entry.tmp ?? null
|
|
62
|
+
if (!tmpPath && scope.mode === 'standalone') {
|
|
63
|
+
tmpPath = ensureTmpFile(entry.path).tmpFilePath
|
|
79
64
|
}
|
|
65
|
+
|
|
66
|
+
const result = syncOneProject(entry, coreVersion, { dryRun: false, tmpPath })
|
|
67
|
+
printSyncProjectResult(result)
|
|
68
|
+
if (result.failed) failed += 1
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (scope.mode === 'workspace-all' && scope.workspaceRoot && !options.dryRun) {
|
|
80
72
|
try {
|
|
81
|
-
syncRegistryFromPath(workspaceRoot)
|
|
82
|
-
console.log(chalk.gray(' registry updated (~/.xrystal)'))
|
|
73
|
+
syncRegistryFromPath(scope.workspaceRoot)
|
|
74
|
+
console.log(chalk.gray('\n registry updated (~/.xrystal)'))
|
|
83
75
|
} catch (error) {
|
|
84
|
-
console.log(chalk.yellow(
|
|
85
|
-
}
|
|
86
|
-
if (failed) {
|
|
87
|
-
console.log(chalk.red(`\n sync finished with ${failed} error(s)`))
|
|
88
|
-
printCommandFooter({ version: coreVersion })
|
|
89
|
-
process.exit(1)
|
|
76
|
+
console.log(chalk.yellow(`\n registry skipped: ${error.message}`))
|
|
90
77
|
}
|
|
91
|
-
console.log(chalk.green('\n workspace sync done'))
|
|
92
|
-
printCommandFooter({ version: coreVersion })
|
|
93
|
-
return
|
|
94
78
|
}
|
|
95
79
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
printCommandHeader({ cliName, command: 'sync', version: coreVersion })
|
|
100
|
-
console.log(chalk.gray(` root: ${root}`))
|
|
101
|
-
|
|
102
|
-
const lo = auditBefore.layoutOptions ?? {}
|
|
103
|
-
console.log(chalk.gray(' from tmp.yml:'))
|
|
104
|
-
console.log(chalk.gray(` paths.root: ${lo.rootFolderPath ?? '—'}`))
|
|
105
|
-
console.log(chalk.gray(` paths.source: ${lo.mainFolderPath ?? '—'}`))
|
|
106
|
-
console.log(chalk.gray(` paths.special.dist: ${lo.pathsDist ?? '—'}`))
|
|
80
|
+
if (scope.hintAll) {
|
|
81
|
+
console.log(chalk.dim(`\n tip: ${scope.hintAll}`))
|
|
82
|
+
}
|
|
107
83
|
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
console.log(chalk.gray('\n would write tsconfig.json:'))
|
|
111
|
-
console.log(chalk.gray(` include: ${JSON.stringify(preview.merged.include)}`))
|
|
112
|
-
console.log(chalk.gray(` outDir: ${preview.merged.compilerOptions.outDir}`))
|
|
113
|
-
console.log(chalk.gray(` paths: ${JSON.stringify(preview.merged.compilerOptions.paths)}`))
|
|
114
|
-
console.log(chalk.gray(`\n bunfig → ${preview.paths.bunfigAliasLine}`))
|
|
84
|
+
if (failed) {
|
|
85
|
+
console.log(chalk.red(`\n sync finished with ${failed} error(s)`))
|
|
115
86
|
printCommandFooter({ version: coreVersion })
|
|
116
|
-
|
|
87
|
+
process.exit(1)
|
|
117
88
|
}
|
|
118
89
|
|
|
119
|
-
|
|
120
|
-
const layout = ensureTmpFile(root)
|
|
121
|
-
const end = patchTmpEndVersion(layout.tmpFilePath, coreVersion)
|
|
122
|
-
if (end.patched) console.log(chalk.green(` end.version → ${coreVersion}`))
|
|
123
|
-
console.log(result.created
|
|
124
|
-
? chalk.green(` created ${result.tsconfigRel}`)
|
|
125
|
-
: chalk.green(` updated ${result.tsconfigRel}`))
|
|
126
|
-
console.log(chalk.gray(` include → ${JSON.stringify(result.merged.include)}`))
|
|
127
|
-
console.log(chalk.gray(` outDir → ${result.merged.compilerOptions.outDir}`))
|
|
128
|
-
console.log(chalk.yellow(`\n bunfig.toml [resolve.alias]: ${result.paths.bunfigAliasLine}`))
|
|
90
|
+
console.log(chalk.green('\n sync done'))
|
|
129
91
|
printCommandFooter({ version: coreVersion })
|
|
130
92
|
}
|
|
131
93
|
|
|
132
94
|
cli
|
|
133
95
|
.command('sync')
|
|
134
96
|
.alias('sync-toolchain')
|
|
135
|
-
.description('Sync
|
|
97
|
+
.description('Sync tsconfig + @xrystal/core for current project (use --all inside a workspace for every link)')
|
|
136
98
|
.option('--dry-run', 'Preview without writing')
|
|
99
|
+
.option('--self', 'Inside a workspace: sync only the current linked project')
|
|
100
|
+
.option('--all', 'Inside a workspace: sync all api/admin/web linked projects + registry')
|
|
101
|
+
.option('--workspace', 'Alias for --all')
|
|
102
|
+
.addHelpText('after', () => formatSyncHelp({ cliName }))
|
|
137
103
|
.action(run)
|
|
138
104
|
}
|
|
139
105
|
|
package/x/bin/commands/tmp.mjs
CHANGED
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
} from '../helpers/tmp-layout.mjs'
|
|
15
15
|
import { formatLoaderSummary, summarizeLoaders } from '../helpers/tmp-config.mjs'
|
|
16
16
|
import { packageDefaults } from '../helpers/package-defaults.mjs'
|
|
17
|
-
import {
|
|
17
|
+
import { ensureTmpSchemaVersion, readTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
|
|
18
|
+
import { resolveProjectContext } from '../helpers/project-context.mjs'
|
|
18
19
|
|
|
19
20
|
export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
20
21
|
cli
|
|
21
22
|
.command('tmp')
|
|
22
|
-
.description(`Ensure tmp.yml exists (seed from ${packageDefaults.packageName})`)
|
|
23
|
+
.description(`Ensure inner/outer tmp.yml exists (seed from ${packageDefaults.packageName})`)
|
|
23
24
|
.option('--dry-run', 'Show target path without writing')
|
|
24
25
|
.action((options) => {
|
|
25
26
|
const root = getProjectRoot()
|
|
@@ -39,17 +40,19 @@ export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
|
39
40
|
|
|
40
41
|
const result = ensureTmpFile(root)
|
|
41
42
|
const rel = relativeFromRoot(root, result.tmpFilePath)
|
|
42
|
-
const
|
|
43
|
+
const schema = ensureTmpSchemaVersion(result.tmpFilePath)
|
|
43
44
|
|
|
45
|
+
const ctx = resolveProjectContext()
|
|
44
46
|
printCommandHeader({ cliName, command: 'tmp', version })
|
|
47
|
+
console.log(chalk.gray(` scope: ${ctx.label}`))
|
|
45
48
|
console.log(chalk.gray(` root: ${root}`))
|
|
46
49
|
console.log(result.created ? chalk.green(` created ${rel}`) : chalk.gray(` ok ${rel}`))
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
? chalk.green(` end.version → ${
|
|
51
|
-
: chalk.gray(` end.version: ${
|
|
52
|
-
console.log(
|
|
50
|
+
const schemaVersion = readTmpSchemaVersion(result.tmpFilePath)
|
|
51
|
+
if (schemaVersion) {
|
|
52
|
+
const schemaLabel = schema.patched
|
|
53
|
+
? chalk.green(` end.version → ${schemaVersion} (schema)`)
|
|
54
|
+
: chalk.gray(` end.version: ${schemaVersion} (schema)`)
|
|
55
|
+
console.log(schemaLabel)
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
try {
|
|
@@ -14,6 +14,7 @@ var defaults_default = {
|
|
|
14
14
|
cliBinFile: "main-cli.js",
|
|
15
15
|
tmpBaseName: "tmp",
|
|
16
16
|
tmpExtension: ".yml",
|
|
17
|
+
tmpSchemaVersion: 1,
|
|
17
18
|
apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
|
|
18
19
|
templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
|
|
19
20
|
publicFolderName: "public",
|
|
@@ -9,6 +9,7 @@ var defaults_default = {
|
|
|
9
9
|
cliBinFile: "main-cli.js",
|
|
10
10
|
tmpBaseName: "tmp",
|
|
11
11
|
tmpExtension: ".yml",
|
|
12
|
+
tmpSchemaVersion: 1,
|
|
12
13
|
apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
|
|
13
14
|
templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
|
|
14
15
|
publicFolderName: "public",
|
|
@@ -20,6 +20,7 @@ var defaults_default = {
|
|
|
20
20
|
cliBinFile: "main-cli.js",
|
|
21
21
|
tmpBaseName: "tmp",
|
|
22
22
|
tmpExtension: ".yml",
|
|
23
|
+
tmpSchemaVersion: 1,
|
|
23
24
|
apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
|
|
24
25
|
templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
|
|
25
26
|
publicFolderName: "public",
|
|
@@ -362,7 +363,7 @@ function readWorkspaceGlobalTmp(workspaceRoot) {
|
|
|
362
363
|
return match ? { fileWatchIntervalMs: Number(match[1]) } : {};
|
|
363
364
|
}
|
|
364
365
|
var readWorkspaceCoreTmp = readWorkspaceGlobalTmp;
|
|
365
|
-
function workspaceTmpTemplate(projectName
|
|
366
|
+
function workspaceTmpTemplate(projectName) {
|
|
366
367
|
return `project:
|
|
367
368
|
name: ${projectName}
|
|
368
369
|
|
|
@@ -384,7 +385,7 @@ configs:
|
|
|
384
385
|
kubeconfig: ~/.kube/config
|
|
385
386
|
|
|
386
387
|
end:
|
|
387
|
-
version:
|
|
388
|
+
version: 1
|
|
388
389
|
`;
|
|
389
390
|
}
|
|
390
391
|
export {
|