3

https://github.com/mapbox/tilemill

I've been trying to figure out how tilemill packages their node application into a desktop application for mac, linux or windows. I've searched their github project and I do not see anything that gives any specifics about how they did this.

Johnston
  • 20,196
  • 18
  • 72
  • 121

2 Answers2

3

They are starting a mini-server on ports 20008 & 20009 using an included nodejs & libs, and then opening it in a webview. Each target platform has basic wrapper that controls node process, and opens a webview pointing to localhost:20009

For example, on Mac, everything (nodejs & libraries & assets) is included in TileMill.app/Resources/ then under TileMill.app/MacOS/ is TileMill which just loads node + index.js (in Resources/) and opens webview.

A simpler cross-platform way to accomplish something similar is to use node-webkit. Not only do you get easy deployment, but you can call nodejs directly inside the web-layer, instead of having a bunch of web callbacks. This means that you can do things like access files directly, and don't need to keep your client/server separate.

konsumer
  • 3,411
  • 1
  • 30
  • 31
  • Basically this, though to be clear the cross-platform UI/browser wrapper is a smaller concern than the requirement to static-compile all binary dependencies of the app. – tmcw Oct 14 '13 at 18:54
  • Yeh, node-webkit can be used in this way. I use it for my new version of [arduinoscope](https://github.com/konsumer/arduinoscope) to compile it's binary dep of the serial lib. Each target needs you to compile the modules for that platform (npm install, which compiles it's binary deps.) – konsumer Nov 26 '13 at 00:11
0

its just a packaged app, the dependecies can be found in package.json as for distribution and installing it uses,
nsis installer to deploy the app, since the node.exe doesn't have many dependecies (its one .exe) . So when installing it simply extracts from .exe to local directory, and delivers the application, if you explore the local directory, you will even find node_modules folder where every module is pre-installed.

Tilemill won't break on any update of your local node.js , because it uses its fixed version node.exe.

Gntem
  • 6,949
  • 2
  • 35
  • 48