mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-10-16 05:45:32 +00:00
* feat: 支持 v2 插件、原生扩展与签名发布 * fix: 修复测试 * feat: 增强宿主 SDK、运行观测与制品维护能力 * feat: 增强文件传输、配置观测与本地开发能力 * feat: 支持 SSE 实时事件流并完善开发脚手架 * feat: 完善长连接鉴权复核与关闭回收 * feat: 增强生命周期与任务关闭可靠性 * feat: 收紧健康检查契约并补齐前端与真实网络验收 * feat: 增加SDK溯源与离线更新工具并验证跨版本兼容 * feat: 增加持久化业务示例与受控 Python 交付 * feat: 增加统一运行诊断与多worker状态观测 * feat: 增加固定目标发布等待与自动验收 * fix: 修复多环境插件部署前缀与代理配置不一致 * fix: 修复测试
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
import { readFileSync, writeFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { resolve } from 'node:path'
|
|
import { createServer } from 'vite'
|
|
|
|
// 复用宿主 Vite 配置,只替换隔离测试的端口、TLS 和代理目标。
|
|
const root = fileURLToPath(new URL('../../../', import.meta.url))
|
|
const [upstream, certificate, key, readyFile] = process.argv.slice(2)
|
|
process.chdir(root)
|
|
process.env.VITE_APP_PLUGIN_BASE = '/gateway'
|
|
const proxy = () => ({
|
|
target: upstream,
|
|
changeOrigin: false,
|
|
headers: { 'x-forwarded-proto': 'https' },
|
|
})
|
|
const server = await createServer({
|
|
root,
|
|
configFile: resolve(root, 'vite.config.js'),
|
|
server: {
|
|
host: '127.0.0.1',
|
|
port: 0,
|
|
open: false,
|
|
https: { cert: readFileSync(certificate), key: readFileSync(key) },
|
|
proxy: {
|
|
// 直接复用 Vite 配置的路径改写,避免测试覆盖掩盖实际代理配置错误。
|
|
'/gateway/apps/': { ...proxy(), ws: true },
|
|
'/gateway/plugin/runtime/': proxy(),
|
|
'/dev-api': proxy(),
|
|
},
|
|
},
|
|
})
|
|
await server.listen()
|
|
writeFileSync(readyFile, JSON.stringify({ port: server.httpServer.address().port }))
|
|
let stopping = false
|
|
async function stop() {
|
|
if (stopping) return
|
|
stopping = true
|
|
await server.close()
|
|
process.exit(0)
|
|
}
|
|
process.stdin.resume()
|
|
process.stdin.on('data', stop)
|
|
process.stdin.on('end', stop)
|
|
process.on('SIGTERM', stop)
|
|
process.on('SIGINT', stop)
|