Skip to content

[Formplayer] Cross-Platform Build Scripts for Formplayer Android Deployment #95

@najuna-brian

Description

@najuna-brian

Problem

The formplayer build scripts currently use PowerShell commands that only work on Windows, preventing developers on macOS and Linux from building and deploying the formplayer to Android assets.

Current scripts (Windows only):

"clean-rn-assets": "powershell -NoProfile -Command "Remove-Item -Path '../formulus/android/app/src/main/assets/formplayer_dist' -Recurse -Force -ErrorAction SilentlyContinue; mkdir -Force -Path '../formulus/android/app/src/main/assets/formplayer_dist'"",
"copy-to-rn": "npm run clean-rn-assets && powershell -NoProfile -Command "Copy-Item -Path './build/*' -Destination '../formulus/android/app/src/main/assets/formplayer_dist' -Recurse -Force"",This means:

  • ❌ Developers on Mac/Linux cannot use npm run build:rn
  • ❌ Cross-platform development workflow is broken
  • ❌ Team members must use Windows or manually copy files

Desired Solution

  1. Replace PowerShell with cross-platform Node.js scripts that work on Windows, macOS, and Linux
  2. Create two new script files:
    • scripts/clean-rn-assets.js - Cleans the Android assets directory
    • scripts/copy-to-rn.js - Copies build output to Android assets
  3. Add a simple command: npm run upload:android that builds, cleans, and copies in one step

Expected Behavior

After implementation, developers on all platforms should be able to run:

npm run upload:android This should:

  • ✅ Work on Windows, macOS, and Linux
  • ✅ Build the formplayer (npm run build)
  • ✅ Clean the formulus/android/app/src/main/assets/formplayer_dist directory
  • ✅ Copy the build output to Android assets folder
  • ✅ Provide clear console output for each step

Technical Requirements

  • Use Node.js built-in fs module (no external dependencies)
  • Handle errors gracefully (e.g., build directory doesn't exist)
  • Provide clear success/error messages
  • Maintain backward compatibility with existing build:rn command if possible

Files to Modify

  • package.json - Update scripts section
  • scripts/clean-rn-assets.js - New file (cross-platform clean script)
  • scripts/copy-to-rn.js - New file (cross-platform copy script)

Acceptance Criteria

  • npm run upload:android works on Windows
  • npm run upload:android works on macOS
  • npm run upload:android works on Linux
  • Scripts handle missing directories gracefully
  • Scripts provide clear console output
  • No external dependencies required
  • Backward compatibility maintained (existing commands still work)

Priority

Medium - Blocks cross-platform development 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