Tuesday, May 4, 2021

Running cordova with supervisor

 supervisor helps you automatically restart your process when something in your directory, or any type of files changes.  This is particularly helped for developers making changes to their code base. They need not manually restart the server for each change. supervisor can take care of restarting.

To install supervisor globally, use:

# sudo npm install supervisor -g

When running a cordova server locally for testing, in order to use supervisor, use the following:

$ supervisor --ignore platforms -- /usr/local/bin/cordova run <platform>

For example:

$ supervisor --ignore platforms -- /usr/local/bin/cordova run browser

The --ignore platforms is required, else, during the build, the code gets changed in the platforms folder, and supervisor will unnecessarily restart the process.