Skip to content

[Formulus & Formplayer] Remove Hardcoded Version Numbers #115

@najuna-brian

Description

@najuna-brian

Remove Hardcoded Version Numbers - Implement Native-as-Source Version Management

Problem

The application currently has hardcoded version numbers scattered across the codebase, which leads to:

  1. Version drift: App version is defined in multiple places:

    • Android build.gradle (versionName)
    • iOS project.pbxproj (MARKETING_VERSION)
    • package.json files
    • Hardcoded strings in TypeScript files (FormulusMessageHandlers.ts, FormulusInterfaceDefinition.ts)
  2. Maintenance burden: Developers must manually update versions in multiple locations, increasing the risk of:

    • Forgetting to update a location
    • Version mismatches between platforms
    • Inconsistent versioning across the monorepo
  3. No single source of truth: It's unclear which file is authoritative, making releases error-prone.

Current State

Hardcoded Versions Found:

  • ode/formulus/src/webview/FormulusMessageHandlers.ts: '0.1.0-native'
  • ode/formulus/src/webview/FormulusInterfaceDefinition.ts: '1.1.0'
  • ode/formulus-formplayer/src/FormulusInterfaceDefinition.ts: '1.1.0'

Native Configs:

  • Android: android/app/build.gradleversionName = "1.0"
  • iOS: ios/Formulus.xcodeproj/project.pbxprojMARKETING_VERSION = 1.0

Requirements

  1. Single source of truth: Native platform configs (Android versionName, iOS MARKETING_VERSION) should be the authoritative source
  2. No hardcoded versions: Remove all hardcoded version strings from source code
  3. Automatic sync: Version should propagate automatically to:
    • React Native app code (via AppVersionService or generated constants)
    • Web component (formulus-formplayer)
    • Any other consumers
  4. Build-time generation: Version constants should be generated at build time, not runtime
  5. Interface version separation: API/interface compatibility version should be separate from app version (manually maintained, bumped on breaking changes)

Expected Solution

Implement a version management system that:

  • Reads version from native configs (Android build.gradle as primary, iOS as validation)
  • Generates version.ts files at build time for both formulus and formulus-formplayer
  • Uses react-native-device-info for runtime version retrieval (which reads from native)
  • Keeps interface version (FORMULUS_INTERFACE_VERSION) separate and manually maintained
  • Integrates with existing build scripts (prebuild, prestart)

Benefits

  • ✅ Eliminates version drift
  • ✅ Reduces manual maintenance
  • ✅ Prevents release errors
  • ✅ Clear, predictable versioning workflow
  • ✅ Follows React Native best practices

Acceptance Criteria

  • No hardcoded version strings in source code
  • Native configs are the single source of truth
  • Version automatically syncs to all consumers
  • Build scripts regenerate version files automatically
  • Interface version is separate from app version
  • Documentation updated with versioning workflow

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions