Compare commits

..

1 Commits

Author SHA1 Message Date
Vipul Gupta (@vipulgupta2048)
82d0bba96a patch: Add etcherPro documentation
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
2022-11-08 03:47:51 +05:30
31 changed files with 1441 additions and 2776 deletions

7
.gitattributes vendored
View File

@@ -1,6 +1,3 @@
# default
* text
# Javascript files must retain LF line-endings (to keep eslint happy)
*.js text eol=lf
*.jsx text eol=lf
@@ -62,7 +59,3 @@ CODEOWNERS text
*.ttf binary diff=hex
xz-without-extension binary diff=hex
wmic-output.txt binary diff=hex
# gitsecret
*.secret binary
.gitsecret/** binary

View File

@@ -1,54 +0,0 @@
---
name: publish GitHub release
# https://github.com/product-os/flowzone/tree/master/.github/actions
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Get release version
if: runner.os == 'Linux'
id: get_release
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
# https://docs.github.com/en/rest/releases
- name: Finalize GitHub release
if: runner.os == 'Linux'
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
previous_tag="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
release_notes="$(git log ${previous_tag}..HEAD --pretty=reference)"
gh release edit '${{ github.event.pull_request.head.ref }}' \
--notes "${release_notes}" \
--title 'v${{ steps.get_release.outputs.version }}' \
--tag 'v${{ steps.get_release.outputs.version }}' \
--prerelease=false \
--draft=false
release_id="$(gh api "/repos/${{ github.repository }}/releases/tags/v${{ steps.get_release.outputs.version }}" \
-H 'Accept: application/vnd.github+json' | jq -r .id)"
gh api --method PATCH "/repos/${{ github.repository }}/releases/${release_id}" \
-H 'Accept: application/vnd.github+json' \
-F make_latest="true"
env:
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}

View File

@@ -1,250 +0,0 @@
---
name: package and publish GitHub (draft) release
# https://github.com/product-os/flowzone/tree/master/.github/actions
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
# --- custom environment
XCODE_APP_LOADER_EMAIL:
type: string
default: "accounts+apple@balena.io"
NODE_VERSION:
type: string
default: "14.x"
VERBOSE:
type: string
default: "true"
runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Download custom source artifact
uses: actions/download-artifact@v3
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}
path: ${{ runner.temp }}
- name: Extract custom source artifact
if: runner.os != 'Windows'
shell: bash --noprofile --norc -eo pipefail -x {0}
working-directory: .
run: tar -xf ${{ runner.temp }}/custom.tgz
- name: Extract custom source artifact
if: runner.os == 'Windows'
shell: powershell
working-directory: .
run: tar -xf ${{ runner.temp }}\custom.tgz
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
- name: Install yq
shell: bash --noprofile --norc -eo pipefail -x {0}
run: choco install yq
if: runner.os == 'Windows'
# FIXME: resinci-deploy is not actively maintained
# https://github.com/product-os/resinci-deploy
- name: Checkout resinci-deploy
uses: actions/checkout@v3
with:
repository: product-os/resinci-deploy
token: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
path: resinci-deploy
- name: Build and install resinci-deploy
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
rm -rf ../resinci-deploy && mv resinci-deploy ..
pushd ../resinci-deploy && npm ci && npm link && popd
if [[ $runner_os =~ linux|macos ]]; then
chmod +x "$(dirname "$(which node)")/resinci-deploy" && which resinci-deploy
fi
# FIXME: store sentry workflow is not documented
# 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
id: sentry
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
branch="$(echo '${{ github.event.pull_request.head.ref }}' | sed 's/[^[:alnum:]]/-/g')"
stdout="$(resinci-deploy store sentry \
--branch="${branch}" \
--name="$(jq -r '.name' package.json)" \
--team="$(yq e '.sentry.team' repo.yml)" \
--org="$(yq e '.sentry.org' repo.yml)" \
--type="$(yq e '.sentry.type' repo.yml)")"
echo "dsn=$(echo "${stdout}" | tail -n 1)" >> $GITHUB_OUTPUT
env:
SENTRY_TOKEN: ${{ fromJSON(inputs.secrets).SENTRY_AUTH_TOKEN }}
# https://www.electron.build/code-signing.html
# https://github.com/Apple-Actions/import-codesign-certs
- name: Import Apple code signing certificate
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
p12-password: ${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
- name: Import Windows code signing certificate
if: runner.os == 'Windows'
shell: powershell
run: |
Set-Content -Path ${{ runner.temp }}/certificate.base64 -Value $env:WINDOWS_CERTIFICATE
certutil -decode ${{ runner.temp }}/certificate.base64 ${{ runner.temp }}/certificate.pfx
Remove-Item -path ${{ runner.temp }} -include certificate.base64
Import-PfxCertificate `
-FilePath ${{ runner.temp }}/certificate.pfx `
-CertStoreLocation Cert:\CurrentUser\My `
-Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
Remove-Item -path ${{ runner.temp }} -include certificate.pfx
env:
WINDOWS_CERTIFICATE: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}
# ... or refactor (e.g.) https://github.com/samuelmeuli/action-electron-builder
# https://github.com/product-os/scripts/tree/master/electron
# https://github.com/product-os/scripts/tree/master/shared
# https://github.com/product-os/balena-concourse/blob/master/pipelines/github-events/template.yml
- name: Package release
id: package_release
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
runner_arch="$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')"
ELECTRON_BUILDER_ARCHITECTURE="${runner_arch}"
APPLICATION_VERSION="$(jq -r '.version' package.json)"
ARCHITECTURE_FLAGS="--${ELECTRON_BUILDER_ARCHITECTURE}"
if [[ $runner_os =~ linux ]]; then
ELECTRON_BUILDER_OS='--linux'
TARGETS="$(yq e .linux.target[] electron-builder.yml)"
elif [[ $runner_os =~ darwin|macos|osx ]]; then
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
CSC_KEYCHAIN=signing_temp
CSC_LINK=${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
ELECTRON_BUILDER_OS='--mac'
TARGETS="$(yq e .mac.target[] electron-builder.yml)"
elif [[ $runner_os =~ windows|win ]]; then
ARCHITECTURE_FLAGS="--ia32 ${ARCHITECTURE_FLAGS}"
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}
CSC_LINK=${{ fromJSON(inputs.secrets).WINDOWS_SIGNING }}
ELECTRON_BUILDER_OS='--win'
TARGETS="$(yq e .win.target[] electron-builder.yml)"
else
exit 1
fi
npm link electron-builder
for target in ${TARGETS}; do
electron-builder ${ELECTRON_BUILDER_OS} ${target} ${ARCHITECTURE_FLAGS} \
--c.extraMetadata.analytics.sentry.token='${{ steps.sentry.outputs.dsn }}' \
--c.extraMetadata.packageType="${target}"
find dist -type f -maxdepth 1
done
echo "version=${APPLICATION_VERSION}" >> $GITHUB_OUTPUT
env:
# Apple notarization (afterSignHook.js)
XCODE_APP_LOADER_EMAIL: ${{ inputs.XCODE_APP_LOADER_EMAIL }}
XCODE_APP_LOADER_PASSWORD: ${{ fromJSON(inputs.secrets).XCODE_APP_LOADER_PASSWORD }}
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks
# https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks
CSC_FOR_PULL_REQUEST: true
# https://www.electron.build/auto-update.html#staged-rollouts
- name: Configure staged rollout(s)
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
percentage="$(cat < repo.yml | yq e .triggerNotification.stagingPercentage)"
find dist -type f -maxdepth 1 \
-name "latest*.yml" \
-exec yq -i e .version=\"${{ steps.package_release.outputs.version }}\" {} \;
find dist -type f -maxdepth 1 \
-name "latest*.yml" \
-exec yq -i e .stagingPercentage=\"$percentage\" {} \;
# https://github.com/softprops/action-gh-release#-customizing
- name: Create draft GitHub (pre)release
uses: softprops/action-gh-release@v1
with:
# use PR branch name for draft releases
name: ${{ github.event.pull_request.head.ref }}
tag_name: ${{ github.event.pull_request.head.ref }}
draft: true
prerelease: true
token: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
files: |
dist/*.AppImage
dist/*.blockmap
dist/*.deb
dist/*.dmg
dist/*.exe
dist/*.rpm
dist/*.zip
dist/latest*.yml
- name: Compress custom source
if: runner.os != 'Windows'
shell: bash --noprofile --norc -eo pipefail -x {0}
run: tar -acf ${{ runner.temp }}/custom.tgz .
- name: Compress custom source
if: runner.os == 'Windows'
shell: powershell
run: tar -acf ${{ runner.temp }}\custom.tgz .
- name: Upload custom artifact
uses: actions/upload-artifact@v3
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}
path: ${{ runner.temp }}/custom.tgz
retention-days: 1

View File

@@ -1,76 +0,0 @@
---
name: test release
# https://github.com/product-os/flowzone/tree/master/.github/actions
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
# --- custom environment
NODE_VERSION:
type: string
default: "14.x"
VERBOSE:
type: string
default: "true"
runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Delete previous draft release
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
gh release delete --yes '${{ github.event.pull_request.head.ref }}' || true
env:
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
# https://github.com/actions/setup-node#caching-global-packages-data
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
- name: Test release
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
npm run flowzone-preinstall-${runner_os}
npm ci
npm run build
npm run test-${runner_os}
env:
# https://www.electronjs.org/docs/latest/api/environment-variables
ELECTRON_NO_ATTACH_CONSOLE: true
- name: Compress custom source
if: runner.os != 'Windows'
shell: bash --noprofile --norc -eo pipefail -x {0}
run: tar -acf ${{ runner.temp }}/custom.tgz .
- name: Compress custom source
if: runner.os == 'Windows'
shell: powershell
run: tar -acf ${{ runner.temp }}\custom.tgz .
- name: Upload custom artifact
uses: actions/upload-artifact@v3
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}
path: ${{ runner.temp }}/custom.tgz
retention-days: 1

View File

@@ -1,16 +0,0 @@
name: Flowzone
on:
pull_request:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"
jobs:
flowzone:
name: Flowzone
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
secrets: inherit
with:
tests_run_on: '["ubuntu-latest","macos-latest","windows-2019"]'

6
.gitignore vendored
View File

@@ -51,9 +51,3 @@ node_modules
# VSCode files
.vscode
.gitsecret/keys/random_seed
!*.secret
secrets/APPLE_SIGNING_PASSWORD.txt
secrets/WINDOWS_SIGNING_PASSWORD.txt
secrets/XCODE_APP_LOADER_PASSWORD.txt
secrets/WINDOWS_SIGNING.pfx

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +0,0 @@
secrets/APPLE_SIGNING_PASSWORD.txt:5c9cfeb1ea5142b547bc842cc6e0b4a932641ae9811ee47abe2c3953f2a4de5d
secrets/WINDOWS_SIGNING_PASSWORD.txt:852e431628494f2559793c39cf09c34e9406dd79bb15b90c9f88194020470568
secrets/XCODE_APP_LOADER_PASSWORD.txt:005eb9a3c7035c77232973c9355468fc396b94e62783fb8e6dce16bce95b94a1
secrets/WINDOWS_SIGNING.pfx:929f401db38733ffc41572539de7c0d938023af51ed06c205a72a71c1f815714
secrets/APPLE_SIGNING.p12:61abf7b4ff2eec76ce889d71bcdd568b99a6a719b4947ac20f03966265b0946a

1
.nvmrc
View File

@@ -1 +0,0 @@
14

74
.resinci.json Normal file
View File

@@ -0,0 +1,74 @@
{
"electron": {
"npm_version": "6.14.5",
"dependencies": {
"linux": [
"libudev-dev",
"libusb-1.0-0-dev",
"libyaml-dev",
"libgtk-3-0",
"libatk-bridge2.0-0",
"libdbus-1-3",
"libgbm1",
"libc6"
]
},
"builder": {
"appId": "io.balena.etcher",
"copyright": "Copyright 2016-2021 Balena Ltd",
"productName": "balenaEtcher",
"nodeGypRebuild": false,
"afterPack": "./afterPack.js",
"asar": false,
"files": [
"generated",
"lib/shared/catalina-sudo/sudo-askpass.osascript.js"
],
"afterSign": "./afterSignHook.js",
"mac": {
"category": "public.app-category.developer-tools",
"hardenedRuntime": true,
"entitlements": "entitlements.mac.plist",
"entitlementsInherit": "entitlements.mac.plist",
"artifactName": "${productName}-${version}.${ext}"
},
"dmg": {
"iconSize": 110,
"contents": [
{
"x": 140,
"y": 245
},
{
"x": 415,
"y": 245,
"type": "link",
"path": "/Applications"
}
],
"window": {
"width": 544,
"height": 407
}
},
"linux": {
"category": "Utility",
"packageCategory": "utils",
"synopsis": "balenaEtcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more."
},
"deb": {
"compression": "bzip2",
"priority": "optional",
"depends": [
"polkit-1-auth-agent | policykit-1-gnome | polkit-kde-1"
]
},
"protocols": {
"name": "etcher",
"schemes": [
"etcher"
]
}
}
}
}

View File

@@ -1,120 +1,3 @@
- commits:
- subject: Generate release notes with git
hash: a61aa8e2bec57281655eb1c89c956fd5d42d3fc5
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.8.2
title: ""
date: 2022-11-08T00:19:25.825Z
- commits:
- subject: Update dependency @types/mime-types to 2.1.1
hash: fe09f9f862d2eef79a237986c50e587b232d9c2d
body: |
Update @types/mime-types to 2.1.1
Update @types/mime-types from 2.1.0 to 2.1.1
footer:
Change-type: patch
change-type: patch
author: Renovate Bot
nested: []
version: 1.8.1
title: ""
date: 2022-11-07T23:35:26.671Z
- commits:
- subject: Update scripts/resin digest to 652fdd4
hash: 16422971012d77dc928c9d99c3db6b1a58cd52be
body: |
Update scripts/resin to
Update scripts/resin from to
footer:
Change-type: minor
change-type: minor
author: Renovate Bot
nested: []
version: 1.8.0
title: ""
date: 2022-11-07T22:27:03.928Z
- commits:
- subject: Build targets individually
hash: b58249b9c833763ec80402820b2c93c01fafda22
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.7.15
title: ""
date: 2022-11-07T21:36:35.993Z
- commits:
- subject: Update dependency lodash to 4.17.21 [SECURITY]
hash: f356e4c303080eefdf74f52c2b4de227d20e4e49
body: |
Update lodash to 4.17.21
Update lodash from 4.17.10 to 4.17.21
footer:
Change-type: patch
change-type: patch
author: Renovate Bot
nested: []
version: 1.7.14
title: ""
date: 2022-11-07T20:17:53.572Z
- commits:
- subject: Update release notes on finalize
hash: 576113febfe000339545c0fd55793aafd2e53abb
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.7.13
title: ""
date: 2022-11-07T19:17:06.571Z
- commits:
- subject: Avoid duplicate releases
hash: 33dea6267fbcc3cd47b1744830731c853ebbba18
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.7.12
title: ""
date: 2022-11-07T18:32:19.617Z
- commits:
- subject: Only run finalize on Linux runners
hash: 9ab307df4f4f617adac33c6a36f492229050bb0e
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.7.11
title: ""
date: 2022-11-07T17:32:25.787Z
- commits:
- subject: Switch to Flowzone
hash: 2e53feb38cd548bd2fe68957797bffe66b832eaf
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 1.7.10
title: ""
date: 2022-11-07T15:59:41.308Z
- commits:
- subject: "patch: update allowed extensions to include deb afterinstall in build"
hash: 61610ded842caba47c6a682afcb08aa0fda4e86b
@@ -480,11 +363,11 @@
- subject: Add support for basic auth when downloading images from URL.
hash: b2d0c1c9ddbbfe87d5a905d420d615821610e825
body: >
When selecting "Flash from URL" the user can optionally provide a username
and password for basic authentication. The authentication input fields
are collapsed by default. When the authentication input fields are
collapsed after entering values the values are cleared to ensure that
the user sees all parameter passed to the server.
When selecting "Flash from URL" the user can optionally provide a
username and password for basic authentication. The authentication input
fields are collapsed by default. When the authentication input fields
are collapsed after entering values the values are cleared to ensure
that the user sees all parameter passed to the server.
footer:
Change-Type: minor
change-type: minor
@@ -1041,7 +924,8 @@
- subject: Ignore ENOENT errors on unlink in withTmpFile
hash: 7bb2a23c4e94dcda6a7b494fe0435c0b59b56b06
body: >
The temporary file might have been already deleted by cleanupTmpFiles
The temporary file might have been already deleted by
cleanupTmpFiles
footer:
Change-type: patch
change-type: patch
@@ -1111,7 +995,8 @@
- subject: Pass strings between methods as std::string instead of char *
hash: 1ec6a8ffc4c9e138b78210f0db84a9ebd6c9182b
body: >
- Fixes "basic_string::_M_construct null not valid" exception
- Fixes "basic_string::_M_construct null not valid"
exception
aborting program, because WCharToUtf8() returned NULL
in some cases, and NULL was being fed to string constructor.
- Fixes memory leak because memory allocated with calloc()
@@ -3199,8 +3084,8 @@
change-type: patch
subject: Fixes the Command for macOS drive recovery
body: >-
Changes the documentation to update the disktutil command which didn't fix
my case, cause the boot partition was broken.
Changes the documentation to update the disktutil command which didn't
fix my case, cause the boot partition was broken.
This way it rewrites the drive into a FAT32 partition editable in Unix/Windows.
- hash: b3f25c176b1bdb487d1a7bf111d7f170fe008842
@@ -6129,7 +6014,8 @@
changelog-entry: Add support for configuration files
subject: "feat(gui): Add ability to read settings from a config file"
body: >-
This adds the capability to configure settings via a `.etcher.json` file,
This adds the capability to configure settings via a `.etcher.json`
file,
either in the user's home directory, or the current working directory.
@@ -6247,7 +6133,8 @@
change-type: patch
subject: "doc: Update MAINTAINERS.md with Symantec Whitelisting"
body: >-
This adds instructions for submitting Etcher for false positive detection
This adds instructions for submitting Etcher for false positive
detection
to Symantec Endpoint Protection.
- hash: bb2dac75040554c0ba2c7e50ff9ecd61608e7d38
@@ -6423,7 +6310,8 @@
change-type: patch
subject: "fix(image-writer): Remove use of _.isError"
body: >-
`_.isError()` returns `true` for anything that has a `name` and `message`
`_.isError()` returns `true` for anything that has a `name` and
`message`
property, causing the check here to always keep the plain object as error.
- hash: 355373f24df6be0989fad9429c2230166b33a3bf
@@ -6439,7 +6327,8 @@
change-type: patch
subject: "upgrade(package): Update drivelist 6.1.5 -> 6.1.7"
body: >-
This fixes a ReferenceError that could occur when the DeviceNode was null,
This fixes a ReferenceError that could occur when the DeviceNode was
null,
as well as devices being null when run after the system recovers from sleep / standby.
- hash: 6e7484d3dabc2aeaa7cd471822d7019860cc4a5c
@@ -7275,7 +7164,8 @@
changelog-entry: Remove stale `invalidKey` check in store.
subject: "refactor: remove stale invalid key check in store"
body: >-
We remove a piece of code checking whether `_.keys` returns any non-string
We remove a piece of code checking whether `_.keys` returns any
non-string
values in its array, but per the Lodash documentation `_.keys` always returns an
@@ -7303,7 +7193,8 @@
changelog-entry: Make the drive-selector button orange on warnings.
subject: "feat(GUI): warning makes drive-selector button orange"
body: >-
We make the drive-selector button orange when there is a warning attached
We make the drive-selector button orange when there is a warning
attached
to the image-drive pair.
- hash: 4ce89f97fe02d714ce7f247a6a03ad6d326c3a8a

View File

@@ -3,51 +3,6 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
# v1.8.2
## (2022-11-08)
* Generate release notes with git [ab77]
# v1.8.1
## (2022-11-07)
* Update dependency @types/mime-types to 2.1.1 [Renovate Bot]
# v1.8.0
## (2022-11-07)
* Update scripts/resin digest to 652fdd4 [Renovate Bot]
# v1.7.15
## (2022-11-07)
* Build targets individually [ab77]
# v1.7.14
## (2022-11-07)
* Update dependency lodash to 4.17.21 [SECURITY] [Renovate Bot]
# v1.7.13
## (2022-11-07)
* Update release notes on finalize [ab77]
# v1.7.12
## (2022-11-07)
* Avoid duplicate releases [ab77]
# v1.7.11
## (2022-11-07)
* Only run finalize on Linux runners [ab77]
# v1.7.10
## (2022-11-07)
* Switch to Flowzone [ab77]
# v1.7.9
## (2022-04-22)

View File

@@ -10,15 +10,13 @@ async function main(context) {
}
const appName = context.packager.appInfo.productFilename
const appleId = process.env.XCODE_APP_LOADER_EMAIL || 'accounts+apple@balena.io'
const appleIdPassword = process.env.XCODE_APP_LOADER_PASSWORD
const appleId = 'accounts+apple@balena.io'
// https://github.com/electron/notarize/blob/main/README.md
await notarize({
appBundleId: 'io.balena.etcher',
appPath: `${appOutDir}/${appName}.app`,
appleId,
appleIdPassword
appleIdPassword: `@keychain:Application Loader: ${appleId}`
})
}

View File

@@ -0,0 +1,178 @@
---
description: Getting started for etcherPro
slug: /
---
# EtcherPro User manual
## 1. Features
![EtcherPro-manual-01](img/etcher-pro-top-view.jpeg)
![EtcherPro-manual-02](img/etcher-pro-slots.jpeg)
![EtcherPro-manual-03](img/etcher-pro-rear-view.jpeg)
| Specifications | |
| --- | --- |
| Voltage in | 100 to 240 V AC - 10A - 50 to 60 Hz |
| Voltage out | 100 to 240 V AC - 10A - 50 to 60 Hz |
| Ports | 16 x USB 3.0, 16 X SD, 16 x mSD |
| Flashing capacity | 16 x targets when using an online image or, 15 x target drives and 1 x local source drive |
| Daisy-chaining | Up to 10 EtcherPro devices supported (160 x targets) |
| Language support | English |
| Software | balenaEtcher on balenaOS with auto-updates |
| Display | 7in RGB touch screen |
| Network connectivity | WiFi 2.4GHz, 5GHz |
| Working temperature | 5°C ~ 30°C |
| Certifications | CE, FCC |
## 2. Getting started
### 2.1 Setup
### Powering up the device
- EtcherPro is supplied with a mains power cable according to your region's plug standards
- On the back of the device, there are two groups of sockets, labelled as **IN** and **OUT**
- Plug the AC power cable to the socket labelled **POWER IN**, and then to the mains outlet
- The device should boot up automatically; wait until you see the Etcher interface show up
- [Warning] Please avoid using adaptors or extension leads, as this may damage the device or cause it to malfunction
### Connecting to WiFi
- The device will prompt you to connect to a local network the first time it boots (you can skip this step if you are not connecting to WiFi)
- Select the network to which you want to connect, type the password and select **OK**
- You can access the WiFi settings by selecting the WiFi icon at the top left corner of the screen
### 2.2 Etcher functions
### Flash from file
Using an image file as source to flash to one or multiple targets
- From the Etcher menu, select **Flash from file**
- Plug a drive that contains the image you would like to flash into the slot with the blue-colored blinking LED
- Select the image you want to flash from the file browser and select **OK**
- Plug at least one drive or device into an available slot. The plugged target(s) will be selected automatically and the LEDs will turn white
- Select **Flash**, to begin the flashing process
- The LED of each slot will first blink purple for flashing and then green for validating
- Once the flashing is complete, the LEDs will turn green for successfully flashed drives, and red for the failed ones
- You may safely unplug the drives when flashing is complete
### Flash from URL
Using an online image file as source to flash to one or multiple targets
- From the Etcher menu, select **Flash from URL**
- Enter the image URL of you would like to flash in the input field, and select **OK**
- Plug at least one drive or device into an available slot. The plugged target(s) will be selected automatically, and the LEDs will turn white
- Select **Flash**, to begin the flashing process
- The LED of each slot will first blink purple for flashing and then green for validating
- Once the flashing is complete, the LEDs will turn green for successfully flashed drives, and red for the failed ones
- You may safely unplug the drives when flashing is complete
### Clone drive
Using a drive as source, and cloning it to multiple drives
- From the Etcher menu, select **Clone drive**
- Plug a drive you would like to clone into the slot with the blue-colored blinking LED
- The drive will be selected automatically and the LED will stop blinking
- Plug at least one drive into an available slot. The plugged targets will be selected automatically, and the LEDs will turn white
- Select **Flash**, to begin the flashing process
- The LED of each slot will first blink purple for flashing and then green for validating
- Once the flashing is complete, the LEDs will turn green for successfully flashed drives, and red for the failed ones
- You may safely unplug the drives when flashing is complete
### Backup drive
Backing up one or multiple drives into another drive
- From the Etcher menu, select **more options**, then **Backup drive**
- Plug one or more drives you would like to backup into the slot(s) with the blue-colored blinking LED
- The drives will be autoselected and the LED will stop blinking
- Select **OK** to move on to the next step
- Plug the backup drive into the slot with the white-colored blinking LED. The plugged target will be automatically selected and the LED will stop blinking
- Select **Flash**, to begin the flashing process
- The LED of the target slot will first blink purple for flashing, and then green for validating
- Once the flashing is complete, the LED will turn green for a successful flash, and red for a failed one
- You may safely unplug the drive when flashing is complete
### Format drive
Formatting one or multiple drives
- From the Etcher menu, select **more options**, then **Format drive**
- Plug one or more drives you would like to format on the slots with the white-colored blinking LEDs
- The drives will be selected automatically, and the LED will stop blinking
- Select **Flash**, to begin the flashing process
- The LED of the target slot will first blink purple for flashing, and then green for validating
- Once the formatting is complete, the LEDs will turn green for successfully formatted drives, and red for the failed ones
- You may safely unplug the drive when formatting is complete
### 2.3 Daisy-chaining (power only)
Connecting up to 10 EtcherPro devices and power them from one socket.
- EtcherPro allows you to chain power (data chaining will be released later). To do this, you will need a male to female IEC C13/C14 power extension lead (min 10A rated) to connect one EtcherPro to another
- Plug the power extension lead to the 'POWER IN' side of the leading EtcherPro, and then to the 'POWER OUT' side of the successive EtcherPro
- The last EtcherPro of the stack should be plugged directly to the mains power socket
### 2.4 Sleep, wake and power off
- EtcherPro is set to automatically go into sleep mode after a few minutes
- You may change this setting by selecting the settings icon on the top right corner of the screen
- You may put the device to sleep manually by selecting the sleep button on the top left corner of the screen
- To wake up your device, just tap anywhere on the screen
- It is not necessary to power off your device, but if you would like to, you may simply unplug the power-in cable
### 3. Safety and handling
WARNING: Make sure you read and follow the safety and handling instructions before using EtcherPro in order to avoid the potential risk of causing damage to the device, electrical shock, fire, or damage to any other property. If EtcherPro gets physically damaged in any way, or you suspect liquid has leaked into the enclosure, unplug the power cable from the socket and avoid using the device before contacting support (pro@etcher.io).
Handling
It is important not to block the air vents on the back and bottom of the device. As such, we suggest setting up EtcherPro on a well supported desk, with plenty of surrounding space to ensure the device is properly ventilated while in use.
Liquid exposure
EtcherPros enclosure is not waterproof. It is important to keep liquids away from the device to avoid spillages. High humidity environments, rain or snow may also cause damage to the device.
Power
EtcherPro does not have an on/off switch. If you would like to power on the device, you need to plug the power cable into the mains socket. If you would like to power off the device, you need to unplug the power cable. Be sure to unplug the power cable from the socket if you suspect either the cable or the device is physically damaged in some way.
For your own protection and protection of the device, EtcherPro comes with a grounded AC power cable which only fits a grounded mains socket. If you dont have a grounded socket installed, you should contact a specialist who can safely install an appropriate grounded socket. Do not attempt to power on the device without a connected grounding wire or with a power cable that does not meet the original specifications.
Repairing
EtcherPro is not meant to be serviced or repaired by the user. If your device has any issues you should contact support (pro@etcher.io). Attempting to disassemble the device will void the warranty, and could also cause injury or harm.
Radio interference
EtcherPro contains components and radios that emit electromagnetic fields. These electromagnetic fields may interfere with medical devices, such as pacemakers and defibrillators. Consult your physician and medical device manufacturer for information specific to your medical device and whether you need to maintain a safe distance of separation between your medical device(s) and EtcherPro. If you suspect EtcherPro is interfering with your medical device, stop using EtcherPro immediately.
EtcherPro emits electromagnetic fields due to the usage of components and radios. These fields can interfere with other devices and potentially cause them to malfunction. If you suspect EtcherPro is interfering with another device, unplug EtcherPro from the power and contact support (pro@etcher.io).
This equipment is not suitable for use in locations where children are likely to be present.
Atmospheric conditions (dust and vapor)
The EtcherPro enclosure is not sealed. Using the device in an environment that has increased amounts of dust, powder, vapors, corrosive substances, or other contaminants can cause malfunction, injury, and/or fire.
### 4. Warranty
**Limited Product Warranty**
Balena warrants that, for a period of one (1) year after the date of shipment, the Products will be free from defects in materials and workmanship under normal use. As Balenas sole liability and Customers sole and exclusive remedy for any breach of the limited warranty set forth herein, Balena will, at its option and expense, repair or replace any Product returned to Customer during the warranty period that does not comply with such warranty, as confirmed by Balena. Replacement Products will be warranted for the remainder of the original warranty period or ninety (90) days, whichever is longer. All Products that are replaced become the property of Balena. Balena will have no obligation to the extent that any failure of a Product to comply with the limited warranty set forth in this limited product warranty results from or is otherwise attributable to: (i) negligence, misuse, or abuse of the Product; (ii) use of the Product other than in accordance with Balenas published specifications or user manual; (iii) modifications, alterations or repairs to the Product made by a party other than Balena or a party authorized by Balena; (iv) any failure by Customer or a third party to comply with environmental and storage requirements for the Product specified by Balena, including, but not limited to, temperature or humidity ranges; or (v) use of the Product in combination with any third-party devices or products that have not been provided or recommended by Balena. The parties agree that Balenas RMA Policy shall apply to Products returned pursuant to this limited product warranty for a breach of warranty.
THE LIMITED WARRANTY SET FORTH HEREIN IS IN LIEU OF, AND BALENA SPECIFICALLY DISCLAIMS, ANY AND ALL OTHER WARRANTIES AND CONDITIONS, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, AND ANY WARRANTIES ARISING OUT OF COURSE OF DEALING OR USAGE OF TRADE. NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED FROM BALENA OR ELSEWHERE, WILL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN THESE TERMS.
The limited warranty does not apply to:
- Returned items that failed due to an accident, purchasers abuse, neglect or failure to operate in accordance with instructions provided in this refund policy.
- Returned items that failed due to incorrect voltage or improper wiring.
- Returned items that failed due to rain, excessive humidity, corrosive environments, or other contaminants.
- Any item damaged in shipment.
- Any product failure caused by installing or operating product under conditions not in accordance with installation and operation guidelines, or damaged by contact with tools or surroundings.
- Returned items with cosmetic defects that do not interfere with product functionality.
- Returned items that are incomplete or defaced.
- Returned items with a different serial number from what was authorized for return.
- Freight damaged items. If your shipment arrives damaged, you must note the damage on the carrier's delivery record in accordance with the carrier's policy, save the merchandise in the original box and packing it arrived in, and arrange for a carrier inspection of damaged merchandise.
**Initiating a warranty claim**
To initiate a warranty claim, please contact support (pro@etcher.io) to receive a copy of the RMA form. When filling the form, make sure you describe the issue as accurately as possible since it will be used as a basis for determining if the warranty claim is valid or not.
After Balenas evaluation of the return item, Warranty or Out-of-Warranty status will be determined. If the description of the problem is the same as listed on Page 1 of the RMA form, the product will be repaired or replaced under warranty at no charge and shipped back, prepaid, to the customer.
If the description of the problem is different from the problem listed on Page 1 of the RMA form we will contact the customer. At such time, the customer must issue a written confirmation to proceed with the repair(s), agree to cover the costs of the repair and return freight, or authorize the product to be shipped back as is, at the customers expense. Failure to obtain written confirmation within thirty (30) days of notification will result in the product being returned as is, at the customers expense.
If the product has no identifiable problem, we reserve the right to charge for testing and return shipping costs.
For any product returned to balena for reasons other than warranty, a 20% restocking fee and round-trip shipping costs will be deducted from the credit refund. All returned items must be in their original box or crating and must include all packing material, manuals, and accessories.

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

BIN
docs/static/img/etcher-pro-slots.jpeg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
docs/static/img/etcher-pro-top-view.jpeg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

BIN
docs/static/img/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
docs/static/img/logo.png vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -1,9 +1,10 @@
# https://www.electron.build/configuration/configuration
appId: io.balena.etcher
copyright: Copyright 2016-2021 Balena Ltd
productName: balenaEtcher
afterPack: ./afterPack.js
afterSign: ./afterSignHook.js
npmRebuild: true
nodeGypRebuild: false
publish: null
afterPack: "./afterPack.js"
asar: false
files:
- generated
@@ -15,8 +16,6 @@ mac:
entitlements: "entitlements.mac.plist"
entitlementsInherit: "entitlements.mac.plist"
artifactName: "${productName}-${version}.${ext}"
target:
- dmg
dmg:
background: assets/dmg/background.tiff
icon: assets/icon.icns
@@ -33,10 +32,6 @@ dmg:
height: 405
win:
icon: assets/icon.ico
target:
- zip
- nsis
- portable
nsis:
oneClick: true
runAfterFinish: true
@@ -49,23 +44,16 @@ portable:
artifactName: "${productName}-Portable-${version}.${ext}"
requestExecutionLevel: user
linux:
icon: assets/iconset
target:
- AppImage
- rpm
- deb
category: Utility
packageCategory: utils
executableName: balena-etcher
executableName: balena-etcher-electron
synopsis: balenaEtcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more.
appImage:
artifactName: ${productName}-${version}-${env.ELECTRON_BUILDER_ARCHITECTURE}.${ext}
icon: assets/iconset
deb:
priority: optional
compression: bzip2
depends:
- gconf-service
- gconf2
- gconf-service
- libasound2
- libatk1.0-0
- libc6

3193
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "balena-etcher",
"private": true,
"displayName": "balenaEtcher",
"version": "1.8.2",
"version": "1.7.9",
"packageType": "local",
"main": "generated/etcher.js",
"description": "Flash OS images to SD cards and USB drives, safely and easily.",
@@ -13,26 +13,21 @@
"url": "git@github.com:balena-io/etcher.git"
},
"scripts": {
"build": "npm run webpack",
"flowzone-preinstall-linux": "sudo apt-get install -y xvfb libudev-dev && cat < electron-builder.yml | yq e .deb.depends[] - | xargs -L1 echo | sed 's/|//g' | xargs -L1 sudo apt-get --ignore-missing install || true",
"flowzone-preinstall-macos": "true",
"flowzone-preinstall-windows": "true",
"flowzone-preinstall": "npm run flowzone-preinstall-linux",
"lint-css": "prettier --write lib/**/*.css",
"lint-ts": "balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts",
"lint-css": "prettier --write lib/**/*.css",
"lint": "npm run lint-ts && npm run lint-css",
"postinstall": "electron-rebuild -t prod,dev,optional",
"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-gui": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts",
"test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.ts",
"test": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
"sanity-checks": "bash scripts/ci/ensure-all-file-extensions-in-gitattributes.sh",
"start": "./node_modules/.bin/electron .",
"test-macos": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
"test-gui": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts",
"test-linux": "npm run lint && xvfb-run --auto-servernum npm run test-gui && xvfb-run --auto-servernum npm run test-shared && xvfb-run --auto-servernum npm run test-spectron && npm run sanity-checks",
"test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.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": "echo npm run test-{linux,windows,macos}",
"postinstall": "electron-rebuild -t prod,dev,optional",
"webpack": "webpack",
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
"webpack": "webpack"
"concourse-build-electron": "npm run webpack",
"concourse-test": "npx npm@6.14.8 test",
"concourse-test-electron": "npx npm@6.14.8 test"
},
"husky": {
"hooks": {
@@ -56,7 +51,7 @@
"@svgr/webpack": "5.5.0",
"@types/chai": "4.2.7",
"@types/copy-webpack-plugin": "6.0.0",
"@types/mime-types": "2.1.1",
"@types/mime-types": "2.1.0",
"@types/mini-css-extract-plugin": "1.2.2",
"@types/mocha": "8.0.3",
"@types/node": "14.14.41",
@@ -68,7 +63,7 @@
"@types/terser-webpack-plugin": "5.0.2",
"@types/tmp": "0.2.0",
"@types/webpack-node-externals": "2.5.0",
"aws4-axios": "2.4.9",
"aws4-axios": "2.2.1",
"chai": "4.2.0",
"copy-webpack-plugin": "7.0.0",
"css-loader": "5.0.1",
@@ -81,18 +76,18 @@
"electron-rebuild": "3.2.5",
"electron-updater": "4.3.5",
"esbuild-loader": "2.16.0",
"etcher-sdk": "7.4.0",
"etcher-sdk": "6.3.0",
"file-loader": "6.2.0",
"husky": "4.2.5",
"immutable": "3.8.1",
"lint-staged": "10.2.2",
"lodash": "4.17.21",
"lodash": "4.17.10",
"mini-css-extract-plugin": "1.3.3",
"mocha": "8.0.1",
"native-addon-loader": "2.0.1",
"node-ipc": "9.1.1",
"omit-deep-lodash": "1.1.4",
"outdent": "0.8.0",
"outdent": "0.7.1",
"path-is-inside": "1.0.2",
"pnp-webpack-plugin": "1.6.4",
"pretty-bytes": "5.3.0",
@@ -120,10 +115,7 @@
"webpack-cli": "4.2.0",
"webpack-dev-server": "4.5.0"
},
"engines": {
"node": ">=14 < 16"
},
"versionist": {
"publishedAt": "2022-11-08T00:19:26.796Z"
"publishedAt": "2022-04-22T13:10:47.906Z"
}
}

