- 实现业务确认单条目的移出和恢复功能 - 添加报价匹配明细中的跳过处理选项 - 重构移动应用的环境配置使用默认开发配置 - 更新移动应用Android版本号策略 - 替换到货操作组件为独立的操作组件 - 添加安装配置检查脚本 - 增强测试覆盖包括条目移出恢复和报价跳过场景
20 lines
1.1 KiB
JavaScript
20 lines
1.1 KiB
JavaScript
const { internal } = require('../config/environment.cjs');
|
|
|
|
function assertInstallableConfig(config) {
|
|
const variant = config.extra?.environment;
|
|
if (!['dev', 'prod'].includes(variant)) throw Error('Explicit App environment required');
|
|
if (!config.updates?.enabled || !config.updates.codeSigningCertificate) throw Error('Installable App requires signed updates');
|
|
const url = new URL(config.updates.url);
|
|
// Loopback is valid for local preview, never for an APK delivered to phones.
|
|
internal(url.origin, false);
|
|
if (url.pathname !== `/updates/${variant}` || url.search || url.hash) throw Error('Update channel must match App environment');
|
|
if (config.updates.codeSigningMetadata?.keyid !== variant) throw Error('Update signing key must match App environment');
|
|
if (config.android?.package !== (variant === 'dev' ? 'cn.cmvr.wms.dev' : 'cn.cmvr.wms')) throw Error('App package/environment mismatch');
|
|
return url.toString();
|
|
}
|
|
module.exports = { assertInstallableConfig };
|
|
if (require.main === module) {
|
|
const config = require('../app.config.js')();
|
|
console.log(`Installable ${config.extra.environment} App: ${assertInstallableConfig(config)}`);
|
|
}
|