@xrystal/core 3.54.0 → 3.55.3
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 +2 -2
- package/package.json +2 -2
- package/x/bin/commands/config.mjs +77 -0
- package/x/bin/commands/create.mjs +58 -19
- package/x/bin/commands/guide.mjs +23 -0
- package/x/bin/commands/sync.mjs +13 -8
- package/x/bin/commands/telepresence.mjs +32 -37
- package/x/bin/commands/tmp.mjs +2 -13
- package/x/bin/commands/watch.mjs +59 -0
- package/x/bin/helpers/.generated/seed-from-tmp.mjs +3 -2
- package/x/bin/helpers/.generated/tmp-schema.mjs +3 -2
- package/x/bin/helpers/.generated/workspace.mjs +3 -2
- package/x/bin/helpers/.generated/xrystal-home-registry.mjs +6 -2
- package/x/bin/helpers/cli-help.mjs +102 -83
- package/x/bin/helpers/cli-i18n.mjs +224 -0
- package/x/bin/helpers/cli-lang.mjs +12 -0
- package/x/bin/helpers/resolve-infra-helper.mjs +22 -0
- package/x/bin/helpers/scaffold-frontend.mjs +90 -0
- package/x/bin/helpers/sync-project.mjs +25 -2
- package/x/bin/helpers/sync-tmp.mjs +49 -0
- package/x/bin/helpers/telepresence-layout.mjs +7 -5
- package/x/bin/helpers/tmp-template.mjs +18 -0
- package/x/bin/helpers/xrystal-config.mjs +62 -0
- package/x/bin/helpers/xrystal-watch-service.mjs +167 -0
- package/x/bin/main-cli.js +12 -0
- package/x/bin/scripts/publish-guard.mjs +4 -1
- package/x/dist/utils/constants/defaults.json +3 -2
- package/x/dist/utils/helpers/xrystal-home/registry.js +3 -0
- package/x/templates/frontend/package.json +9 -0
- package/x/templates/frontend/source/index.ts +12 -0
- package/x/templates/frontend/tsconfig.json +9 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import yaml from 'yaml'
|
|
4
|
+
|
|
5
|
+
import { packageDefaults } from './package-defaults.mjs'
|
|
6
|
+
import { ensureTmpFile, ownerTmpFilePath } from './tmp-layout.mjs'
|
|
7
|
+
import { resolveBundledServiceTmpTemplate } from './tmp-template.mjs'
|
|
8
|
+
import { findFileRecursively } from './index.mjs'
|
|
9
|
+
|
|
10
|
+
function defaultOwnerTmpPath(projectRoot, templatePath) {
|
|
11
|
+
try {
|
|
12
|
+
const template = yaml.parse(fs.readFileSync(templatePath, 'utf8'))
|
|
13
|
+
return ownerTmpFilePath(projectRoot, undefined, template.configs)
|
|
14
|
+
} catch {
|
|
15
|
+
return path.join(projectRoot, packageDefaults.packageRootFolder, `${packageDefaults.tmpBaseName}${packageDefaults.tmpExtension}`)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Ensure inner service tmp.yml exists before sync (schema heal runs in syncOneProject). */
|
|
20
|
+
export function ensureSyncProjectTmp(entry) {
|
|
21
|
+
const templatePath = resolveBundledServiceTmpTemplate({
|
|
22
|
+
globalType: entry.type,
|
|
23
|
+
slot: entry.slot,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const result = ensureTmpFile(entry.path, { templatePath, patchProjectName: true })
|
|
27
|
+
return {
|
|
28
|
+
tmpPath: result.tmpFilePath,
|
|
29
|
+
created: result.created,
|
|
30
|
+
layout: result.layout,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function previewSyncProjectTmp(entry) {
|
|
35
|
+
const templatePath = resolveBundledServiceTmpTemplate({
|
|
36
|
+
globalType: entry.type,
|
|
37
|
+
slot: entry.slot,
|
|
38
|
+
})
|
|
39
|
+
const existing = findFileRecursively(
|
|
40
|
+
entry.path,
|
|
41
|
+
packageDefaults.tmpBaseName,
|
|
42
|
+
packageDefaults.tmpExtension,
|
|
43
|
+
)
|
|
44
|
+
const target = existing ?? defaultOwnerTmpPath(entry.path, templatePath)
|
|
45
|
+
return {
|
|
46
|
+
tmpPath: target,
|
|
47
|
+
wouldCreate: !existing,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -23,15 +23,17 @@ export function writeWorkspaceTelepresenceFiles(workspaceRoot) {
|
|
|
23
23
|
return { examplePath }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export const SERVICE_TELEPRESENCE_ENV_REL = path.join('x', 'environments', '.env.telepresence')
|
|
27
|
+
|
|
26
28
|
export function ensureServiceTelepresenceEnv(serviceRoot) {
|
|
27
29
|
const root = path.resolve(serviceRoot)
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
fs.
|
|
31
|
-
if (
|
|
30
|
+
const envPath = path.join(root, SERVICE_TELEPRESENCE_ENV_REL)
|
|
31
|
+
fs.mkdirSync(path.dirname(envPath), { recursive: true })
|
|
32
|
+
const created = !fs.existsSync(envPath)
|
|
33
|
+
if (created) {
|
|
32
34
|
fs.writeFileSync(envPath, SERVICE_TELEPRESENCE_ENV)
|
|
33
35
|
}
|
|
34
|
-
return envPath
|
|
36
|
+
return { envPath, envRel: SERVICE_TELEPRESENCE_ENV_REL, created }
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/** Deploy name (tmp project.name) → workspace api folder name */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
|
|
3
|
+
import { GlobalTypeEnum, WorkspaceSlotEnum } from './cli-enums.mjs'
|
|
4
|
+
import { getCliPackageRoot } from './project-root.mjs'
|
|
5
|
+
import { packageDefaults } from './package-defaults.mjs'
|
|
6
|
+
|
|
7
|
+
export function resolveBundledServiceTmpTemplate({ globalType, slot } = {}) {
|
|
8
|
+
const packageRoot = getCliPackageRoot()
|
|
9
|
+
const isFrontend = globalType === GlobalTypeEnum.FRONTEND
|
|
10
|
+
|| slot === WorkspaceSlotEnum.WEB
|
|
11
|
+
|| slot === WorkspaceSlotEnum.MOBILE
|
|
12
|
+
|
|
13
|
+
const rel = isFrontend
|
|
14
|
+
? (packageDefaults.frontendTemplateRel ?? 'x/templates/frontend/tmp.yml')
|
|
15
|
+
: packageDefaults.apiServiceTemplateRel
|
|
16
|
+
|
|
17
|
+
return path.join(packageRoot, rel)
|
|
18
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
|
|
3
|
+
import { CliLangEnum, normalizeCliLang } from './cli-lang.mjs'
|
|
4
|
+
import { ensureXrystalHome, resolveXrystalHome } from './xrystal-registry.mjs'
|
|
5
|
+
|
|
6
|
+
const CONFIG_VERSION = 1
|
|
7
|
+
|
|
8
|
+
export function configFilePath() {
|
|
9
|
+
return `${resolveXrystalHome()}/config.json`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function readXrystalConfig() {
|
|
13
|
+
ensureXrystalHome()
|
|
14
|
+
const file = configFilePath()
|
|
15
|
+
if (!fs.existsSync(file)) {
|
|
16
|
+
return { version: CONFIG_VERSION, cli: {} }
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const doc = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
20
|
+
return {
|
|
21
|
+
version: doc?.version ?? CONFIG_VERSION,
|
|
22
|
+
cli: typeof doc?.cli === 'object' && doc.cli !== null ? doc.cli : {},
|
|
23
|
+
updatedAt: doc?.updatedAt ?? null,
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
return { version: CONFIG_VERSION, cli: {} }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function writeXrystalConfig(next) {
|
|
31
|
+
ensureXrystalHome()
|
|
32
|
+
const current = readXrystalConfig()
|
|
33
|
+
const merged = {
|
|
34
|
+
version: CONFIG_VERSION,
|
|
35
|
+
updatedAt: new Date().toISOString(),
|
|
36
|
+
cli: { ...current.cli, ...(next.cli ?? {}) },
|
|
37
|
+
}
|
|
38
|
+
fs.writeFileSync(configFilePath(), `${JSON.stringify(merged, null, 2)}\n`)
|
|
39
|
+
return merged
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getCliConfigLang() {
|
|
43
|
+
const lang = readXrystalConfig().cli?.lang
|
|
44
|
+
if (!lang) return null
|
|
45
|
+
return normalizeCliLang(lang)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function setCliConfigLang(lang) {
|
|
49
|
+
const normalized = normalizeCliLang(lang)
|
|
50
|
+
writeXrystalConfig({ cli: { lang: normalized } })
|
|
51
|
+
return normalized
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function clearCliConfigLang() {
|
|
55
|
+
const current = readXrystalConfig()
|
|
56
|
+
const { lang: _removed, ...rest } = current.cli ?? {}
|
|
57
|
+
writeXrystalConfig({ cli: rest })
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function listSupportedCliLangs() {
|
|
61
|
+
return [CliLangEnum.EN, CliLangEnum.TR]
|
|
62
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import os from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
|
|
6
|
+
import { resolveXrystalHome } from './xrystal-registry.mjs'
|
|
7
|
+
import { watchDaemonScriptPath, watchLogPath } from './xrystal-watch-spawn.mjs'
|
|
8
|
+
|
|
9
|
+
const LAUNCHD_LABEL = 'com.xrystal.watch'
|
|
10
|
+
const SYSTEMD_UNIT = 'xrystal-watch.service'
|
|
11
|
+
|
|
12
|
+
export function launchAgentPath() {
|
|
13
|
+
return path.join(os.homedir(), 'Library', 'LaunchAgents', `${LAUNCHD_LABEL}.plist`)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function systemdUserUnitPath() {
|
|
17
|
+
return path.join(os.homedir(), '.config', 'systemd', 'user', SYSTEMD_UNIT)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function shellQuote(value) {
|
|
21
|
+
return `'${String(value).replace(/'/g, `'\\''`)}'`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function buildLaunchAgentPlist() {
|
|
25
|
+
const nodeBin = process.execPath
|
|
26
|
+
const script = watchDaemonScriptPath()
|
|
27
|
+
const logPath = watchLogPath()
|
|
28
|
+
|
|
29
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
30
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
31
|
+
<plist version="1.0">
|
|
32
|
+
<dict>
|
|
33
|
+
<key>Label</key>
|
|
34
|
+
<string>${LAUNCHD_LABEL}</string>
|
|
35
|
+
<key>ProgramArguments</key>
|
|
36
|
+
<array>
|
|
37
|
+
<string>${nodeBin}</string>
|
|
38
|
+
<string>${script}</string>
|
|
39
|
+
</array>
|
|
40
|
+
<key>RunAtLoad</key>
|
|
41
|
+
<true/>
|
|
42
|
+
<key>KeepAlive</key>
|
|
43
|
+
<true/>
|
|
44
|
+
<key>StandardOutPath</key>
|
|
45
|
+
<string>${logPath}</string>
|
|
46
|
+
<key>StandardErrorPath</key>
|
|
47
|
+
<string>${logPath}</string>
|
|
48
|
+
<key>EnvironmentVariables</key>
|
|
49
|
+
<dict>
|
|
50
|
+
<key>XRY_WATCH_DAEMON</key>
|
|
51
|
+
<string>1</string>
|
|
52
|
+
</dict>
|
|
53
|
+
</dict>
|
|
54
|
+
</plist>
|
|
55
|
+
`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function buildSystemdUserUnit() {
|
|
59
|
+
const nodeBin = process.execPath
|
|
60
|
+
const script = watchDaemonScriptPath()
|
|
61
|
+
const logPath = watchLogPath()
|
|
62
|
+
return `[Unit]
|
|
63
|
+
Description=Xrystal workspace tmp watcher (~/.xrystal)
|
|
64
|
+
After=network.target
|
|
65
|
+
|
|
66
|
+
[Service]
|
|
67
|
+
Type=simple
|
|
68
|
+
ExecStart=${nodeBin} ${script}
|
|
69
|
+
Restart=always
|
|
70
|
+
RestartSec=3
|
|
71
|
+
Environment=XRY_WATCH_DAEMON=1
|
|
72
|
+
StandardOutput=append:${logPath}
|
|
73
|
+
StandardError=append:${logPath}
|
|
74
|
+
|
|
75
|
+
[Install]
|
|
76
|
+
WantedBy=default.target
|
|
77
|
+
`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function detectWatchServicePlatform() {
|
|
81
|
+
if (process.platform === 'darwin') return 'launchd'
|
|
82
|
+
if (process.platform === 'linux') return 'systemd'
|
|
83
|
+
return null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function watchServiceStatus() {
|
|
87
|
+
const platform = detectWatchServicePlatform()
|
|
88
|
+
if (platform === 'launchd') {
|
|
89
|
+
const plist = launchAgentPath()
|
|
90
|
+
if (!fs.existsSync(plist)) return { installed: false, platform, unitPath: plist }
|
|
91
|
+
try {
|
|
92
|
+
execSync(`launchctl print gui/$(id -u)/${LAUNCHD_LABEL}`, { stdio: 'pipe' })
|
|
93
|
+
return { installed: true, running: true, platform, unitPath: plist }
|
|
94
|
+
} catch {
|
|
95
|
+
return { installed: true, running: false, platform, unitPath: plist }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (platform === 'systemd') {
|
|
100
|
+
const unit = systemdUserUnitPath()
|
|
101
|
+
if (!fs.existsSync(unit)) return { installed: false, platform, unitPath: unit }
|
|
102
|
+
try {
|
|
103
|
+
const out = execSync('systemctl --user is-active xrystal-watch.service', { encoding: 'utf8' }).trim()
|
|
104
|
+
return { installed: true, running: out === 'active', platform, unitPath: unit }
|
|
105
|
+
} catch {
|
|
106
|
+
return { installed: true, running: false, platform, unitPath: unit }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return { installed: false, platform: null, unitPath: null }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function installWatchService() {
|
|
114
|
+
fs.mkdirSync(resolveXrystalHome(), { recursive: true })
|
|
115
|
+
|
|
116
|
+
const platform = detectWatchServicePlatform()
|
|
117
|
+
if (platform === 'launchd') {
|
|
118
|
+
const plistPath = launchAgentPath()
|
|
119
|
+
fs.mkdirSync(path.dirname(plistPath), { recursive: true })
|
|
120
|
+
fs.writeFileSync(plistPath, buildLaunchAgentPlist())
|
|
121
|
+
try {
|
|
122
|
+
execSync(`launchctl bootout gui/$(id -u) ${shellQuote(plistPath)}`, { stdio: 'ignore' })
|
|
123
|
+
} catch { /* not loaded */ }
|
|
124
|
+
execSync(`launchctl bootstrap gui/$(id -u) ${shellQuote(plistPath)}`)
|
|
125
|
+
execSync(`launchctl kickstart -k gui/$(id -u)/${LAUNCHD_LABEL}`)
|
|
126
|
+
return { installed: true, platform, unitPath: plistPath }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (platform === 'systemd') {
|
|
130
|
+
const unitPath = systemdUserUnitPath()
|
|
131
|
+
fs.mkdirSync(path.dirname(unitPath), { recursive: true })
|
|
132
|
+
fs.writeFileSync(unitPath, buildSystemdUserUnit())
|
|
133
|
+
execSync('systemctl --user daemon-reload')
|
|
134
|
+
execSync('systemctl --user enable --now xrystal-watch.service')
|
|
135
|
+
return { installed: true, platform, unitPath: unitPath }
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
throw new Error(`OS service install not supported on ${process.platform} — use: xry watch start`)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function uninstallWatchService() {
|
|
142
|
+
const platform = detectWatchServicePlatform()
|
|
143
|
+
if (platform === 'launchd') {
|
|
144
|
+
const plistPath = launchAgentPath()
|
|
145
|
+
if (fs.existsSync(plistPath)) {
|
|
146
|
+
try {
|
|
147
|
+
execSync(`launchctl bootout gui/$(id -u) ${shellQuote(plistPath)}`, { stdio: 'ignore' })
|
|
148
|
+
} catch { /* ignore */ }
|
|
149
|
+
fs.unlinkSync(plistPath)
|
|
150
|
+
}
|
|
151
|
+
return { removed: true, platform, unitPath: plistPath }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (platform === 'systemd') {
|
|
155
|
+
const unitPath = systemdUserUnitPath()
|
|
156
|
+
if (fs.existsSync(unitPath)) {
|
|
157
|
+
try {
|
|
158
|
+
execSync('systemctl --user disable --now xrystal-watch.service', { stdio: 'ignore' })
|
|
159
|
+
} catch { /* ignore */ }
|
|
160
|
+
fs.unlinkSync(unitPath)
|
|
161
|
+
execSync('systemctl --user daemon-reload')
|
|
162
|
+
}
|
|
163
|
+
return { removed: true, platform, unitPath: unitPath }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
throw new Error(`OS service uninstall not supported on ${process.platform}`)
|
|
167
|
+
}
|
package/x/bin/main-cli.js
CHANGED
|
@@ -14,7 +14,10 @@ import { registerTagCommand, registerVersionCommand } from './commands/release.m
|
|
|
14
14
|
import { registerTelepresenceCommand } from './commands/telepresence.mjs'
|
|
15
15
|
import { registerHooksCommand } from './commands/hooks.mjs'
|
|
16
16
|
import { registerWatchCommand } from './commands/watch.mjs'
|
|
17
|
+
import { registerGuideCommand } from './commands/guide.mjs'
|
|
18
|
+
import { registerConfigCommand } from './commands/config.mjs'
|
|
17
19
|
import { printBanner, shouldShowBanner } from './helpers/banner.mjs'
|
|
20
|
+
import { initCliLang } from './helpers/cli-i18n.mjs'
|
|
18
21
|
import { formatRootHelp, formatCreateCommandHelp, isCreateHelpRequest, isRootHelpRequest, printQuickStartGuide } from './helpers/cli-help.mjs'
|
|
19
22
|
import {
|
|
20
23
|
PACKAGE_NAME,
|
|
@@ -25,6 +28,8 @@ import { readCliPackageJson, getProjectRoot } from './helpers/project-root.mjs'
|
|
|
25
28
|
import { ensureProjectArtifacts } from './helpers/project-artifacts.mjs'
|
|
26
29
|
import { resolveCliContext } from './helpers/cli-runtime.mjs'
|
|
27
30
|
|
|
31
|
+
initCliLang(process.argv)
|
|
32
|
+
|
|
28
33
|
const pkg = readCliPackageJson()
|
|
29
34
|
const projectRoot = getProjectRoot()
|
|
30
35
|
|
|
@@ -56,6 +61,11 @@ cli
|
|
|
56
61
|
.name(PACKAGE_NAME)
|
|
57
62
|
.description(packageCliDescription())
|
|
58
63
|
.version(pkg.version, '-V, --version', `Show ${PACKAGE_NAME} version`)
|
|
64
|
+
.option('--lang <code>', 'CLI language for this run: en | tr (persist: xry config lang)')
|
|
65
|
+
.hook('preAction', (_thisCommand, actionCommand) => {
|
|
66
|
+
const lang = actionCommand.opts()?.lang
|
|
67
|
+
if (lang) initCliLang(['node', 'xry', '--lang', lang])
|
|
68
|
+
})
|
|
59
69
|
.allowExcessArguments(true)
|
|
60
70
|
.configureHelp({
|
|
61
71
|
helpWidth: () => Math.min(100, Math.max(56, process.stdout.columns || 80)),
|
|
@@ -81,6 +91,8 @@ registerSyncCommand(cli, cliContext)
|
|
|
81
91
|
registerWorkspacesCommand(cli, cliContext)
|
|
82
92
|
registerProjectsCommand(cli, cliContext)
|
|
83
93
|
registerWatchCommand(cli, cliContext)
|
|
94
|
+
registerGuideCommand(cli, cliContext)
|
|
95
|
+
registerConfigCommand(cli, cliContext)
|
|
84
96
|
registerHooksCommand(cli, cliContext)
|
|
85
97
|
registerTelepresenceCommand(cli, cliContext)
|
|
86
98
|
registerProjectCommands(cli, cliContext)
|
|
@@ -112,7 +112,10 @@ export function assertDistMinified(root = process.cwd()) {
|
|
|
112
112
|
|
|
113
113
|
export function assertNpmPackClean(root = process.cwd()) {
|
|
114
114
|
const dryRun = execSync('npm pack --dry-run 2>&1', { cwd: root, encoding: 'utf8' })
|
|
115
|
-
|
|
115
|
+
const forbiddenSourceLines = dryRun
|
|
116
|
+
.split('\n')
|
|
117
|
+
.filter((line) => /source\/.*\.ts/.test(line) && !line.includes('x/templates/'))
|
|
118
|
+
if (forbiddenSourceLines.length > 0) {
|
|
116
119
|
throw new PublishGuardError('npm pack tarball lists source/ — TypeScript source must not ship')
|
|
117
120
|
}
|
|
118
121
|
if (!/\/dist\/.*\.js/.test(dryRun)) {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"tmpExtension": ".yml",
|
|
11
11
|
"tmpSchemaVersion": 1,
|
|
12
12
|
"apiServiceTemplateRel": "x/templates/api-service/tmp.yml",
|
|
13
|
+
"frontendTemplateRel": "x/templates/frontend/tmp.yml",
|
|
13
14
|
"templateRepoUri": "https://github.com/xdloper/api-gpt-svc",
|
|
14
15
|
"publicFolderName": "public",
|
|
15
16
|
"kafkaLogsTopic": "log",
|
|
@@ -18,8 +19,8 @@
|
|
|
18
19
|
"brand": {
|
|
19
20
|
"primary": "xrystal",
|
|
20
21
|
"secondary": "core",
|
|
21
|
-
"tagline": "
|
|
22
|
-
"capabilities": "loaders \u00b7 tmp.yml \u00b7 dto \u00b7 i18n \u00b7 multi-protocol \u00b7 scaffold"
|
|
22
|
+
"tagline": "runtime framework for APIs, frontends & workspaces",
|
|
23
|
+
"capabilities": "loaders \u00b7 tmp.yml \u00b7 workspace \u00b7 dto \u00b7 i18n \u00b7 multi-protocol \u00b7 scaffold"
|
|
23
24
|
},
|
|
24
25
|
"runtimes": {
|
|
25
26
|
"bun": {
|
|
@@ -4,6 +4,9 @@ import path from 'node:path';
|
|
|
4
4
|
import { findEntries, findWorkspaceRoot } from '../../../utils/helpers/workspace/index.js';
|
|
5
5
|
export const XRYSTAL_HOME_DIR = '.xrystal';
|
|
6
6
|
export function resolveXrystalHome() {
|
|
7
|
+
const override = process.env.XRYSTAL_HOME?.trim();
|
|
8
|
+
if (override)
|
|
9
|
+
return path.resolve(override);
|
|
7
10
|
return path.join(os.homedir(), XRYSTAL_HOME_DIR);
|
|
8
11
|
}
|
|
9
12
|
export function registryFilePath() {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const port = Number(process.env.PORT ?? 3000)
|
|
2
|
+
|
|
3
|
+
const server = Bun.serve({
|
|
4
|
+
port,
|
|
5
|
+
fetch() {
|
|
6
|
+
return new Response(JSON.stringify({ ok: true, service: 'frontend' }), {
|
|
7
|
+
headers: { 'content-type': 'application/json' },
|
|
8
|
+
})
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
console.log(`frontend dev → http://localhost:${server.port}`)
|