View File

@@ -1,18 +1,17 @@
---
type: electron
release: github
publishMetadata: true
sentry:
org: balenaetcher
team: resinio
type: electron
org: balenaetcher
team: resinio
type: electron
triggerNotification:
version: 1.7.9
stagingPercentage: 100
version: 1.7.9
stagingPercentage: 100
upstream:
- repo: etcher-sdk
url: https://github.com/balena-io-modules/etcher-sdk
module: etcher-sdk
module: 'etcher-sdk'
- repo: sys-class-rgb-led
url: https://github.com/balena-io-modules/sys-class-rgb-led
module: sys-class-rgb-led

Binary file not shown.

Binary file not shown.

View File

@@ -77,63 +77,11 @@ function renameNodeModules(resourcePath: string) {
);
}
function findUsbPrebuild(): string[] {
const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds')
const prebuildFolders = readdirSync(usbPrebuildsFolder);
let bindingFile: string | undefined = 'node.napi.node';
const platformFolder = prebuildFolders.find(
(f) =>
f.startsWith(os.platform()) &&
f.indexOf(os.arch()) > -1,
);
if (platformFolder === undefined) {
throw new Error('Could not find usb prebuild. Should try fallback to node-gyp and use /build/Release instead of /prebuilds');
}
const bindingFiles = readdirSync(
path.join(usbPrebuildsFolder, platformFolder)
)
if (!bindingFiles.length) {
throw new Error('Could not find usb prebuild for platform')
}
if (bindingFiles.length === 1) {
bindingFile = bindingFiles[0];
}
// armv6 vs v7 in linux-arm and
// glibc vs musl in linux-x64
if (bindingFiles.length > 1) {
bindingFile = bindingFiles.find((file) => {
if (bindingFiles.indexOf('arm') > -1) {
const process = require('process')
return file.indexOf(process.config.variables.arm_version) > -1
} else {
return file.indexOf('glibc') > -1
}
})
}
if (bindingFile === undefined) {
throw new Error('Could not find usb prebuild for platform')
}
return [platformFolder, bindingFile];
}
const [
USB_BINDINGS_FOLDER,
USB_BINDINGS_FILE,
] = findUsbPrebuild();
function findLzmaNativeBindingsFolder(): string {
const files = readdirSync(
path.join('node_modules', 'lzma-native', 'prebuilds'),
);
const files = readdirSync(path.join('node_modules', 'lzma-native'));
const bindingsFolder = files.find(
(f) =>
f.startsWith(os.platform()) &&
f.startsWith('binding-') &&
f.endsWith(env.npm_config_target_arch || os.arch()),
);
if (bindingsFolder === undefined) {
@@ -262,8 +210,8 @@ const commonConfig = {
/node_modules\/lzma-native\/index\.js$/,
// remove node-pre-gyp magic from lzma-native
{
search: `require('node-gyp-build')(__dirname);`,
replace: `require('./prebuilds/${LZMA_BINDINGS_FOLDER}/electron.napi.node')`,
search: 'require(binding_path)',
replace: `require('./${LZMA_BINDINGS_FOLDER}/lzma_native.node')`,
},
// use regular stream module instead of readable-stream
{
@@ -272,9 +220,9 @@ const commonConfig = {
},
),
// remove node-pre-gyp magic from usb
replace(/node_modules\/usb\/dist\/usb\/bindings\.js$/, {
search: `require('node-gyp-build')(path_1.join(__dirname, '..', '..'));`,
replace: `require('../../prebuilds/${USB_BINDINGS_FOLDER}/${USB_BINDINGS_FILE}')`,
replace(/node_modules\/@balena.io\/usb\/usb\.js$/, {
search: 'require(binding_path)',
replace: "require('./build/Release/usb_bindings.node')",
}),
// remove bindings magic from mountutils
replace(/node_modules\/mountutils\/index\.js$/, {
@@ -400,8 +348,8 @@ const guiConfigCopyPatterns = [
if (os.platform() === 'win32') {
// liblzma.dll is required on Windows for lzma-native
guiConfigCopyPatterns.push({
from: `node_modules/lzma-native/prebuilds/${LZMA_BINDINGS_FOLDER}/liblzma.dll`,
to: `modules/lzma-native/prebuilds/${LZMA_BINDINGS_FOLDER_RENAMED}/liblzma.dll`,
from: `node_modules/lzma-native/${LZMA_BINDINGS_FOLDER}/liblzma.dll`,
to: `modules/lzma-native/${LZMA_BINDINGS_FOLDER_RENAMED}/liblzma.dll`,
});
}