Include app source and update .gitignore to exclude local release artifacts and signing files. Made-with: Cursor
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
const appJson = require('./app.json');
|
|
|
|
const isDevVariant = process.env.APP_VARIANT === 'dev';
|
|
const releaseApiBaseUrl = 'https://bbs.littlelan.cn/api/v1';
|
|
const releaseWsUrl = 'wss://bbs.littlelan.cn/ws';
|
|
const releaseUpdatesBaseUrl = 'https://updates.littlelan.cn';
|
|
const devApiBaseUrl = process.env.EXPO_PUBLIC_API_BASE_URL || 'http://192.168.31.238:8080/api/v1';
|
|
const devWsUrl = process.env.EXPO_PUBLIC_WS_URL || 'ws://192.168.31.238:8080/ws';
|
|
|
|
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;
|
|
|
|
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',
|
|
},
|
|
extra: {
|
|
...(expo.extra || {}),
|
|
appVariant: isDevVariant ? 'dev' : 'release',
|
|
apiBaseUrl: isDevVariant ? devApiBaseUrl : releaseApiBaseUrl,
|
|
wsUrl: isDevVariant ? devWsUrl : releaseWsUrl,
|
|
updatesUrl: isDevVariant ? devUpdatesUrl : releaseUpdatesUrl,
|
|
},
|
|
};
|