Вопрос

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.

Это было полезно?

Решение

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.

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top