-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
/* eslint-disable no-console */ | ||
import { notarize } from '@electron/notarize'; | ||
import type { Hooks } from 'app-builder-lib'; | ||
|
||
const { notarize } = require('@electron/notarize'); | ||
|
||
exports.default = context => { | ||
const notarizeAfterSignHook: Hooks['afterSign'] = context => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No type check ever happened on this "typescript" file. |
||
const { electronPlatformName, appOutDir } = context; | ||
|
||
if (electronPlatformName !== 'darwin') { | ||
|
@@ -25,5 +24,8 @@ exports.default = context => { | |
appleId: process.env.APPLEID, | ||
appleIdPassword: process.env.APPLEIDPASS, | ||
teamId: process.env.APPLETEAMID, | ||
}); | ||
// TODO fix: notarize tool is known to be working, but TS fails: no overload matches this call | ||
} as any); | ||
}; | ||
|
||
export default notarizeAfterSignHook; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
/* eslint-disable */ | ||
exports.default = async function (configuration) { | ||
import type { CustomWindowsSign } from 'app-builder-lib'; | ||
|
||
const signWindows: CustomWindowsSign = async configuration => { | ||
// Check if IS_CODESIGN_BUILD is set and true | ||
if (!process.env.IS_CODESIGN_BUILD || process.env.IS_CODESIGN_BUILD.toLowerCase() !== 'true') { | ||
console.log('This is DEV build, not signing'); | ||
|
||
return; | ||
} | ||
|
||
// 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( | ||
`java -jar ../suite-desktop-core/scripts/jsign-6.0.jar --keystore ../suite-desktop-core/scripts/hardwareToken.cfg --storepass '${TOKEN_PASSWORD}' --storetype PKCS11 --tsaurl http://timestamp.digicert.com --alias "${CERTIFICATE_NAME}" "${configuration.path}"`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 👉 needs to be verified if changing |
||
{ | ||
stdio: 'inherit', | ||
}, | ||
); | ||
}; | ||
|
||
export default signWindows; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,12 @@ | |
"moduleResolution": "node", | ||
"outDir": "libDev" | ||
}, | ||
"include": ["src", "e2e", "**/*.json"], | ||
"include": [ | ||
"src", | ||
"e2e", | ||
"scripts", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This includes the scripts to |
||
"**/*.json" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../../suite-common/message-system" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "../../tsconfig.lib.json", | ||
"compilerOptions": { | ||
"outDir": "lib" | ||
}, | ||
"include": ["./scripts"], | ||
"references": [ | ||
{ | ||
"path": "../eslint" | ||
} | ||
] | ||
} |
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 ESexport default
.