Skip to content

Comments

CI & Build for Windows, macOS and Linux#3

Merged
iamEvanYT merged 22 commits intomainfrom
evan/build
Mar 22, 2025
Merged

CI & Build for Windows, macOS and Linux#3
iamEvanYT merged 22 commits intomainfrom
evan/build

Conversation

@iamEvanYT
Copy link
Member

@iamEvanYT iamEvanYT commented Mar 22, 2025

Key Features

  • Build for Windows, macOS and Linux
  • GitHub Workflows which automatically builds when a new tag is created (new release created)
  • Auto Update for Windows (macOS not available as it is not codesigned)

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced an automated build and release process that streamlines deployments across multiple platforms.
    • Added a dedicated release command for faster, more reliable distribution.
    • Implemented functionality for automatic updates in the application.
  • Refactor

    • Revamped the application’s packaging configuration to support a smoother, multi-platform experience.
    • Migrated legacy settings to a modern configuration approach for improved efficiency.
  • Chores

    • Upgraded project and dependency versions for enhanced stability and performance.
    • Refined development settings, including version synchronization and support for modern module imports.
    • Added support for importing JSON files directly in TypeScript.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This set of changes introduces a new GitHub Actions workflow for automating the build and release process and adds a TypeScript-based configuration for Electron Forge while removing its legacy JavaScript configuration. Package configuration files across the project have been updated, including version bumps, dependency upgrades, and new scripts. Additionally, a version synchronization utility has been added, and the TypeScript configuration has been enhanced to support JSON module resolution.

Changes

File(s) Change Summary
.github/workflows/build-and-release.yaml New GitHub Actions workflow introduced to automate the build and release process. Triggers on tag pushes (v*), runs on a matrix of operating systems, installs necessary tools (Node.js, NPM, Yarn, Bun), and, for Ubuntu, additional Flatpak dependencies, then installs dependencies and executes the release command.
electron/forge.config.js
electron/forge.config.ts
Removed legacy Electron Forge configuration (forge.config.js). Added a new TypeScript configuration (forge.config.ts) that includes comprehensive packaging settings, makers for multiple platforms, plugins (Webpack, auto-unpack natives), GitHub publishing, and hooks (including a package-after-copy hook).
electron/package.json
package.json
vite/package.json
Updated version numbers and dependency versions. Added new scripts (e.g., release) to invoke publishing and release commands. For electron/package.json, added author details and introduced Flatpak support. The root package.json build script was adjusted to use a new build command, and vite/package.json dependencies were updated to the latest versions.
scripts/sync-version.ts New TypeScript script that reads the version from the root package.json and updates the version in electron/package.json, with file read/write operations and error handling.
tsconfig.json Added the "resolveJsonModule": true compiler option, enabling the import of JSON files as modules in TypeScript.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHubActions as GitHub Actions
    participant OS as Operating System (macOS/Ubuntu/Windows)
    
    Developer->>GitHubActions: Push tag "vX.Y.Z"
    GitHubActions->>GitHubActions: Trigger build-and-release workflow
    GitHubActions->>GitHubActions: Checkout repository
    GitHubActions->>OS: Install Node.js, NPM, Yarn & setup Bun
    Note over OS: For Ubuntu, install Flatpak dependencies
    GitHubActions->>GitHubActions: Install project dependencies via Bun
    GitHubActions->>GitHubActions: Execute release command with GitHub Token
Loading
sequenceDiagram
    participant Runner as User/CI
    participant Root as Root package.json
    participant Electron as Electron/package.json
    participant Sync as sync-version.ts

    Runner->>Sync: Execute sync-version script
    Sync->>Root: Read version value
    Root-->>Sync: Return version (e.g., "0.0.12")
    Sync->>Electron: Update version field with new value
    Electron-->>Sync: Write changes to file
    Sync-->>Runner: Operation complete
Loading

Possibly related PRs

  • CI & Build for Windows, macOS and Linux #3: The changes in the main PR and the retrieved PR are related as both introduce a new GitHub Actions workflow file named build-and-release.yaml to automate the build and release process of the application.

