Phonegap source control gotchas? - ios

I'll be working in a team doing phonegap applications for the first time.
For a super simple boilerplate app shared by a team of 3, should I be including the entire project (i.e. all the directories):
app
--merges
--platforms
--plugins
--www
Having had user specific issues with conflicts which arise with iOS builds (and I'm assuming android builds), should I be adding the platforms directory in the .gitignore? Am I correct in assuming that all builds should be done by the user and not rely on someone else's phonegap build-ed versions of the app?

In my project we only commit the www folder and a windows batch file (We develop on Windows) that is the responsable for install automatically each plugin that the app needs.
When a new plugin is added, we add a new entry to that file.
When a new developer wants to make his developt enviroment with the app, him creates a new proyect and imports the www folder. After that, he runs the local build command and later runs the custom porject plugin file.

Related

Electron NSIS prevent reinstalling

Is there a way to have the NSIS built by Electron not re-install the app everytime it is clicked just like the MSI ? If the app is already installed I would like it to simply open it rather than re-installing.
I would use the MSI but when I open the app installed by it, it doesn't have read/write permissions from files inside the directory even if it is in Appdata (same folder as installation from NSIS). When installed from NSIS for some reason it gives read/write permissions to the app for files inside the installation directory.
Any help would be appreciated.
You need to edit your .nsi script file and do the check manually (skip the installation if an app is already installed) because there is no "switch" for that.
The issue with electron NSIS installers is that script is recreated every time (at least in the tutorials I saw) so you may lose any changes you made there.
In such case you cannot use the building pipeline, but you need to open the .nsi file with text editor, make the changes and compile everything with makensis.
Please post your script with more details.

Cordova Plugin Add/Remove for windows on a Mac

I am developing an app in Cordova that runs on iOS, Android, Windows and OSX. Everything is fine until you have to add or remove plugins. I develop the iOS, Android and OS X on a mac, and the Windows UWP on a windows machine.
When you try to add or remove a plugin you are stuck because on the mac I get the following error: "The platform "windows" does not appear to be a valid cordova platform." and fails.
When you try to add or remove a plugin on windows I get the following error: "The platform "android (or ios or osx)" does not appear to be a valid cordova platform." and fails.
Currently I remove windows from the platforms on the Windows computer, check the project in to github, check it out on my mac and and edit plugins for android/ios/osx then check it back in. After that I pull on my Windows and re-add the platform. The problem with this is cordova does not remember any images, app store associations, nuget packets etc making it a painstaking process that leads to many bugs.
Is there a way to ONLY add/remove a plugin on windows on the windows computer, and only for ios/android/osx on the mac and somehow make it all go together?
I would suspect this is happening because the platforms are not being successfully installed / removed. If you look in the platforms/ folder, check to see that the platforms that are acting up actually have valid folder structure and contents. If this is the case you need to manually remove the platforms.
Instead of removing the windows platform and committing to git, you should consider using the --nosave option: cordova platform remove windows --nosave. This way the changes are not saved to your package.json or configuration.xml. This would allow you to make changes on OSX without having to constantly check in the removed windows platform.
Something that may help is using the cordova repository management tool that I have created: https://www.npmjs.com/package/cordova-clean. This will help making sure all of the changes being made to the configuration are reflected in your current working directory across your machines / branches.

How to make TFS include bin and debug folders by default

I recently started working on a project that is using .Net Core & React. Our shop is using TFS for a version control and this is where I encountered a problem.
When React project is created it uses NPM that loads up a bunch of files in "node_modules" folder as dependencies. Some of these modules have "bin" and "debug" folders in them, but TFS naturally ignores them causing compilation issues for other developers.
Is there a way to add something like "!\ClientApp\node_modules*" to ".tfignore" file to eliminate this behavior on certain paths?
Remove all folders generated by package managers from source control entirely. Restoring packages should be part of your build process, both on your desktop and during CI.

Apache cordova for visual studio does not update iOS plaftorm files during build

I have just started an ionic based project within Visual Studio 2015 community edition and I am having trouble running the ripple emulator for iOS. It was working fine until I added a few new files to the project (angular translate and some of my own). Now when I go to
platforms\ios\www
I can see that the files I added are never being copied. Everything is working fine in the android platform folder though.
Is there a file that controls which files should be copied during build / deploy?
Like you mentioned in the comments, deleting the platforms folder forces Visual Studio to copy those files again, and it should build/deploy with the updated files.
Note that you may run into issues with some plugins not being able to be restored when you delete the whole platforms folder.
I suggest you just delete the following folder, for Android: platforms\android\assets\www

Problems with cordova remote build from visual studio to ios seems to be because of the phonegap push plugin

First of all, I am developing a Cordova app for Android and iOS, primarily.
I was using the deprecated version of the Phone gap push plugin:
https://github.com/phonegap-build/PushPlugin
Now I am using the new version:
https://github.com/phonegap/phonegap-plugin-push
And all my code is also using the new push plugin; I seem to not be able to get rid of the old push plugin completely and it sucks :(
It is beyond me how the old push plugin has a version number of 2.5 whereas the new push plugin has a version number of 1.5 or 1.6.. But moving on.
I am running the app on Android, and everything is ok. The app is running and working as supposed to. I am also successfully receiving notifications.
On iOS, also, everything was working as supposed to till give or take a month ago; but today when trying to deploy on an iOS device using Taco remote build from a windows pc (visual studio) to an apple macbook pro, I began facing many problems.
I then noticed that in the config.xml of the application (the one in the root of the project) there were both the old and the new push plugin. I mistakenly deleted the new one (because of the misleading version numbers; I thought it was in fact the old one). It seemed to run properly for a bit (on both Android and iOS) but after a while, I noticed that in reality the app was not going to work properly as it needed the new push plugin and it was not being found. So I deleted the old push plugin and installed the new push plugin (which happened to be also a more updated version of the new push plugin that I previously had).
Presently, my problem is that when running via taco remote build, the app manages to successfully deploy on an iOS device (iPhone 6) - so yes the remote build seems to be happening correctly!, however the app seems to not be recognising/locating/finding the new push plugin when running. I am suspecting that the new push plugin is not being transferred from visual studio on my windows pc into my apple macbook pro through the taco remote build.
In this directory: /Users/Jurgen/.taco_home/
I can see the build, with all the generated files. In the outermost plugins folder I can see the phonegap-plugin-push folder referring to the new push plugin:
/Users/Jurgen/.taco_home/remote-builds/taco-remote/builds/16880/cordovaApp/plugins/phonegap-plugin-push
Going further into the directory, into the platforms folder/ios/www/plugins etc, there is no phonegap-plugin-push:
/Users/Jurgen/.taco_home/remote-builds/taco-remote/builds/16880/cordovaApp/platforms/ios/www/plugins/-----
I think this might be the cause of the problem: though I am not 100% sure.
I thought that the iOS build most probably uses the plugins folder from the www folder inside the iOS folder and not the outermost (in the first directory shown above): And since the push plugin was nowhere to be seen inside there; that could have been the problem, even more so when bearing in mind that the .xcodeproject file resides in the same 'ios' folder.
So what I did was manually copy the push plugin folder into the innermost directory; which didn't work either. Even if it did, it does not really make sense and is highly inconvenient.
What can I do to ensure that the plugin is transferred into the iOS build with taco remote build? Could the problem be something else rather than what I suspect?
I am completely stuck; so any help would be greatly appreciated!
It sounds like the remote project is confused. Try this to see if it helps:
On your non-mac machine, ensure that only the correct plugin is referenced. This includes both config.xml and in the plugins folder. Consider removing the plugin entirely, then re-adding the correct version. If other plugins specify a dependency on the push plugin in their plugin.xml then that may also cause problems, especially if the biggest version number is not the latest version. You may need to remove those plugins too.
Once that is done, perform a clean build. Via taco-cli this would be taco build ios --clean, with whatever other device etc flags you want. Using Visual Studio you would go to build -> clean i believe.
This should copy your project in its entirety again, and avoid issues with conflicting plugin versions partially persisting.

Resources