-
Notifications
You must be signed in to change notification settings - Fork 8
Description
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
- Replace PowerShell with cross-platform Node.js scripts that work on Windows, macOS, and Linux
- Create two new script files:
scripts/clean-rn-assets.js- Cleans the Android assets directoryscripts/copy-to-rn.js- Copies build output to Android assets
- Add a simple command:
npm run upload:androidthat 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_distdirectory - ✅ Copy the build output to Android assets folder
- ✅ Provide clear console output for each step
Technical Requirements
- Use Node.js built-in
fsmodule (no external dependencies) - Handle errors gracefully (e.g., build directory doesn't exist)
- Provide clear success/error messages
- Maintain backward compatibility with existing
build:rncommand if possible
Files to Modify
package.json- Update scripts sectionscripts/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:androidworks on Windows -
npm run upload:androidworks on macOS -
npm run upload:androidworks 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