- Update app name, package name (skin.carrot.bbs → cn.qczlit.withyou), and bundle identifier - Update API endpoints (bbs.littlelan.cn → withyou.littlelan.cn) - Update URL scheme (carrotbbs:// → withyou://) - Rename database from carrot_bbs to with_you - Update CI/CD pipeline image names and artifact naming - Add Android signing configuration for release builds - Update all UI text and comments throughout the codebase - Refactor registerStore to use in-memory state instead of AsyncStorage persistence - Improve WebRTC track handling and call stream management - Add metro platform resolution for native platform support BREAKING app package, database, and URLs are no longer valid
90 lines
2.4 KiB
JavaScript
90 lines
2.4 KiB
JavaScript
const appJson = require('./app.json');
|
||
|
||
const isDevVariant = process.env.APP_VARIANT === 'dev';
|
||
const releaseApiBaseUrl = 'https://withyou.littlelan.cn/api/v1';
|
||
const releaseUpdatesBaseUrl = 'https://updates.littlelan.cn';
|
||
const devApiBaseUrl = process.env.EXPO_PUBLIC_API_BASE_URL || 'http://192.168.31.238:8080/api/v1';
|
||
|
||
function toManifestUrl(baseUrl, portOverride) {
|
||
const parsed = new URL(baseUrl);
|
||
if (portOverride != null) {
|
||
parsed.port = String(portOverride);
|
||
}
|
||
parsed.pathname = '/api/manifest';
|
||
parsed.search = '';
|
||
parsed.hash = '';
|
||
return parsed.toString();
|
||
}
|
||
|
||
const releaseUpdatesUrl =
|
||
process.env.EXPO_PUBLIC_UPDATES_URL || toManifestUrl(releaseUpdatesBaseUrl);
|
||
const devUpdatesUrl =
|
||
process.env.EXPO_PUBLIC_DEV_UPDATES_URL || toManifestUrl(devApiBaseUrl, 3001);
|
||
|
||
const expo = appJson.expo;
|
||
|
||
// 检测是否为 Web 平台
|
||
const isWeb = process.env.EXPO_TARGET === 'web' || process.env.PLATFORM === 'web';
|
||
|
||
// 原生平台特有的插件(在 Web 端会报错)
|
||
const nativeOnlyPlugins = [
|
||
'expo-camera',
|
||
'expo-notifications',
|
||
'expo-background-fetch',
|
||
'expo-media-library',
|
||
'expo-image-picker',
|
||
'expo-video',
|
||
'expo-sqlite',
|
||
'./plugins/withMainActivityConfigChange',
|
||
];
|
||
|
||
// 过滤插件:Web 端排除原生插件
|
||
const filteredPlugins = isWeb
|
||
? expo.plugins.filter((plugin) => {
|
||
const pluginName = Array.isArray(plugin) ? plugin[0] : plugin;
|
||
return !nativeOnlyPlugins.includes(pluginName);
|
||
})
|
||
: expo.plugins;
|
||
|
||
module.exports = {
|
||
...expo,
|
||
name: isDevVariant ? `${expo.name} Dev` : expo.name,
|
||
runtimeVersion: {
|
||
policy: 'appVersion',
|
||
},
|
||
updates: {
|
||
...(expo.updates || {}),
|
||
url: isDevVariant ? devUpdatesUrl : releaseUpdatesUrl,
|
||
checkAutomatically: 'ON_LOAD',
|
||
fallbackToCacheTimeout: 0,
|
||
},
|
||
ios: expo.ios,
|
||
android: {
|
||
...expo.android,
|
||
package: 'skin.carrot.bbs',
|
||
},
|
||
// Web 端使用过滤后的插件
|
||
plugins: filteredPlugins,
|
||
extra: {
|
||
...(expo.extra || {}),
|
||
appVariant: isDevVariant ? 'dev' : 'release',
|
||
apiBaseUrl: isDevVariant ? devApiBaseUrl : releaseApiBaseUrl,
|
||
updatesUrl: isDevVariant ? devUpdatesUrl : releaseUpdatesUrl,
|
||
},
|
||
// Web 端配置
|
||
...(isWeb && {
|
||
web: {
|
||
...expo.web,
|
||
build: {
|
||
...expo.web?.build,
|
||
// 配置 Web 端别名,避免加载原生模块
|
||
babel: {
|
||
dangerouslyAddModulePathsToTranspile: [
|
||
'react-native-webrtc',
|
||
],
|
||
},
|
||
},
|
||
},
|
||
}),
|
||
};
|