thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

Build script with jx package #83

Closed deadlyfingers closed 8 years ago

deadlyfingers commented 8 years ago

Using cordova build hook script we need to copy node_modules to www/jxcore folder. It may be this can be compressed into single file for speeding mobile deployment.

deadlyfingers commented 8 years ago

This is linked to the work @vjrantal is doing with the jx packager: https://github.com/thaliproject/org.thaliproject.iospackager

deadlyfingers commented 8 years ago

Investigating possibility of archiving 'node_modules' rather that the entire 'jxcore' folder as typically the node_modules won't change as much as the client app. http://jxcore.com/packaging-code-protection/ jxcore dir archive example:

jx package app.js thali
echo "var thali = require('./thali.jx');" > app.js
deadlyfingers commented 8 years ago

TL;DR Works ok on iOS, but not so reliably on Android... atm I feel this should not be hooked into our default cordova build script. Might be easier to just use gulp to slim the 'node_modules' folder by removing any unnecessary files? The jx package can be done manually using:

gulp build
gulp package
cordova build

'jxcore' dir result: 181MB => 53MB 16,171 files => 2 files

Android overview: The jx package process probably won't provide any noticeable benefit to Android (this is because Cordova installs using an .apk archive so there is only a slight gain in deploy time.) Startup is slow every time you launch the app and you can only see a white screen which isn't ideal. Also results varied on various Android devices and the Xperia refused to work altogether:

Application Error
The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

iOS overview: Deploys from Xcode with notable gain in speed (this is because Xcode deploys as .app which means every single file must be copied individually). Startup is slow every time you launch the app however so not ideal for AppStore distribution unless the app was able to unpack itself into its 'Documents' sandbox dir and load from there for subsequent launches. However on the plus side you can see the logo on the index.html holding page while you wait for jxcore to unpack.

Future development: If this package process is done to help speed development deploy times then it would be a much better solution to implement @vjrantal live reload demo.