mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
feat(ai): improve chart runtime UX
This commit is contained in:
1 parent
782f67ba63
commit
15470444e5
40 files changed
+1547
-144
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Cross-platform API server dev launcher.
|
||||
*/
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const pnpm = 'pnpm'
|
||||
const extraArgs = process.argv.slice(2)
|
||||
|
||||
function run(command, args, options = {}) {
|
||||
const result = spawnSync(command, args, {
|
||||
stdio: 'inherit',
|
||||
shell: false,
|
||||
...options,
|
||||
})
|
||||
if (result.error) {
|
||||
console.error(result.error.message)
|
||||
process.exit(1)
|
||||
}
|
||||
if (result.status !== 0) {
|
||||
process.exit(result.status ?? 1)
|
||||
}
|
||||
}
|
||||
|
||||
function runPnpm(args, options = {}) {
|
||||
if (process.env.npm_execpath) {
|
||||
run(process.execPath, [process.env.npm_execpath, ...args], options)
|
||||
return
|
||||
}
|
||||
run(pnpm, args, { shell: process.platform === 'win32', ...options })
|
||||
}
|
||||
|
||||
runPnpm(['run', 'ensure:server-native'])
|
||||
runPnpm([
|
||||
'exec',
|
||||
'tsx',
|
||||
'watch',
|
||||
'--include',
|
||||
'packages/core/src/**',
|
||||
'--include',
|
||||
'packages/node-runtime/src/**',
|
||||
'apps/cli/src/cli.ts',
|
||||
'start',
|
||||
'--headless',
|
||||
'--no-open',
|
||||
...extraArgs,
|
||||
])
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Cross-platform Web dev launcher.
|
||||
*
|
||||
* Windows shells do not support inline env syntax such as
|
||||
* `CHATLAB_AUTO_SERVE=1 vite ...`, so set the env in Node before spawning Vite.
|
||||
*/
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const pnpm = 'pnpm'
|
||||
const extraArgs = process.argv.slice(2)
|
||||
|
||||
function run(command, args, options = {}) {
|
||||
const result = spawnSync(command, args, {
|
||||
stdio: 'inherit',
|
||||
shell: false,
|
||||
...options,
|
||||
})
|
||||
if (result.error) {
|
||||
console.error(result.error.message)
|
||||
process.exit(1)
|
||||
}
|
||||
if (result.status !== 0) {
|
||||
process.exit(result.status ?? 1)
|
||||
}
|
||||
}
|
||||
|
||||
function runPnpm(args, options = {}) {
|
||||
if (process.env.npm_execpath) {
|
||||
run(process.execPath, [process.env.npm_execpath, ...args], options)
|
||||
return
|
||||
}
|
||||
run(pnpm, args, { shell: process.platform === 'win32', ...options })
|
||||
}
|
||||
|
||||
runPnpm(['run', 'ensure:server-native'])
|
||||
runPnpm(['exec', 'vite', '--config', 'vite.web.config.mts', ...extraArgs], {
|
||||
env: {
|
||||
...process.env,
|
||||
CHATLAB_AUTO_SERVE: '1',
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user