chore(suite-desktop-core): typescriptize electron builder hooks#17056
chore(suite-desktop-core): typescriptize electron builder hooks#17056
Conversation
| const TOKEN_PASSWORD = process.env.WINDOWS_SIGN_TOKEN_PASSWORD; | ||
|
|
||
| require('child_process').execSync( | ||
| await require('child_process').exec( |
There was a problem hiding this comment.
This fn was async (and has to stay, because TS requires the hook to return Promise), but without await, which failed eslint, hence eslint disable 🙈
👉 needs to be verified if changing execSync to exec doesn't break the signing with codesign build.
But should be ok. This is the code that invokes it. It awaits the Promise, so LGTM..
There was a problem hiding this comment.
UPDATE: This was actually wrong 😱
d28eed3 to
902838b
Compare
| "include": [ | ||
| "src", | ||
| "e2e", | ||
| "scripts", |
There was a problem hiding this comment.
This includes the scripts to type-check, which was not done before, but does not build them, that's what build:lib does (tsconfig.lib.json)
| files: ['**/scripts/**'], | ||
| rules: { | ||
| 'no-console': 'off', | ||
| 'import/no-default-export': 'off', |
There was a problem hiding this comment.
funnily enough, eslint tolerates CJS exports.default in a TS file, but errors at ES export default.
|
|
||
| const { notarize } = require('@electron/notarize'); | ||
|
|
||
| exports.default = context => { |
There was a problem hiding this comment.
No type check ever happened on this "typescript" file.
TS would fail, because at the very least, TS requires (context: any) =>, but then it's no longer valid JS (electron-builder crashes)
WalkthroughThis pull request comprises modifications across configuration files, build scripts, and source files in the suite-desktop-core and suite-desktop projects. The ESLint configuration has been updated by adding a new rule object specifically targeting files in the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (1)
🔇 Additional comments (14)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Description
Actually use TypeScript for electron-builder hooks - currently they have
.tsextension, but are written plain JavaScript (CJS, as electron-builder needs), and type checking never ever happens.type-check. We don't do it for most JS scripts, but these scripts are built around API of electron-builder & electron/notarize, and IMO they'd really benefit from being typechecked@electron/notarizewas bumped by yours truly, but I couldn't have noticed when I believed it was TS, yet didn't know it's not really TS 😅build:libto compile them to CJS for electron-builder right before buildingRelated Issue
Followup to https://github.com/trezor/trezor-suite-private/issues/16 and #17050