- Install Visual Studio 19 w/ Desktop development with C++ workload
- Install Python 2.7
- Install Node 18.17.0
- Install Git for windows
- Install GTK+ (version 2.22.1, do NOT get version 3)
- Install libjpeg-turbo64
- Install Yarn
- npm install yarn -g
- Note: Electron 27+ only officially supports MacOS Catalina 10.15 or higher
- Install Xcode 11.3 or greater
- Install homebrew
- Install python 2.7
- export PYTHON_PATH=/path/to/python2.7
- Install Node Version Manager
- Install Node
- nvm install 18.17.0
- Install Yarn
- npm install yarn -g
- Install Git, Pip, Build tools, and Canvas dependencies
- sudo apt-get upgrade
- sudo apt-get install pip git build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev build-essential g++
- Install Node Version Manager
- Install Node
- nvm install 18.17.0
- Install Yarn. We are currently using 1.22.22, check for correct version under .yarn/releases.
- npm install yarn -g
- Install dependencies
- sudo yum upgrade
- sudo yum install git-all
- sudo yum install cairo-devel
- sudo yum install gcc gcc-c++
- sudo yum groupinstall "Development Tools" "Development Libraries"
- sudo yum install rpm-build
- Configure GIT
- git config --global url."https://github.com/".insteadOf git://github.com/
- Install Node Version Manager
- Install Node
- nvm install 18.17.0
- Install Yarn
- npm install yarn -g
- Install dependencies
- sudo yum upgrade
- sudo yum install git-all
- sudo yum install cairo-devel
- sudo yum install gcc gcc-c++
- sudo yum groupinstall "Development Tools" "Development Libraries"
- sudo yum install rpm-build
- Configure GIT
- git config --global url."https://github.com/".insteadOf git://github.com/
- Install Node Version Manager
- Install Node
- nvm install 18.17.0
- Install Yarn
- npm install yarn -g
- You may find it necessary to install libvips if you're working on getting sharp to build natively during your build process
- Install libXScrnSaver
- sudo yum install libXScrnSaver
Once you have set up a development environment, these steps will let you build and run MapCache:
- Update node's max old space size
(mac/linux:
export NODE_OPTIONS=--max-old-space-size=8192
) (win:set NODE_OPTIONS=-max-old-space-size=8192
) - Download the code:
git clone https://github.com/ngageoint/mapcache-electron.git && cd mapcache-electron
- Fix git:// error:
git config --global url."https://".insteadOf git://
- Remove yarn.lock to clear x86/arm compatibility problems
rm -rf yarn.lock
- A note for Windows: We are typically building on MacOS, leading to the '.yarn' folder and '.yarnrc' file having OS specific builds. Delete these two items when building on windows and ensure you have yarn installed
- Install dependencies:
yarn
- Important: rebuild sharp and better-sqlite3 to get the appropriate binaries:
yarn run rebuild
- Run:
yarn dev
(run locally in development mode)
The MapCache Desktop build and runtime processes will generate several files. The following commands will help cleanup your environment.
- Remove previously built resources:
rm -rf dist_electron
- To remove the MapCache Desktop development runtime application data:
rm -rf ~/Library/Application\ Support/Electron
- To remove the MapCache Desktop production runtime application data:
rm -rf ~/Library/Application\ Support/MapCache
- To remove all the client (javascript) dependencies installed by
yarn
use:
rm -rf node_modules
The application uses https://www.npmjs.com/package/electron-log for logging.
Log files can be found in the user's data directory:
- on Linux: {userData}/logs/mapcache.log
- on macOS: {userData}/logs/mapcache.log
- on Windows: {userData}\logs\mapcache.log
The application is broken up into a main node.js process, node worker_threads and electron browser window processes.
The browser window processes can be debugged using the chrome developer tools.
- Dev tools can be toggled via the file menu for a browser window.
- All dev tools windows can be shown by using the keyboard shortcut CommandOrControl+Shift+S.
- All dev tools windows can be hidden by using the keyboard shortcut CommandOrControl+Shift+H.
You can hook up vscode for debugging both the front and backend via launch.json configuration files. Read more here: https://github.com/ngageoint/mapcache-electron/wiki/VS-Code-debugging
The following will help you create binaries for windows, linux, and macOS. Due to native libraries within the application, each build must occur on its specific platform.
- Build Windows
yarn electron:build-win
- Build Linux
yarn electron:build-linux
Note: Sharp does not build correctly on linux. When running electron-builder, it's not grabbing the node binary file and placing it in the node_modules/sharp/build/Release directory. When building on linux, after runningyarn
, runyarn rebuild
to generate the necessary binary, then remove the "binding.gyp" file located in node_modules/sharp directory. This will prevent electron-builder from deleting the binary and failing to grab a new one during packaging. Sharp 0.33.0 made changes to the way the binaries are packaged, but it's still not showing up with that version either. It has references to @img/sharp-linux-x64, read the sharp install page for more info. To install the completed rpm file, usesudo rpm -i MapCache.1.6.0.rpm --force
. If it's not starting after install, make sure you don't already have mapcache runningps -ef
and kill any existing processes - Build Mac (note, ensure app is signed using Developer ID Application certificate)
yarn electron:build-mac
- Build for Mac App Store (note, ensure app is signed by Apple Distribution certificate)
yarn electron:build-mas
- The newly created installers are located in the build folder:
cd dist_electron
There are several services and urls that are used by MapCache. In order for mapcache to work on a specific network, you will need to ensure access to these services/urls. If there is no access to a service or url, you will need to reconfigure them to point to a valid location or leave them blank, which will disable the feature.
- Edit
src/lib/env/env.js
- Make necessary changes
- Save
note: Do not check these changes in.
Notarizing the application is necessary for distributing outside of the Mac App Store.
- Build mac build
yarn electron:build-mac
- Navigate to build folder
cd dist_electron
- Store your credentials in your keychain
xcrun notarytool store-credentials —username [username] —team-id [teamID] —password [password]
- Ensure you have the Developer ID Application cert loaded into your keychain. This is the NGA's Developer ID Application cert. Get it from a team member because you need the associated private key with it. In the keychain they will find the cert and notice that it has the private key listed below it. They'll need to export both as a p12 for you to import.
- Submit .dmg and .pkg for notarization
xcrun notarytool submit MapCache.1.6.0.dmg --keychain-profile "[you're stored credentials name]" --wait
- Check status of notarization (using requestUUID in previous command's response)
xcrun notarytool info [requestUUID] -u [apple developer id]
Prior to release, any modifications that need to be made to the vuex store to support new features/bug fixes should perform the following steps.
- Add migration script to store > migration > migration.js
- Increment store version in package.json > mapacache > store > version
- Migration script can be tested by installing a previous version of the application, then install the version with your migration scrip and verify the app runs as expected.
It is worth noting that there are several libraries using native dependencies. The native depdencies are
- better-sqlite3
Any changes made in development should be tested in the production version of the application for all supported platforms.
If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license.
Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license.
- Update package.json version
- Add a changelog file for the version describing new features added and bugs fixed
- Enable Matomo in env
- Commit changes
- Tag version
- Build windows, linux and mac installers
- Notarize mac installers
- Create release on github for the new version and upload all the installer files
- You'll need to generate builds for all different environments in order to have the correct matomo urls