mirror of
https://github.com/balena-io/etcher.git
synced 2025-11-09 18:38:32 +00:00
Compare commits
31 Commits
v1.12.5
...
aethernet/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec7e0b745e | ||
|
|
d5ba1ea5e1 | ||
|
|
54d3636a22 | ||
|
|
45f6ee667d | ||
|
|
d25eda9a7d | ||
|
|
7420283249 | ||
|
|
453952440f | ||
|
|
2475d576c7 | ||
|
|
8cd6da1260 | ||
|
|
82dd4fc1d1 | ||
|
|
33fe4b2c1a | ||
|
|
b1c1188107 | ||
|
|
63b45aefae | ||
|
|
f79cb0fac5 | ||
|
|
ec42892c7c | ||
|
|
371716fe6a | ||
|
|
d5fb6bec15 | ||
|
|
c5e7bf26d7 | ||
|
|
e3072ac416 | ||
|
|
dfaf06e4cf | ||
|
|
6e24d25576 | ||
|
|
b59b171e43 | ||
|
|
28726584c2 | ||
|
|
00b151311a | ||
|
|
36c813714b | ||
|
|
2ae6764dd9 | ||
|
|
debefc9652 | ||
|
|
b068b847c7 | ||
|
|
6c410c07ce | ||
|
|
c01206c1f3 | ||
|
|
2e85fb45de |
15
.github/actions/publish/action.yml
vendored
15
.github/actions/publish/action.yml
vendored
@@ -72,10 +72,7 @@ runs:
|
|||||||
chmod +x "$(dirname "$(which node)")/resinci-deploy" && which resinci-deploy
|
chmod +x "$(dirname "$(which node)")/resinci-deploy" && which resinci-deploy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# FIXME: store sentry workflow is not documented
|
# Upload sourcemaps to sentry
|
||||||
# https://github.com/product-os/resinci-deploy/blob/master/lib/sentry.ts
|
|
||||||
# https://github.com/getsentry/sentry-cli
|
|
||||||
# https://docs.sentry.io/api/projects/create-a-new-client-key/
|
|
||||||
- name: Generate Sentry DSN
|
- name: Generate Sentry DSN
|
||||||
id: sentry
|
id: sentry
|
||||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||||
@@ -206,6 +203,16 @@ runs:
|
|||||||
-name "latest*.yml" \
|
-name "latest*.yml" \
|
||||||
-exec yq -i e .stagingPercentage=\"$percentage\" {} \;
|
-exec yq -i e .stagingPercentage=\"$percentage\" {} \;
|
||||||
|
|
||||||
|
- name: Upload sourcemap to Sentry
|
||||||
|
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||||
|
run: |
|
||||||
|
VERSION=${{ steps.package_release.outputs.version }} npm run uploadSourcemap
|
||||||
|
env:
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ fromJSON(inputs.secrets).SENTRY_AUTH_TOKEN }}
|
||||||
|
npm_config_SENTRY_ORG: balenaEtcher
|
||||||
|
npm_config_SENTRY_PROJECT: balenaetcher
|
||||||
|
npm_config_SENTRY_VERSION: ${{ steps.package_release.outputs.version }}
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/winget.yml
vendored
2
.github/workflows/winget.yml
vendored
@@ -9,5 +9,5 @@ jobs:
|
|||||||
- uses: vedantmgoyal2009/winget-releaser@v1
|
- uses: vedantmgoyal2009/winget-releaser@v1
|
||||||
with:
|
with:
|
||||||
identifier: Balena.Etcher
|
identifier: Balena.Etcher
|
||||||
installer-regex: 'balenaEtcher-Setup.*.exe$'
|
installers-regex: 'balenaEtcher-Setup.*.exe$'
|
||||||
token: ${{ secrets.WINGET_PAT }}
|
token: ${{ secrets.WINGET_PAT }}
|
||||||
|
|||||||
@@ -1,3 +1,105 @@
|
|||||||
|
- commits:
|
||||||
|
- subject: Adding EtcherPro device serial number to the Settings modal
|
||||||
|
hash: d25eda9a7d6bf89284b630b2d55cbb0a7e3a9432
|
||||||
|
body: ""
|
||||||
|
footer:
|
||||||
|
Change-type: patch
|
||||||
|
change-type: patch
|
||||||
|
author: Aurelien VALADE
|
||||||
|
nested: []
|
||||||
|
version: 1.13.4
|
||||||
|
title: ""
|
||||||
|
date: 2023-01-12T15:10:50.328Z
|
||||||
|
- commits:
|
||||||
|
- subject: "patch: progress cm4 to second stage"
|
||||||
|
hash: 2475d576c7d9ecb46507c47c4143bdbfbdb44e45
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: Peter Makra
|
||||||
|
nested: []
|
||||||
|
version: 1.13.3
|
||||||
|
title: ""
|
||||||
|
date: 2023-01-11T14:30:45.116Z
|
||||||
|
- commits:
|
||||||
|
- subject: "patch: fixed winget parameter name"
|
||||||
|
hash: 33fe4b2c1abcb7f71f42a4b682f174422cb72a00
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: mcraa
|
||||||
|
nested: []
|
||||||
|
version: 1.13.2
|
||||||
|
title: ""
|
||||||
|
date: 2023-01-02T20:55:58.179Z
|
||||||
|
- commits:
|
||||||
|
- subject: "patch: updated sdk to fix bz2 issue"
|
||||||
|
hash: f79cb0fac56f6ec86f3a6f9be7035fbf59102253
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: Peter Makra
|
||||||
|
nested: []
|
||||||
|
- subject: "patch: update copyright in electron-builder"
|
||||||
|
hash: ec42892c7cf1d22f4bb2968733ba9dc85e3552c6
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: JOASSART Edwin
|
||||||
|
nested: []
|
||||||
|
version: 1.13.1
|
||||||
|
title: ""
|
||||||
|
date: 2023-01-02T17:26:55.602Z
|
||||||
|
- commits:
|
||||||
|
- subject: "minor: electron version bump"
|
||||||
|
hash: e3072ac416470cd161309935c2622cc5a3d8d242
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: Peter Makra
|
||||||
|
nested: []
|
||||||
|
- subject: "patch: handle ext2fs with webpack"
|
||||||
|
hash: b59b171e43a170c0ccf84d36ab4ba2db403e25c5
|
||||||
|
body: ""
|
||||||
|
footer: {}
|
||||||
|
author: Peter Makra
|
||||||
|
nested: []
|
||||||
|
- subject: "Patch: update etcher-sdk version to fix CM4 issues"
|
||||||
|
hash: 36c813714b3ce60e5e85f1889c9bc7eeadb524b4
|
||||||
|
body: ""
|
||||||
|
footer:
|
||||||
|
Change-type: patch
|
||||||
|
change-type: patch
|
||||||
|
author: builder555
|
||||||
|
nested: []
|
||||||
|
version: 1.13.0
|
||||||
|
title: ""
|
||||||
|
date: 2022-12-28T16:48:12.506Z
|
||||||
|
- commits:
|
||||||
|
- subject: Update dependency i18next to 21.10.0
|
||||||
|
hash: b068b847c7ae6456ebd16a5d641ff61d8d074015
|
||||||
|
body: |
|
||||||
|
Update i18next to 21.10.0
|
||||||
|
|
||||||
|
Update i18next from 21.8.14 to 21.10.0
|
||||||
|
footer:
|
||||||
|
Change-type: patch
|
||||||
|
change-type: patch
|
||||||
|
author: Renovate Bot
|
||||||
|
nested: []
|
||||||
|
version: 1.12.7
|
||||||
|
title: ""
|
||||||
|
date: 2022-12-20T19:35:11.219Z
|
||||||
|
- commits:
|
||||||
|
- subject: Update dependency react-i18next to 11.18.6
|
||||||
|
hash: 2e85fb45de3a52e9bf0605e474a550e1af2bb980
|
||||||
|
body: |
|
||||||
|
Update react-i18next to 11.18.6
|
||||||
|
|
||||||
|
Update react-i18next from 11.18.1 to 11.18.6
|
||||||
|
footer:
|
||||||
|
Change-type: patch
|
||||||
|
change-type: patch
|
||||||
|
author: Renovate Bot
|
||||||
|
nested: []
|
||||||
|
version: 1.12.6
|
||||||
|
title: ""
|
||||||
|
date: 2022-12-20T18:00:03.165Z
|
||||||
- commits:
|
- commits:
|
||||||
- subject: "Patch: made trim setting more readable"
|
- subject: "Patch: made trim setting more readable"
|
||||||
hash: 5c5a7612220b011e6942ac10b7026b7d6513e54f
|
hash: 5c5a7612220b011e6942ac10b7026b7d6513e54f
|
||||||
|
|||||||
38
CHANGELOG.md
38
CHANGELOG.md
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
# v1.13.4
|
||||||
|
## (2023-01-12)
|
||||||
|
|
||||||
|
* Adding EtcherPro device serial number to the Settings modal [Aurelien VALADE]
|
||||||
|
|
||||||
|
# v1.13.3
|
||||||
|
## (2023-01-11)
|
||||||
|
|
||||||
|
* patch: progress cm4 to second stage [Peter Makra]
|
||||||
|
|
||||||
|
# v1.13.2
|
||||||
|
## (2023-01-02)
|
||||||
|
|
||||||
|
* patch: fixed winget parameter name [mcraa]
|
||||||
|
|
||||||
|
# v1.13.1
|
||||||
|
## (2023-01-02)
|
||||||
|
|
||||||
|
* patch: updated sdk to fix bz2 issue [Peter Makra]
|
||||||
|
* patch: update copyright in electron-builder [JOASSART Edwin]
|
||||||
|
|
||||||
|
# v1.13.0
|
||||||
|
## (2022-12-28)
|
||||||
|
|
||||||
|
* minor: electron version bump [Peter Makra]
|
||||||
|
* patch: handle ext2fs with webpack [Peter Makra]
|
||||||
|
* Patch: update etcher-sdk version to fix CM4 issues [builder555]
|
||||||
|
|
||||||
|
# v1.12.7
|
||||||
|
## (2022-12-20)
|
||||||
|
|
||||||
|
* Update dependency i18next to 21.10.0 [Renovate Bot]
|
||||||
|
|
||||||
|
# v1.12.6
|
||||||
|
## (2022-12-20)
|
||||||
|
|
||||||
|
* Update dependency react-i18next to 11.18.6 [Renovate Bot]
|
||||||
|
|
||||||
# v1.12.5
|
# v1.12.5
|
||||||
## (2022-12-20)
|
## (2022-12-20)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# https://www.electron.build/configuration/configuration
|
# https://www.electron.build/configuration/configuration
|
||||||
appId: io.balena.etcher
|
appId: io.balena.etcher
|
||||||
copyright: Copyright 2016-2021 Balena Ltd
|
copyright: Copyright 2016-2023 Balena Ltd
|
||||||
productName: balenaEtcher
|
productName: balenaEtcher
|
||||||
afterPack: ./afterPack.js
|
afterPack: ./afterPack.js
|
||||||
afterSign: ./afterSignHook.js
|
afterSign: ./afterSignHook.js
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import * as analytics from '../../modules/analytics';
|
|||||||
import { open as openExternal } from '../../os/open-external/services/open-external';
|
import { open as openExternal } from '../../os/open-external/services/open-external';
|
||||||
import { Modal } from '../../styled-components';
|
import { Modal } from '../../styled-components';
|
||||||
import * as i18next from 'i18next';
|
import * as i18next from 'i18next';
|
||||||
|
import { etcherProInfo } from '../../utils/etcher-pro-specific';
|
||||||
|
|
||||||
interface Setting {
|
interface Setting {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -55,7 +56,7 @@ interface SettingsModalProps {
|
|||||||
toggleModal: (value: boolean) => void;
|
toggleModal: (value: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UUID = process.env.BALENA_DEVICE_UUID;
|
const EPInfo = etcherProInfo();
|
||||||
|
|
||||||
const InfoBox = (props: any) => (
|
const InfoBox = (props: any) => (
|
||||||
<Box fontSize={14}>
|
<Box fontSize={14}>
|
||||||
@@ -117,10 +118,14 @@ export function SettingsModal({ toggleModal }: SettingsModalProps) {
|
|||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{UUID !== undefined && (
|
{EPInfo !== undefined && (
|
||||||
<Flex flexDirection="column">
|
<Flex flexDirection="column">
|
||||||
<Txt fontSize={24}>{i18next.t('settings.systemInformation')}</Txt>
|
<Txt fontSize={24}>{i18next.t('settings.systemInformation')}</Txt>
|
||||||
<InfoBox label="UUID" value={UUID.substr(0, 7)} />
|
{EPInfo.get_serial() === undefined ? (
|
||||||
|
<InfoBox label="UUID" value={EPInfo.uuid} />
|
||||||
|
) : (
|
||||||
|
<InfoBox label="Serial" value={EPInfo.get_serial()} />
|
||||||
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
<Flex
|
<Flex
|
||||||
|
|||||||
73
lib/gui/app/utils/etcher-pro-specific.ts
Normal file
73
lib/gui/app/utils/etcher-pro-specific.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 balena.io
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Dictionary } from 'lodash';
|
||||||
|
|
||||||
|
type BalenaTag = {
|
||||||
|
id: number,
|
||||||
|
name: string,
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export class EtcherPro {
|
||||||
|
private supervisorAddr: string;
|
||||||
|
private supervisorKey: string;
|
||||||
|
private tags: Dictionary<string> | undefined;
|
||||||
|
public uuid: string;
|
||||||
|
|
||||||
|
constructor(supervisorAddr: string, supervisorKey: string) {
|
||||||
|
this.supervisorAddr = supervisorAddr;
|
||||||
|
this.supervisorKey = supervisorKey;
|
||||||
|
this.uuid = (process.env.BALENA_DEVICE_UUID ?? 'NO-UUID').substring(0, 7);
|
||||||
|
this.tags = undefined;
|
||||||
|
this.get_tags().then((tags) => (this.tags = tags));
|
||||||
|
}
|
||||||
|
|
||||||
|
async get_tags(): Promise<Dictionary<string>> {
|
||||||
|
const result = await fetch(
|
||||||
|
this.supervisorAddr + '/v2/device/tags?apikey=' + this.supervisorKey,
|
||||||
|
);
|
||||||
|
const parsed = await result.json();
|
||||||
|
if (parsed['status'] === 'success') {
|
||||||
|
return Object.assign(
|
||||||
|
{},
|
||||||
|
...parsed['tags'].map((tag: BalenaTag) => {
|
||||||
|
return { [tag.name]: tag.value };
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public get_serial(): string | undefined {
|
||||||
|
if (this.tags) {
|
||||||
|
return this.tags['Serial'];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function etcherProInfo(): EtcherPro | undefined {
|
||||||
|
const BALENA_SUPERVISOR_ADDRESS = process.env.BALENA_SUPERVISOR_ADDRESS;
|
||||||
|
const BALENA_SUPERVISOR_API_KEY = process.env.BALENA_SUPERVISOR_API_KEY;
|
||||||
|
|
||||||
|
if (BALENA_SUPERVISOR_ADDRESS && BALENA_SUPERVISOR_API_KEY) {
|
||||||
|
return new EtcherPro(BALENA_SUPERVISOR_ADDRESS, BALENA_SUPERVISOR_API_KEY);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
1373
package-lock.json
generated
1373
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -2,7 +2,7 @@
|
|||||||
"name": "balena-etcher",
|
"name": "balena-etcher",
|
||||||
"private": true,
|
"private": true,
|
||||||
"displayName": "balenaEtcher",
|
"displayName": "balenaEtcher",
|
||||||
"version": "1.12.5",
|
"version": "1.13.4",
|
||||||
"packageType": "local",
|
"packageType": "local",
|
||||||
"main": "generated/etcher.js",
|
"main": "generated/etcher.js",
|
||||||
"description": "Flash OS images to SD cards and USB drives, safely and easily.",
|
"description": "Flash OS images to SD cards and USB drives, safely and easily.",
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"test-spectron": "mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts tests/spectron/runner.spec.ts",
|
"test-spectron": "mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts tests/spectron/runner.spec.ts",
|
||||||
"test-windows": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
|
"test-windows": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
|
||||||
"test": "echo npm run test-{linux,windows,macos}",
|
"test": "echo npm run test-{linux,windows,macos}",
|
||||||
|
"uploadSourcemap": "sentry-cli releases files $npm_config_SENTRY_VERSION upload-sourcemaps ./generated/*.js.map --org $npm_config_SENTRY_ORG --project $npm_config_SENTRY_PROJECT",
|
||||||
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
|
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
|
||||||
"webpack": "webpack"
|
"webpack": "webpack"
|
||||||
},
|
},
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
"@balena/lint": "5.4.2",
|
"@balena/lint": "5.4.2",
|
||||||
"@balena/sudo-prompt": "9.2.1-workaround-windows-amperstand-in-username-0849e215b947987a643fe5763902aea201255534",
|
"@balena/sudo-prompt": "9.2.1-workaround-windows-amperstand-in-username-0849e215b947987a643fe5763902aea201255534",
|
||||||
"@fortawesome/fontawesome-free": "5.15.4",
|
"@fortawesome/fontawesome-free": "5.15.4",
|
||||||
|
"@sentry/cli": "^2.11.0",
|
||||||
"@svgr/webpack": "5.5.0",
|
"@svgr/webpack": "5.5.0",
|
||||||
"@types/chai": "4.3.4",
|
"@types/chai": "4.3.4",
|
||||||
"@types/copy-webpack-plugin": "6.4.3",
|
"@types/copy-webpack-plugin": "6.4.3",
|
||||||
@@ -74,17 +76,17 @@
|
|||||||
"css-loader": "5.2.7",
|
"css-loader": "5.2.7",
|
||||||
"d3": "4.13.0",
|
"d3": "4.13.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"electron": "12.2.3",
|
"electron": "^13.5.0",
|
||||||
"electron-builder": "22.14.13",
|
"electron-builder": "^23.0.9",
|
||||||
"electron-mocha": "9.3.3",
|
"electron-mocha": "9.3.3",
|
||||||
"electron-notarize": "1.2.2",
|
"electron-notarize": "1.2.2",
|
||||||
"electron-rebuild": "3.2.9",
|
"electron-rebuild": "3.2.9",
|
||||||
"electron-updater": "4.6.5",
|
"electron-updater": "5.3.0",
|
||||||
"esbuild-loader": "2.20.0",
|
"esbuild-loader": "2.20.0",
|
||||||
"etcher-sdk": "7.4.0",
|
"etcher-sdk": "^7.4.7",
|
||||||
"file-loader": "6.2.0",
|
"file-loader": "6.2.0",
|
||||||
"husky": "4.3.8",
|
"husky": "4.3.8",
|
||||||
"i18next": "21.8.14",
|
"i18next": "21.10.0",
|
||||||
"immutable": "3.8.2",
|
"immutable": "3.8.2",
|
||||||
"lint-staged": "10.5.4",
|
"lint-staged": "10.5.4",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
@@ -99,14 +101,14 @@
|
|||||||
"pretty-bytes": "5.6.0",
|
"pretty-bytes": "5.6.0",
|
||||||
"react": "16.8.5",
|
"react": "16.8.5",
|
||||||
"react-dom": "16.8.5",
|
"react-dom": "16.8.5",
|
||||||
"react-i18next": "11.18.1",
|
"react-i18next": "11.18.6",
|
||||||
"redux": "4.2.0",
|
"redux": "4.2.0",
|
||||||
"rendition": "19.3.2",
|
"rendition": "19.3.2",
|
||||||
"resin-corvus": "2.0.5",
|
"resin-corvus": "2.0.5",
|
||||||
"semver": "7.3.8",
|
"semver": "7.3.8",
|
||||||
"simple-progress-webpack-plugin": "1.1.2",
|
"simple-progress-webpack-plugin": "1.1.2",
|
||||||
"sinon": "9.2.4",
|
"sinon": "9.2.4",
|
||||||
"spectron": "14.0.0",
|
"spectron": "15.0.0",
|
||||||
"string-replace-loader": "3.1.0",
|
"string-replace-loader": "3.1.0",
|
||||||
"style-loader": "2.0.0",
|
"style-loader": "2.0.0",
|
||||||
"styled-components": "5.3.6",
|
"styled-components": "5.3.6",
|
||||||
@@ -126,6 +128,6 @@
|
|||||||
"node": ">=14 < 16"
|
"node": ">=14 < 16"
|
||||||
},
|
},
|
||||||
"versionist": {
|
"versionist": {
|
||||||
"publishedAt": "2022-12-20T12:27:34.589Z"
|
"publishedAt": "2023-01-12T15:10:50.986Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as CopyPlugin from 'copy-webpack-plugin';
|
import * as CopyPlugin from 'copy-webpack-plugin';
|
||||||
import { readdirSync } from 'fs';
|
import { readdirSync, existsSync } from 'fs';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import outdent from 'outdent';
|
import outdent from 'outdent';
|
||||||
@@ -77,25 +77,45 @@ function renameNodeModules(resourcePath: string) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findExt2fsFolder(): string {
|
||||||
|
const ext2fs = 'node_modules/ext2fs';
|
||||||
|
const biFsExt2fs = 'node_modules/balena-image-fs/node_modules/ext2fs';
|
||||||
|
|
||||||
|
if (existsSync(ext2fs)) {
|
||||||
|
return ext2fs;
|
||||||
|
} else if (existsSync(biFsExt2fs)) {
|
||||||
|
return biFsExt2fs;
|
||||||
|
} else {
|
||||||
|
throw Error('ext2fs not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeExt2FsRegex(): RegExp {
|
||||||
|
const folder = findExt2fsFolder();
|
||||||
|
const libpath = '/lib/libext2fs\\.js$';
|
||||||
|
|
||||||
|
return new RegExp(folder.concat(libpath));
|
||||||
|
}
|
||||||
|
|
||||||
function findUsbPrebuild(): string[] {
|
function findUsbPrebuild(): string[] {
|
||||||
const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds')
|
const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds');
|
||||||
const prebuildFolders = readdirSync(usbPrebuildsFolder);
|
const prebuildFolders = readdirSync(usbPrebuildsFolder);
|
||||||
let bindingFile: string | undefined = 'node.napi.node';
|
let bindingFile: string | undefined = 'node.napi.node';
|
||||||
const platformFolder = prebuildFolders.find(
|
const platformFolder = prebuildFolders.find(
|
||||||
(f) =>
|
(f) => f.startsWith(os.platform()) && f.indexOf(os.arch()) > -1,
|
||||||
f.startsWith(os.platform()) &&
|
|
||||||
f.indexOf(os.arch()) > -1,
|
|
||||||
);
|
);
|
||||||
if (platformFolder === undefined) {
|
if (platformFolder === undefined) {
|
||||||
throw new Error('Could not find usb prebuild. Should try fallback to node-gyp and use /build/Release instead of /prebuilds');
|
throw new Error(
|
||||||
|
'Could not find usb prebuild. Should try fallback to node-gyp and use /build/Release instead of /prebuilds',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bindingFiles = readdirSync(
|
const bindingFiles = readdirSync(
|
||||||
path.join(usbPrebuildsFolder, platformFolder)
|
path.join(usbPrebuildsFolder, platformFolder),
|
||||||
)
|
);
|
||||||
|
|
||||||
if (!bindingFiles.length) {
|
if (!bindingFiles.length) {
|
||||||
throw new Error('Could not find usb prebuild for platform')
|
throw new Error('Could not find usb prebuild for platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindingFiles.length === 1) {
|
if (bindingFiles.length === 1) {
|
||||||
@@ -107,25 +127,22 @@ function findUsbPrebuild(): string[] {
|
|||||||
if (bindingFiles.length > 1) {
|
if (bindingFiles.length > 1) {
|
||||||
bindingFile = bindingFiles.find((file) => {
|
bindingFile = bindingFiles.find((file) => {
|
||||||
if (bindingFiles.indexOf('arm') > -1) {
|
if (bindingFiles.indexOf('arm') > -1) {
|
||||||
const process = require('process')
|
const process = require('process');
|
||||||
return file.indexOf(process.config.variables.arm_version) > -1
|
return file.indexOf(process.config.variables.arm_version) > -1;
|
||||||
} else {
|
} else {
|
||||||
return file.indexOf('glibc') > -1
|
return file.indexOf('glibc') > -1;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindingFile === undefined) {
|
if (bindingFile === undefined) {
|
||||||
throw new Error('Could not find usb prebuild for platform')
|
throw new Error('Could not find usb prebuild for platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [platformFolder, bindingFile];
|
return [platformFolder, bindingFile];
|
||||||
}
|
}
|
||||||
|
|
||||||
const [
|
const [USB_BINDINGS_FOLDER, USB_BINDINGS_FILE] = findUsbPrebuild();
|
||||||
USB_BINDINGS_FOLDER,
|
|
||||||
USB_BINDINGS_FILE,
|
|
||||||
] = findUsbPrebuild();
|
|
||||||
|
|
||||||
function findLzmaNativeBindingsFolder(): string {
|
function findLzmaNativeBindingsFolder(): string {
|
||||||
const files = readdirSync(
|
const files = readdirSync(
|
||||||
@@ -325,8 +342,8 @@ const commonConfig = {
|
|||||||
// Use the libext2fs.wasm file in the generated folder
|
// Use the libext2fs.wasm file in the generated folder
|
||||||
// The way to find the app directory depends on whether we run in the renderer or in the child-writer
|
// The way to find the app directory depends on whether we run in the renderer or in the child-writer
|
||||||
// We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer
|
// We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer
|
||||||
replace(/node_modules\/ext2fs\/lib\/libext2fs\.js$/, {
|
replace(makeExt2FsRegex(), {
|
||||||
search: 'scriptDirectory=__dirname+"/"',
|
search: 'scriptDirectory = __dirname + "/";',
|
||||||
replace: fetchWasm('ext2fs', 'lib'),
|
replace: fetchWasm('ext2fs', 'lib'),
|
||||||
}),
|
}),
|
||||||
// Same for node-crc-utils
|
// Same for node-crc-utils
|
||||||
@@ -388,7 +405,7 @@ const guiConfigCopyPatterns = [
|
|||||||
to: 'modules/node-raspberrypi-usbboot/blobs',
|
to: 'modules/node-raspberrypi-usbboot/blobs',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: 'node_modules/ext2fs/lib/libext2fs.wasm',
|
from: `${findExt2fsFolder()}/lib/libext2fs.wasm`,
|
||||||
to: 'modules/ext2fs/lib/libext2fs.wasm',
|
to: 'modules/ext2fs/lib/libext2fs.wasm',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -438,6 +455,7 @@ const guiConfig = {
|
|||||||
const mainConfig = {
|
const mainConfig = {
|
||||||
...commonConfig,
|
...commonConfig,
|
||||||
target: 'electron-main',
|
target: 'electron-main',
|
||||||
|
devtool: 'source-map',
|
||||||
node: {
|
node: {
|
||||||
__dirname: false,
|
__dirname: false,
|
||||||
__filename: true,
|
__filename: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user