Poem

Hop, hop, hop through lines of code,
I’m a rabbit with updates in load!
Workflows dance on tag-triggered beats,
Versions sync, and the configuration greets.
With packages leaping to newer heights,
Our code garden delights in streamlined bytes!
🐇💻


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48ffcc3 and b44ae54.

📒 Files selected for processing (1)
  • .github/workflows/build-and-release.yaml (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
electron/forge.config.ts (3)

35-35: Consider moving version sync to a pre-build step.

Invoking syncVersion() directly in the config can be convenient but may cause confusion if the file is imported in non-build contexts (e.g., dev tools). A dedicated build or publish script might provide better clarity and control.


37-65: Platform-specific maker configuration appears valid.

These maker entries for Windows (Squirrel), macOS (DMG), and Linux (Flatpak) are configured correctly. If you plan to distribute via other Linux packaging approaches (like AppImage or Snap), consider adding corresponding makers.


87-97: Pre-release mode in GitHub publishing.

The GitHub publisher is configured to produce pre-releases. If you intend stable public releases, consider parameterizing prerelease so it’s only set in specific scenarios.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ea8cb3 and d5e5360.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • .github/workflows/build-and-release.yaml (1 hunks)
  • electron/forge.config.js (0 hunks)
  • electron/forge.config.ts (1 hunks)
  • electron/package.json (1 hunks)
  • package.json (2 hunks)
  • scripts/sync-version.ts (1 hunks)
  • tsconfig.json (1 hunks)
  • vite/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • electron/forge.config.js
🧰 Additional context used
🧬 Code Definitions (1)
electron/forge.config.ts (1)
scripts/sync-version.ts (1) (1)
  • syncVersion (4-29)
🪛 actionlint (1.7.4)
.github/workflows/build-and-release.yaml

26-26: the runner of "actions/setup-node@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (20)
vite/package.json (1)

20-20: Dependency updates look good.

The version updates for dependencies and devDependencies are appropriate and will keep the project up-to-date with the latest bug fixes and improvements.

Also applies to: 23-23, 30-30, 34-44

tsconfig.json (1)

8-9: Good addition for JSON module support.

Adding resolveJsonModule: true is appropriate for enabling JSON imports, which will be needed for the version synchronization utility to properly read and manipulate package.json files.

.github/workflows/build-and-release.yaml (4)

1-12: Workflow configuration looks good.

The workflow is properly configured to trigger on version tags and has the necessary permissions for creating releases.


13-20: Matrix strategy is well-designed.

Running on macOS, Ubuntu, and Windows provides comprehensive cross-platform support for builds.


34-44: Flatpak setup for Linux is appropriate.

The conditional steps for Ubuntu correctly set up the Flatpak environment needed for Linux packaging.


45-51: Build and release steps look good.

Using Bun to install dependencies and run the release command is consistent with the project's setup.

package.json (2)

3-3: Version change noted.

Shifting from 1.0.0 to 0.0.12 suggests adopting a more conservative versioning approach, which is reasonable if the project is still in early development.


13-14: Build and release scripts are appropriate.

The changes to the build script and the addition of the release script align with Electron Forge's conventions and the new CI workflow.

scripts/sync-version.ts (2)

4-29: Version sync function looks good.

The syncVersion function correctly reads the version from the root package.json and updates it in the electron package.json, with proper error handling.


31-34: Direct execution check is appropriate.

Checking for direct script execution allows this utility to be run standalone or imported as a module, providing flexibility.

electron/forge.config.ts (5)

13-19: Simple, clear platform determination.

This helper function correctly encapsulates platform detection.


21-33: Graceful fallback for Git hash retrieval.

The try/catch block ensures consumers don't break if the Git command fails, reverting to the package version in that scenario. This is a sound approach.


66-86: Webpack and auto-unpack native plugins are straightforward.

The Webpack plugin config, devServer overlay setting, and the AutoUnpackNatives plugin usage are properly set up for Electron Forge.


98-119: Synchronous file copy is fine for a build pipeline.

The packageAfterCopy hook synchronously copies static assets, which is acceptable in a controlled build environment. No issues noted.


120-122: Solid export definition.

Exporting the config object as default is aligned with Electron Forge conventions.

electron/package.json (5)

4-4: Minor version bump validated.

The version bump to 0.0.10 is straightforward. Ensure release notes reflect the new changes.


7-11: Author information is well-defined.

Providing clear author details helps end users know who is behind the project.


16-17: New build/release scripts.

Introducing "make" and "release" scripts using Electron Forge is a good step toward automated packaging and publishing workflows.


25-25: Electron Squirrel Startup patch version.

Updating to ^1.0.1 for minor improvements should not introduce breaking changes.


29-36:

Details

❓ Verification inconclusive

Confirm updated devDependencies have no regressions.

Multiple Electron Forge packages are now at ^7.7.0, along with other library version bumps. This is likely safe, but it’s prudent to confirm there are no unexpected changes.

Also applies to: 38-43


🌐 Web query:

Are there any reported breaking changes or regressions in electron-forge 7.7.0 or related packages?

💡 Result:

Electron Forge 7.7.0 and related packages have reported breaking changes and regressions, primarily from user-reported issues and official documentation:

Breaking Changes in Forge 7.x:

  1. Legacy macOS Notarization Removal
    Forge 7 removed support for Apple's deprecated altool for macOS notarization, requiring migration to notarytool[4][9].

  2. Minimum Node.js Version
    Increased to Node.js v16.4.0, dropping support for older versions[4].

  3. Deprecated Package Support
    Dropped compatibility with electron-prebuilt and electron-prebuilt-compile[4].

  4. TypeScript Template Compatibility
    A regression in 7.7.0 causes failures when using extends in tsconfig.json, blocking app startup with errors like "Unable to use specified module loaders for '.ts'"[3]. This affects projects extending base TypeScript configurations.

Reported Regressions:

  • Template Incompatibility
    Users encountered errors like "Template (base) is not compatible with this version of Electron Forge" when using older templates with Forge 7.7.0[17].

  • Experimental Vite Plugin Instability
    The @electron-forge/plugin-vite (used in the Vite template) is marked experimental, with minor versions potentially introducing breaking changes[13][16].

Key Issues Linked to 7.7.0:

Issue Impact Source
electron-forge start fails with extended tsconfig.json Blocks development workflow [GitHub Issue #3883][3]
Template compatibility errors Prevents project initialization [GitHub Issue #3874][17]
Static storage method for auto-updates Requires configuration changes [Electron Blog][4]

For developers upgrading, review the Electron Forge migration guide and test build pipelines thoroughly, especially around TypeScript configurations and macOS code signing[4][6].

Citations:


Action Required: Verify Compatibility of Electron Forge 7.7.0 Updates

The devDependencies have been updated to Electron Forge 7.7.0 across multiple packages. However, version 7.7.0 is known to introduce several breaking changes and regressions. In particular, please ensure that:

  • macOS Notarization: The removal of legacy notarization (using altool) and the migration to notarytool do not disrupt our build/signing process.
  • Node.js Version: Our environment meets the new minimum requirement of Node.js v16.4.0.
  • TypeScript Configuration: If the project extends a base TypeScript configuration (using extends in tsconfig.json), verify that the reported regression (e.g., template initialization errors) does not affect our workflow.
  • Template Compatibility: Check that any template-based setups or initialization steps continue to function correctly, as there are reports of template incompatibility errors.

Please run the full test suite and validate build processes for both the sections in lines 29–36 and 38–43 of electron/package.json before merging.

@iamEvanYT iamEvanYT merged commit c92c3c7 into main Mar 22, 2025
1 check was pending
@iamEvanYT iamEvanYT deleted the evan/build branch March 22, 2025 17:50
@coderabbitai coderabbitai bot mentioned this pull request Apr 30, 2025
@coderabbitai coderabbitai bot mentioned this pull request May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant