-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(suite-desktop-core): typescriptize electron builder hooks #17056
Conversation
// do not include passwords or other sensitive data in the file | ||
// rather create environment variables with sensitive data | ||
const CERTIFICATE_NAME = process.env.WINDOWS_SIGN_CERTIFICATE_NAME; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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..
d28eed3
to
902838b
Compare
"include": [ | ||
"src", | ||
"e2e", | ||
"scripts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, much types, such typescript 🐶
👏 Good job!
(haven't tested tho)
Description
Actually use TypeScript for electron-builder hooks - currently they have
.ts
extension, 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/notarize
was 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:lib
to compile them to CJS for electron-builder right before buildingRelated Issue
Followup to https://github.com/trezor/trezor-suite-private/issues/16 and #17050