that would build me an app that uses the plugins in my project and uses an url to to another ionic serve for the content in order to do wifi livereload.
So a bit of customisation possible, and a bit of Ionic magic. And only need to rebuild once I meddle with the plugins.
I love that idea:
Interesting, so more or less a ionic cordova run --livereload that uses an app from ionic serve instead of what was built into it… That would mean it would have to include code to “receive” the running ionic serve instances instead of the real www.
Hmm, that should be doable with a little local scripting. Only thing missing is the code of the DevApp that displays the instances (and all workarounds so it can “just” display these then - but I am not sure if there are any).
Want to create a new topic for this “Local DevApp: Mix ionic cordova run --livereload with ideas from the Ionic DevApp” thing you just invented? I think we should talk about it some more @Tommertom.
Edit: I remembered that someone created a project on Github with a “build your own DevApp with your own plugins”. I am pretty sure one could reuse that code…
So much, that I created this topic myself. Let’s see if this goes somewhere.
So my thinking how this could work: ionic cordova run --livereload builds the app and sets the URL to the serve running locally. @Tommertom’s idea was to not do that as it requires this process to run, but to give the user the option to select a running separate ionic serve instance.
To make this work the app has to be build with the page that can display these instances, instead of the actual www.
The solution could be some command line tool that replaces www, then runs the build and installs it, then replaces www with the original files again. As we are talking about a native app, we even only have to replace the files inside platforms/ios|android with a set of files that can show the running ionic serve instances.
(One could even imagine that the process copies over config.xml as a data file to both the pseudo devapp and the real app one is developing, so the pseudo dev app can check if the native build still has all the necessary plugins in the correct version or if you need to replace the native app with a new one.)
People asking: What is the big advantage, I am fine with the plugins of the DevApp? The reason is that this app can be debuggable - which means you can learn a lot more about crashes and problems in the app. iOS AppStore apps can’t be.
This would make my life much easier. The process of actually making it happen is a bit over my head in the sense that I hadn’t considered this idea until 2 minutes ago, but I’ll think on it. If I come up with any good ideas, you’ll be the 2nd to know.
I never really used --livereload. It actually failed miserably on my PC. And I wouldnt want to use it, as I rather have wifi connection. And if you have seen one of the latest blogs from @joshmorony, you can see the advantage of wifi, as it allows you to test on multiple devices at the same time. A --livereload with cable won’t easily support.
As to the scripting, I think you may bump into the same issue as I did with the altDevApp: how to redirect navigation, without losing Cordova connection? Ionic serve does not serve cordova.js and cordova_plugins.js, so you need to inject it in the navigated view.
I tried navigation.location and InAppBrowser injection, but didn’t work. Next try: using iFrames (not recommended practice though). The last resort would be to build a plugin that does all the plugin injection stuff, aka, the Plugin That Rules Them All… But that would require some small but intelligent java/xcode developing which I am not keen on doing…
What I am hoping is that the Ionic Team is willing to share a bit how they do this trick in DevApp/Ionic View. Probably with some local saving and serving…but which files. And how to do the redirect.
All features you need to build in a CLI version too. And then we can consider doing PR on the CLI, I guess.
The community figuring out its own devapp - and indeed that is what I tried earlier (and posted in the forum). And it seemed to work on the vibration plugin. But not with another simple plugin (Device), due to absence of cordova.js etc. Seems that a navigation redirect kills the cordova connection. So I would love to hear suggestions on how to fix this. I tried InAppBrowser injection and possibly look into other features… Suggestion in the other thread please!
Makes sense, as there is no cordova.js when you use ionic serve. So somehow the Ionic DevApp has to work around that.
Unfortunately you can’t just debug the devapp as it comes from the store and check out if there is a cordova.js and where it comes from…
Would be nice to see ionic serve work with the phonegap developer app. Then it will be easy to move both ways: create boilerplate devapp and features in ionic serve to support it (like providing a appzip just as phonegap serve does)
Ok, then the Phonegap Developer is using something like Ionic Deploy or CodePush internally - which might be another interesting thing to look at to understand how one can replace files, but keep cordova.js in place.
This also points to an alternative solution to “hijacking” the build process: a Cordova plugin that somehow replaces the actual app with the “pseudo devapp” code.
@jaydz: thx for the message. We’ll see where we end.
As to my own efforts, I see that adding stuff to ionic-cli and ionic-app-scripts is a bit beyond my appetite (and no guarantee any PR is granted into the master). I did experiment and managed to generate zip files for the contentsync plugin to use while serving in ionic serve, but absolutely not worthy to use in a PR.
So, next step is to see if I can use the contentsync code to create my own plugin to load cordova assets on web assets served from a remote host. In theory this should be doable. Let’s see if my skills (and time) are sufficient