-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix Mapeo window randomly not opening at startup (#465)
* chore: Add incremental Typescript checking Add // @ts-check to the top of files in src/background and src/main to check JS files with JSDoc hints * Refactor app startup code & background processes * Manage background processes together, and time async startup actions * Read backend state in main window * Startup sequence in parallel * remove console.log * Fix startup sequence * Fix background state updates (emit after state is updated) * Update to latest electron@9 * Fix ipc message validation * Fix settings extraction * Wait for first render before showing main window * Improve logging * fixes for breaking mkdirp change * add note about React devtools * fix lint error * chore(tsconfig): fix typo * fix packaging config * fix: Fix errors from Wifi Status display and disable on MacOS Fixes #469 * fix: Package default config with app, rather than extracting at runtime * fix: Fix IPC messaging with main process - call port.start() * fix: Fix "zoom to data": include deletions and correct density calc * fix: Fix crash when syncing by removing non-transferable objects from IPC * Add message error handlers to IPC * fix: Fix reload of Mapeo when config changes * chore: update ecstatic & dedupe * Fix package-lock * Catch errors on startup * Extend background process start timeout * throw error if starting background process fails * Pass through error events from background processes * Cleanup subscriptions * Clear closing timeout Co-authored-by: Kira Oakley <kira@eight45.net>
- Loading branch information
1 parent
d9df37b
commit 5467c19
Showing
36 changed files
with
6,575 additions
and
7,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ translations | |
storybook-static | ||
updates | ||
flow-typed | ||
/**/*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ bin/test-data | |
translations | ||
storybook-static | ||
updates | ||
temp-resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const path = require('path') | ||
const mkdirp = require('mkdirp') | ||
const fs = require('fs-extra') | ||
const { DEFAULT_CONFIG_DIR } = require('../config') | ||
|
||
// This is a really hacky fix to an annoying problem. Currently mapeo-server has | ||
// a fallbackPresetsDir option, but it expects the presets to be in a `default` | ||
// subfolder inside that. In production we copy mapeo-default-settings into the | ||
// app resources folder, with a `default` subfolder, but in dev we need to copy | ||
// the default presets into a subfolder so we can use them in dev. TODO: Fix the | ||
// API for mapeo-server | ||
|
||
// Sorry about confusing naming, working around hard-coded paths in @mapeo/settings | ||
const defaultConfigFolder = path.join(DEFAULT_CONFIG_DIR, 'default') | ||
mkdirp(defaultConfigFolder) | ||
fs.copySync( | ||
path.dirname(require.resolve('mapeo-default-settings')), | ||
defaultConfigFolder | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
var path = require('path') | ||
var APP_NAME = 'Mapeo' | ||
var APP_TEAM = 'Digital Democracy' | ||
var APP_VERSION = require('./package.json').version | ||
|
||
module.exports = { | ||
APP_NAME: APP_NAME, | ||
APP_TEAM: APP_TEAM, | ||
APP_VERSION: APP_VERSION, | ||
var isElectron = typeof process.type === 'string' | ||
// Is `true` when running from Node | ||
var isDev = isElectron ? require('electron-is-dev') : true | ||
|
||
MAPBOX_ACCESS_TOKEN: 'pk.eyJ1IjoiZ21hY2xlbm5hbiIsImEiOiJSaWVtd2lRIn0.ASYMZE2HhwkAw4Vt7SavEg', | ||
// Sorry about this! In production the default config is shipped in the app | ||
// resources folder, but for development we need to copy them into a temporary | ||
// "resources" folder. | ||
var RESOURCES_DIR = isDev | ||
? path.join(__dirname, 'temp-resources') | ||
: process.resourcesPath | ||
|
||
module.exports = { | ||
APP_NAME, | ||
APP_TEAM, | ||
APP_VERSION, | ||
RESOURCES_DIR, | ||
// This is super confusing... due to hard-coded paths in @mapeo/settings | ||
// TODO: Clean all of this up in mapeo-server and @mapeo/settings | ||
DEFAULT_CONFIG_DIR: path.join(RESOURCES_DIR, 'presets'), | ||
MAPBOX_ACCESS_TOKEN: | ||
'pk.eyJ1IjoiZ21hY2xlbm5hbiIsImEiOiJSaWVtd2lRIn0.ASYMZE2HhwkAw4Vt7SavEg', | ||
GITHUB_URL: 'https://github.com/digidem/mapeo-desktop', | ||
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/digidem/mapeo-desktop/master' | ||
GITHUB_URL_RAW: | ||
'https://raw.githubusercontent.com/digidem/mapeo-desktop/master' | ||
} |
Oops, something went wrong.