Skip to content

chore(suite-desktop): rewrite builder hooks to ESM#18680

Merged
Lemonexe merged 1 commit intodevelopfrom
chore/bump-electron-notarize
May 2, 2025
Merged

chore(suite-desktop): rewrite builder hooks to ESM#18680
Lemonexe merged 1 commit intodevelopfrom
chore/bump-electron-notarize

Conversation

@Lemonexe
Copy link
Copy Markdown
Contributor

@Lemonexe Lemonexe commented May 1, 2025

Description

  • bump @electron/notarize to 3, which is now available only as ESM
  • and so transpile all builder hooks to ESM instead of CJS

Related Issue

Resolve #18091

🔍🖥️ Suite web test results: View in Currents

🔍🖥️ Suite desktop test results: View in Currents

@Lemonexe Lemonexe added the build-desktop This will trigger the build of desktop apps for your PR label May 1, 2025
"main": "src/app.ts",
"scripts": {
"build:scripts": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.scripts.json",
"build:scripts": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.scripts.json && find ./lib -name '*.js' -exec bash -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
Copy link
Copy Markdown
Contributor Author

@Lemonexe Lemonexe May 1, 2025

Choose a reason for hiding this comment

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

kinda hacky; what's going on here?
We have to indicate ESM to electron-builder somehow, it can't tell automatically.
Two ways to do that:

  • "type": "module" in suite-desktop/package.json
  • mjs extension, but tsconfig doesn't offer custom extension
    • so this bash script is a temporary measure to be removed when suite-desktop is entirely ESM
    • this shouldn't break Windows-native development because that's done only in Git Bash for Windows..

const TOKEN_PASSWORD = process.env.WINDOWS_SIGN_TOKEN_PASSWORD;

require('child_process').execSync(
execSync(
Copy link
Copy Markdown
Contributor Author

@Lemonexe Lemonexe May 1, 2025

Choose a reason for hiding this comment

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

Because I broke app update on Windows the last time I touched this, I tested now that the sha sums are correct with codesign windows build (locally self-signed):

$ shasum -a 512 ./Trezor-Suite-25.5.0-win-x64.exe | awk '{print $1}' | xxd -r -p | base64
tRQT0caKMhW0Tn90OXtaHsbXR4PJbUnVWcXTjaDYjF8M4PVZYoAuQYVXwN1gIJJEczE+rGQaTboi
nvgnhPVqRQ==
$ cat latest.yml | head -7 | tail -1
sha512: tRQT0caKMhW0Tn90OXtaHsbXR4PJbUnVWcXTjaDYjF8M4PVZYoAuQYVXwN1gIJJEczE+rGQaTboinvgnhPVqRQ==

Linux build just for completeness:

$ shasum -a 512 ./Trezor-Suite-25.5.0-linux-x86_64.AppImage  | awk '{print $1}' | xxd -r -p | base64
rKO5i6aVHMuOTV6maqwyI3xpXn3TcgYAZWnMKh0WoPS1ptm7hC0LAc2N+0UzYu0avhMMZrenc13P
LFXJ9lO0xw==
$ cat latest-linux.yml | head -4 | tail -1
    sha512: rKO5i6aVHMuOTV6maqwyI3xpXn3TcgYAZWnMKh0WoPS1ptm7hC0LAc2N+0UzYu0avhMMZrenc13PLFXJ9lO0xw==

"module": "ESNext",
"declaration": false,
"sourceMap": false,
"declarationMap": false,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do not emit .map.js, d.ts, .map.d.ts
It's not a library, the point of using TS is to just typecheck during transpilation & execute it right away.

console.log(`notarizing ${appPath} ...`);

return notarize({
tool: 'notarytool',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

'notarytool' is now the only tool, after 'legacy' tool was deprecated & removed in previous version.

@Lemonexe Lemonexe marked this pull request as ready for review May 1, 2025 11:39
@Lemonexe Lemonexe requested a review from komret as a code owner May 1, 2025 11:39
@Lemonexe Lemonexe merged commit ca8160d into develop May 2, 2025
80 checks passed
@Lemonexe Lemonexe deleted the chore/bump-electron-notarize branch May 2, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-desktop This will trigger the build of desktop apps for your PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert electron-builder hooks to ESM, bump @electron/notarize

2 participants