Created
May 12, 2026 08:05
-
-
Save karthiks/2349b1d2908426a28cc0b6023dc23739 to your computer and use it in GitHub Desktop.
Reference Typescript config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Helper to convert semantic version (e.g., 1.2.3) into a numeric code (10203) | |
| * This ensures Android versionCode is always incrementing correctly. | |
| */ | |
| const getVersionCode = (version: string): number => { | |
| const [major, minor, patch] = version.split('.').map(Number); | |
| return major * 10000 + minor * 100 + patch; | |
| }; | |
| const APP_VERSION = "1.2.3"; | |
| export const AppConfig = { | |
| // Environment-based switching | |
| apiEndpoint: __DEV__ | |
| ? "http://localhost:3000" | |
| : "https://api.production.com", | |
| theme: "dark" as const, | |
| // Version Management | |
| version: APP_VERSION, | |
| versionCode: getVersionCode(APP_VERSION), | |
| // Feature flags | |
| enableAnalytics: !__DEV__, | |
| // Documentation for fellow devs | |
| /** @deprecated Use apiEndpoint instead */ | |
| oldUrl: "https://old-api.com" | |
| }; | |
| export type Config = typeof AppConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment