Skip to content

Commit

Permalink
chore: upgrade electron to v22 (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
achou11 committed Mar 8, 2023
1 parent 18b6ddd commit 79c0f1f
Show file tree
Hide file tree
Showing 29 changed files with 52,529 additions and 932 deletions.
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
}
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

0 comments on commit 79c0f1f

Please sign in to comment.