Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade electron to v22 #720

Merged
merged 28 commits into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9076ec2
chore: upgraded electron and node
ErikSin Jan 30, 2023
aa774f2
bring back map server using latest
achou11 Feb 1, 2023
3184ed1
replace electron.remote with @electron/remote
achou11 Feb 1, 2023
6ec4819
fix usage of electron-is-dev module
achou11 Feb 1, 2023
ba81279
add patch for ecstatic
achou11 Feb 1, 2023
5ce26c8
remove duplicate code in app.js
achou11 Feb 2, 2023
5248e38
fix import of electron remote in renderer
achou11 Feb 2, 2023
3d06334
remove electron remote from externals
achou11 Feb 2, 2023
b1c0c25
fix issue with creating map server db before directory exists
achou11 Feb 2, 2023
5cc4c5b
fix mapServer scoping error when quitting app
achou11 Feb 2, 2023
364241b
upgrade react-intl to remove usage of broken peer dep
achou11 Feb 8, 2023
d92a821
remove unused livereload functionality
achou11 Feb 8, 2023
536c002
remove commented-out webpack plugin
achou11 Feb 8, 2023
c548a1a
update comment in new api file
achou11 Feb 8, 2023
9ea06e0
adjustments for window.mode in background windows
achou11 Feb 8, 2023
d78ae70
upgrade electron to 22.2.0
achou11 Feb 8, 2023
4278c40
ci changes
achou11 Feb 8, 2023
1d62322
Merge branch 'master' into es/chore-electron-upgrade
achou11 Feb 8, 2023
39fabc8
maybe fix electron build issue with fsevents
achou11 Feb 8, 2023
d230364
maybe fix rimraf issue on windows ci
achou11 Feb 8, 2023
666ba8f
partially undo previous
achou11 Feb 8, 2023
9e9e37d
try node script for ci artifact removal
achou11 Feb 9, 2023
461bf68
upgrade map server to latest
achou11 Feb 9, 2023
3f98e7d
upgrade electron to latest 22
achou11 Feb 9, 2023
41f5a65
update babel config
achou11 Feb 14, 2023
c730f47
Merge branch 'master' into es/chore-electron-upgrade
achou11 Feb 28, 2023
709fa4d
update electron to latest v22
achou11 Feb 28, 2023
fa7bd87
upgrade electron to v22.3.2
achou11 Mar 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Expand Up @@ -9,7 +9,7 @@
'@babel/preset-env',
{
targets: {
electron: '9.0.0'
electron: '22.3.2'
},
// Only use polyfills necessary for target env
useBuiltIns: 'usage',
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Expand Up @@ -29,10 +29,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Use Node.js 14
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 14.18.X
node-version: 16.17.X
- name: npm ci no scripts
uses: nick-invision/retry@v2
with:
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
MAPEO_VARIANT: ${{ matrix.variant }}
- name: Cleanup artifacts
run: |
npx rimraf@2 'dist/${{ matrix.variant }}/!(*.exe|*.deb|*.AppImage|*.dmg|*.yml|*.zip|github)'
npm run remove-ci-artifacts -- ${{ matrix.variant }}
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v1
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v12.14.1
v16.17.1
4 changes: 2 additions & 2 deletions bin/extract-presets.js
@@ -1,7 +1,7 @@
const path = require('path')
const mkdirp = require('mkdirp')
const fs = require('fs-extra')
const { DEFAULT_CONFIG_DIR } = require('../config')
const { getDefaultConfigDir } = 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`
Expand All @@ -11,7 +11,7 @@ const { DEFAULT_CONFIG_DIR } = require('../config')
// API for mapeo-server

// Sorry about confusing naming, working around hard-coded paths in @mapeo/settings
const defaultConfigFolder = path.join(DEFAULT_CONFIG_DIR, 'default')
const defaultConfigFolder = path.join(getDefaultConfigDir(true), 'default')
mkdirp(defaultConfigFolder)
fs.copySync(
path.dirname(require.resolve('mapeo-default-settings')),
Expand Down
26 changes: 26 additions & 0 deletions bin/remove-ci-artifacts.js
@@ -0,0 +1,26 @@
#!/usr/bin/env node

// This script removes unnecessary artifacts that we don't want to keep around after electron builder runs on CI

const rimraf = require('rimraf')

const variant = process.argv[2]

if (!variant) {
console.error(new Error('Must specify variant'))
process.exit(1)
}

const files = `dist/${variant}/!(*.exe|*.deb|*.AppImage|*.dmg|*.yml|*.zip|github)`

console.log(`Attempting to remove: ${files}`)

rimraf(files, err => {
if (err) {
console.error(err)
process.exit(1)
} else {
console.log('Success!')
process.exit(0)
}
})
28 changes: 14 additions & 14 deletions config.js
Expand Up @@ -3,28 +3,28 @@ var APP_NAME = 'Mapeo'
var APP_TEAM = 'Digital Democracy'
var APP_VERSION = require('./src/build-config').version

var isElectron = typeof process.type === 'string'
// Is `true` when running from Node
var isDev = isElectron ? require('electron-is-dev') : true
function getResourcesDir (isDev) {
// If running from Node, process.type is not defined
const isElectron = typeof process.type === 'string'
if (!isElectron || isDev) return path.join(__dirname, 'temp-resources')
return process.resourcesPath
}

// 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
function getDefaultConfigDir (isDev) {
// This is super confusing... due to hard-coded paths in @mapeo/settings
// TODO: Clean all of this up in mapeo-server and @mapeo/settings
return path.join(getResourcesDir(isDev), 'presets')
}

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'
'https://raw.githubusercontent.com/digidem/mapeo-desktop/master',
getResourcesDir,
getDefaultConfigDir
Comment on lines +28 to +29
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced the statically defined constants with these functions because this file is run in various contexts that are sensitive to the environment e.g. main process, background renderer, primary window renderer

}
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -45,7 +45,8 @@ debug({ showDevTools: false })
if (!logger.configured) {
logger.configure({
label: 'main',
userDataPath
userDataPath,
isDev
})
}

Expand Down