build(electron): fix dmg maker (#5922)

## **Type**
enhancement

___

## **Description**
- Introduced a custom DMG packaging solution `@affine/appdmg-patch` for Electron applications.
- Implemented a new TypeScript class `MakerDmg` to handle the custom packaging logic, including support for custom backgrounds, icons, and app positioning within the DMG.
- Updated Electron Forge configuration to use the new `@affine/appdmg-patch` package instead of `@electron-forge/maker-dmg`.
- Adjusted package dependencies in `packages/frontend/electron/package.json`, adding `@affine/appdmg-patch` and removing `@electron-forge/maker-dmg`.

___

## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>index.ts</strong><dd><code>Implement Custom DMG Packaging Logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tools/appdmg-patch/index.ts

<li>Introduced a new class <code>MakerDmg</code> extending <code>MakerBase</code> with support for <br>custom DMG packaging.<br> <li> Implemented custom DMG packaging logic including background, icon, and <br>app positioning.<br> <li> Added support for custom <code>contents</code> configuration to define the DMG <br>layout.<br>

</details>

  </td>
  <td><a href="https:/toeverything/AFFiNE/pull/5922/files#diff-96a537c04a2a740dca542688b3e6a65c67e6cf339b146bf0a9c49008ad58ea77">+80/-0</a>&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Configuration changes
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>forge.config.mjs</strong><dd><code>Update Electron Forge Configuration for Custom DMG Packaging</code></dd></summary>
<hr>

packages/frontend/electron/forge.config.mjs

<li>Replaced <code>@electron-forge/maker-dmg</code> with <code>@affine/appdmg-patch</code> in the <br>makers configuration.<br> <li> Adjusted DMG icon size and background configuration.<br>

</details>

  </td>
  <td><a href="https:/toeverything/AFFiNE/pull/5922/files#diff-bd3343a702deabb8f5f6f77e34fbc215615538875f59b68d82612c0f5ed532a3">+2/-3</a>&nbsp; &nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
      <summary><strong>package.json</strong><dd><code>Introduce Package Configuration for Custom DMG Packaging</code>&nbsp; </dd></summary>
<hr>

tools/appdmg-patch/package.json

<li>Created a new package <code>@affine/appdmg-patch</code> with necessary dependencies <br>for custom DMG packaging.<br>

</details>

  </td>
  <td><a href="https:/toeverything/AFFiNE/pull/5922/files#diff-395b189951512e67d55b0abc55a167f014f239f608ec5b180f9c7d48e1ea9e8b">+16/-0</a>&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Dependencies
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>package.json</strong><dd><code>Update Package Dependencies for Electron Frontend</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

packages/frontend/electron/package.json

<li>Added <code>@affine/appdmg-patch</code> to <code>devDependencies</code>.<br> <li> Removed <code>@electron-forge/maker-dmg</code> from <code>devDependencies</code>.<br>

</details>

  </td>
  <td><a href="https:/toeverything/AFFiNE/pull/5922/files#diff-37323e9da5e4b1606abb6eb8e5ff1516ae5fce925bceaafeeade61bd80c0b62d">+1/-1</a>&nbsp; &nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

>  **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
This commit is contained in:
LongYinan 2024-02-27 14:41:39 +00:00
parent 571b20d082
commit c724b3fece
No known key found for this signature in database
GPG Key ID: 30B1140CE1C07C99
2 changed files with 16 additions and 4 deletions

View File

@ -170,7 +170,7 @@
"which-typed-array": "npm:@nolyfill/which-typed-array@latest",
"next-auth@^4.24.5": "patch:next-auth@npm%3A4.24.5#~/.yarn/patches/next-auth-npm-4.24.5-8428e11927.patch",
"@reforged/maker-appimage/@electron-forge/maker-base": "7.3.0",
"macos-alias": "npm:macos-alias-building@latest",
"macos-alias": "npm:@napi-rs/macos-alias@latest",
"fs-xattr": "npm:@napi-rs/xattr@latest",
"@radix-ui/react-dialog": "npm:@radix-ui/react-dialog@latest"
}

View File

@ -7507,6 +7507,13 @@ __metadata:
languageName: node
linkType: hard
"@napi-rs/macos-alias-darwin-universal@npm:0.0.3":
version: 0.0.3
resolution: "@napi-rs/macos-alias-darwin-universal@npm:0.0.3"
conditions: os=darwin
languageName: node
linkType: hard
"@napi-rs/simple-git-android-arm-eabi@npm:0.1.16":
version: 0.1.16
resolution: "@napi-rs/simple-git-android-arm-eabi@npm:0.1.16"
@ -25994,9 +26001,14 @@ __metadata:
languageName: node
linkType: hard
"macos-alias@npm:macos-alias-building@latest":
version: 0.2.14
resolution: "macos-alias-building@npm:0.2.14"
"macos-alias@npm:@napi-rs/macos-alias@latest":
version: 0.0.3
resolution: "@napi-rs/macos-alias@npm:0.0.3"
dependencies:
"@napi-rs/macos-alias-darwin-universal": "npm:0.0.3"
dependenciesMeta:
"@napi-rs/macos-alias-darwin-universal":
optional: true
conditions: os=darwin
languageName: node
linkType: hard