cmvr-wms/mobile-app/scripts/serve-development.mjs
lixiaolong 5cee6482f8 feat(assistant): 优化业务助手功能和移动应用配置
- 实现业务确认单条目的移出和恢复功能
- 添加报价匹配明细中的跳过处理选项
- 重构移动应用的环境配置使用默认开发配置
- 更新移动应用Android版本号策略
- 替换到货操作组件为独立的操作组件
- 添加安装配置检查脚本
- 增强测试覆盖包括条目移出恢复和报价跳过场景
2026-10-20 15:35:58 +08:00

18 lines
1.2 KiB
JavaScript

import path from 'node:path';
import os from 'node:os';
import {fileURLToPath} from 'node:url';
import {createRequire} from 'node:module';
import {createOtaServer} from './ota-server.mjs';
const require=createRequire(import.meta.url);
const {internal}=require('../config/environment.cjs');
const development=require('../config/development.json');
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'../..');
const origin=new URL(internal(development.updateOrigin,false));
if(origin.protocol!=='http:'||origin.pathname!=='/')throw Error('Development listener requires a direct local HTTP origin');
const addresses=Object.values(os.networkInterfaces()).flat().filter(Boolean).map(item=>item.address);
if(!addresses.includes(origin.hostname))throw Error('Development update IP is not assigned to this computer; check config/development.json');
const server=createOtaServer({root:path.join(root,'.codex-tmp/app-dev-ota/data'),environments:['dev'],
downloadDirectory:path.join(root,'.codex-tmp/app-dev-ota/downloads')});
server.listen(Number(origin.port||80),origin.hostname,()=>console.log(`Development-only updates ready: ${origin.origin}/updates/dev`));
server.on('error',error=>{console.error(error.message);process.exitCode=1;});