Let’s say I have a lot of Javascript code that will be deployed inside a desktop application and used as a web application (deployed to a server).
The only method that is obvious to me is to have the desktop application pull the source code when it builds.
Is there a better way to handle this?
Take a look at git submodules. You would treat the JS as a shared library and thus include it as a submodule in both the Web and Desktop applications.
http://git-scm.com/book/en/Git-Tools-Submodules