1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
From 68c2080117f4495edc431ca34d38d16484f03236 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Thu, 21 Jun 2018 05:00:37 -0400
Subject: [PATCH] Don't use electron to build
[intelfx: now we need Electron version nevertheless for webpack, so
accept it as a command-line argument]
---
shared/desktop/package.desktop.tsx | 26 ++++++------------------
shared/desktop/webpack.config.babel.d.ts | 2 +-
shared/desktop/webpack.config.babel.js | 7 +++----
shared/desktop/yarn-helper/index.tsx | 2 --
4 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/shared/desktop/package.desktop.tsx b/shared/desktop/package.desktop.tsx
index 6941dda58b..747d4ddbad 100644
--- a/shared/desktop/package.desktop.tsx
+++ b/shared/desktop/package.desktop.tsx
@@ -6,7 +6,6 @@ import path from 'path'
import webpack from 'webpack'
import rootConfig from './webpack.config.babel'
import {readdir} from 'node:fs/promises'
-import {electronChecksums} from './electron-sums'
const TEMP_SKIP_BUILD: boolean = false
@@ -48,6 +47,7 @@ const getArgs = () => {
const args = process.argv.slice(2)
const ret = {
appVersion: '',
+ electronVersion: '',
arch: '',
comment: '',
icon: '',
@@ -82,14 +82,13 @@ const shouldUseAsar = false
const arch = argv.arch || os.arch()
const platform = argv.platform || os.platform()
const appVersion = argv.appVersion || '0.0.0'
+const electronVersion = argv.electronVersion || undefined
const comment = argv.comment
const outDir = argv.outDir
const saltpackIcon = argv.saltpackIcon
const appCopyright = 'Copyright (c) 2024, Keybase'
const companyName = 'Keybase, Inc.'
-const electronVersion = (require('../package.json') as {devDependencies: {electron: string}}).devDependencies
- .electron
-console.log('Found electron version:', electronVersion)
+console.log('Using electron version:', electronVersion)
const packagerOpts: Options = {
appBundleId: 'keybase.Electron',
@@ -99,8 +98,8 @@ const packagerOpts: Options = {
buildVersion: String(appVersion) + String(comment),
darwinDarkModeSupport: true,
dir: desktopPath('./build'),
- download: {checksums: electronChecksums},
- electronVersion,
+ download: {checksums: undefined},
+ electronVersion: undefined,
// macOS file association to saltpack files
extendInfo: {
CFBundleDocumentTypes: [
@@ -185,7 +184,7 @@ async function main() {
async function startPack() {
console.log('Starting webpack build\nInjecting __VERSION__: ', appVersion)
process.env['APP_VERSION'] = appVersion
- const webpackConfig = rootConfig(null, {mode: 'production'})
+ const webpackConfig = rootConfig(null, {mode: 'production', targets: {electron: electronVersion}})
try {
if (TEMP_SKIP_BUILD) {
} else {
@@ -210,19 +209,6 @@ async function startPack() {
fs.removeSync(desktopPath('build/desktop/dist/fonts'))
rimrafSync(desktopPath('release'))
-
- const aps = [[platform, arch]]
- await Promise.all(
- aps.map(async ([plat, arch]) => {
- try {
- const appPaths = await pack(plat!, arch!)
- postPack(appPaths, plat!, arch!)
- } catch (err) {
- console.error(err)
- process.exit(1)
- }
- })
- )
} catch (err) {
console.error(err)
process.exit(1)
diff --git a/shared/desktop/webpack.config.babel.d.ts b/shared/desktop/webpack.config.babel.d.ts
index 2a31c8e755..32f56218e8 100644
--- a/shared/desktop/webpack.config.babel.d.ts
+++ b/shared/desktop/webpack.config.babel.d.ts
@@ -1,2 +1,2 @@
-declare let ignore: (n: null, o: {mode: 'production' | 'development'}) => {[key: string]: unknown}
+declare let ignore: (n: null, o: {mode: 'production' | 'development', targets: unknown}) => {[key: string]: unknown}
export default ignore
diff --git a/shared/desktop/webpack.config.babel.js b/shared/desktop/webpack.config.babel.js
index 790177201b..c1c6c6947d 100644
--- a/shared/desktop/webpack.config.babel.js
+++ b/shared/desktop/webpack.config.babel.js
@@ -11,7 +11,6 @@ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'
import CircularDependencyPlugin from 'circular-dependency-plugin'
const enableWDYR = require('../util/why-did-you-render-enabled')
-const elecVersion = require('../package.json').devDependencies.electron
// true if you want to debug unused code. This makes single chunks so you can grep for 'unused harmony' in the output in desktop/dist
const debugUnusedChunks = false
const enableCircularDepCheck = false
@@ -29,7 +28,7 @@ if (enableWDYR || debugUnusedChunks || enableCircularDepCheck || evalDevtools) {
}
// When we start the hot server we want to build the main/dll without hot reloading statically
-const config = (_, {mode}) => {
+const config = (_, {mode, targets}) => {
const isDev = mode !== 'production'
const isHot = isDev && !!process.env['HOT']
const isProfile = !isDev && !!process.env['PROFILE']
@@ -42,7 +41,7 @@ const config = (_, {mode}) => {
const fileSuffix = isDev ? '.dev' : isProfile ? '.profile' : ''
console.error('Flags: ', {isDev, isHot, isProfile})
- console.error('Detected electron from package.json: ', elecVersion)
+ console.error('Targets: ', targets)
const makeRules = nodeThread => {
const babelRule = {
@@ -56,7 +55,7 @@ const config = (_, {mode}) => {
...(isHot && !nodeThread ? ['react-refresh/babel'] : []),
],
presets: [
- ['@babel/preset-env', {debug: false, modules: false, targets: {electron: elecVersion}}],
+ ['@babel/preset-env', {debug: false, modules: false, targets}],
[
'@babel/preset-react',
{
diff --git a/shared/desktop/yarn-helper/index.tsx b/shared/desktop/yarn-helper/index.tsx
index 22785d30d4..9c9e602c61 100644
--- a/shared/desktop/yarn-helper/index.tsx
+++ b/shared/desktop/yarn-helper/index.tsx
@@ -1,6 +1,5 @@
// Helper for cross platform yarn run script commands
import buildCommands from './build'
-import electronComands from './electron'
import fontCommands from './font'
import prettierCommands from './prettier'
import {execSync} from 'child_process'
@@ -22,7 +21,6 @@ type Command = {
const commands: {[key: string]: Command} = {
...buildCommands,
...fontCommands,
- ...electronComands,
...prettierCommands,
help: {
code: () => {
--
2.46.0.5.ga2c7344ef8
|