Skip to content

Commit

Permalink
Revert "chore(suite-desktop-core): actually use TS for electron-build…
Browse files Browse the repository at this point in the history
…er scripts" [RELEASE ONLY]

This reverts commit f45634c.
  • Loading branch information
komret committed Mar 5, 2025
1 parent bc43a98 commit b622fa1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 36 deletions.
7 changes: 0 additions & 7 deletions packages/suite-desktop-core/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@ export default [
{
ignores: ['**/playwright-report/', '**/test-results/'],
},
{
files: ['**/scripts/**'],
rules: {
'no-console': 'off',
'import/no-default-export': 'off',
},
},
];
9 changes: 4 additions & 5 deletions packages/suite-desktop-core/scripts/notarize.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { notarize } from '@electron/notarize';
import type { Hooks } from 'app-builder-lib';
/* eslint-disable no-console */

const notarizeAfterSignHook: Hooks['afterSign'] = context => {
const { notarize } = require('@electron/notarize');

exports.default = context => {
const { electronPlatformName, appOutDir } = context;

if (electronPlatformName !== 'darwin') {
Expand All @@ -25,5 +26,3 @@ const notarizeAfterSignHook: Hooks['afterSign'] = context => {
teamId: process.env.APPLETEAMID,
});
};

export default notarizeAfterSignHook;
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { FuseV1Options, FuseVersion, flipFuses } from '@electron/fuses';
import type { Hooks } from 'app-builder-lib';
import path from 'path';
const { flipFuses, FuseV1Options, FuseVersion } = require('@electron/fuses');
const path = require('path');

// copied from https://github.com/electron-userland/electron-builder/blob/04be5699c664e6a93e093b820a16ad516355b5c7/packages/app-builder-lib/src/platformPackager.ts#L430-L434
const binaryExtensionByPlaformNameMap = {
darwin: '.app',
win32: '.exe',
linux: '',
} as const;
};

const afterPackHookSetElectronFuses: Hooks['afterPack'] = async context => {
exports.default = async function afterPack(context) {
const { electronPlatformName, appOutDir } = context;

/*
Expand Down Expand Up @@ -39,5 +38,3 @@ const afterPackHookSetElectronFuses: Hooks['afterPack'] = async context => {

console.log('Successfully set electron fuses');
};

export default afterPackHookSetElectronFuses;
11 changes: 3 additions & 8 deletions packages/suite-desktop-core/scripts/sign-windows.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import type { CustomWindowsSign } from 'app-builder-lib';

const signWindows: CustomWindowsSign = async configuration => {
/* eslint-disable */
exports.default = async function (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;

await require('child_process').exec(
require('child_process').execSync(
`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}"`,
{
stdio: 'inherit',
},
);
};

export default signWindows;
7 changes: 1 addition & 6 deletions packages/suite-desktop-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
"moduleResolution": "node",
"outDir": "libDev"
},
"include": [
"src",
"e2e",
"scripts",
"**/*.json"
],
"include": ["src", "e2e", "**/*.json"],
"references": [
{
"path": "../../suite-common/message-system"
Expand Down
6 changes: 3 additions & 3 deletions packages/suite-desktop/electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = {
target: ['nsis'],
signtoolOptions: {
publisherName: ['SatoshiLabs, s.r.o.', 'Trezor Company s.r.o.'],
sign: '../suite-desktop-core/lib/sign-windows.js',
sign: '../suite-desktop-core/scripts/sign-windows.ts',
},
},
linux: {
Expand Down Expand Up @@ -162,6 +162,6 @@ module.exports = {
category: 'Utility',
target: ['AppImage'],
},
afterPack: '../suite-desktop-core/lib/setElectronFuses.js',
afterSign: '../suite-desktop-core/lib/notarize.js',
afterPack: '../suite-desktop-core/scripts/setElectronFuses.js',
afterSign: '../suite-desktop-core/scripts/notarize.ts',
};

0 comments on commit b622fa1

Please sign in to comment.