I got questions about deployment tns commands.
Even after reading the docs and tns --help, things are still unclear to me. So, here we go:
- Why
--watchis necessary forlivesync, isn't it the purpose of live syncing? - Is there a reason or situation I should prefer
livesyncoverrun --watchordebug --watch? - When
--emulatoris necessary? Only to call ios simulator and android official emulator? I've been using genymotion so I assume it pretends it's a real device. Is it always correct? Any other "fake" real device I should consider? - Where/how can I check what exactly is going on in the device/emulator? I mean, I'm under the impression that
livesynconly deploys changes, subsequentruns don't do the same? - What kind of changes requires a full deployment on device/emulator? I mean, complete uninstall before hitting
livesync,runordebug - What kind of changes requires a full platform rebuild? Removing and
tns platform adding back? Sorry for so many questions, but imho this topic is worth a more detailed article.
The
--watchenables re-occurring liveSync's. Without the--watchit just sync it up once and is done. In all reality not using--watchis probably fairly pointless; but there might be some case where you only want it liveSync'd once.run --watch=livesync --watchrun(w/o --watch) !=livesync--emulatorwill allow TNS to actually start an emulator, however if an Android emulator is already started then it is not needed as a android Emulator shows up as a "real" android device.--emulatorfor iOS is needed to force it to use the simulator.No way that I know of to really know what is going in,
--watchorlivesynconly reports it synced files; it doesn't give you a list.The reason to use a
runwould be if you change ANYTHING in theapp_resources/folder AND/OR add/modify a plugin (anything in the node_modules). Both of those require a complete rebuild. Please note doing atns run --watchwill NOT do a rebuild; it will just sync. You need to do atns runthen after it rebuilds and installs the new version, you can do a--watchYou shouldn't have to normally remove/re-add the platforms, but there are some weird corner cases where a
tns runor you deleting the app off the device and then doing atns rundoesn't seem to pick up your changes. This is more a last ditch fix. On iOS if you update a plugin and it updates a POD, this is one of the cases you should reset your platforms folder.One thing I need to stress;
tns run --watch===tns livesync --watch; this means even though you THINK you are doing atns runyou AREN'T if you add the--watchto it. I do have a bug report in for this; but as of v2.4 it is still annoyingly/deceptively broken...