Skip to content

Unclear Forge maker config specificity rules #3847

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

Open
3 tasks done
AlexStormwood opened this issue Feb 11, 2025 · 1 comment
Open
3 tasks done

Unclear Forge maker config specificity rules #3847

AlexStormwood opened this issue Feb 11, 2025 · 1 comment
Assignees

Comments

@AlexStormwood
Copy link

AlexStormwood commented Feb 11, 2025

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Forge version

7.6.1

Electron version

34.1.0

Operating system

Windows 11, Linux Mint 22.1 (Ubuntu 24.04)

Last known working Forge version

7.4.0

Expected behavior

Build configuration options for these properties should be respected, with more-specific instances of those options (e.g. maker config objects) overriding the more-generic instances of those options (e.g. packagerConfig properties and package.json properties):

  • name
  • productName
  • executableName
  • title
  • setupExe

Actual behavior

Not all properties mentioned in the "Expected Behaviour" section are on all platforms, but I have encountered this issue on both Maker Deb and Maker Squirrel - completely different platforms. Essentially, a value such as the name declared in the project's package.json is used and a name declared in a maker config or even packager config is ignored.

Steps to reproduce

  1. Make a project - I have this happening on Electron + Vite + TypeScript projects from a template made with this command: npx create-electron-app@latest repro-project --template=vite-typescript
  2. Run the make command to confirm things work with default project settings. npm run make
  3. Add properties to the forge.config.ts file that would be used in place of the package.json file's name value, such as:
// contents of forge.config.ts trimmed for brevity, only providing what was changed:

const config: ForgeConfig = {
  packagerConfig: {
    asar: true,
    name: "repro new name 1",
    executableName: "repro exe name 1",
  },
  rebuildConfig: {},
  makers: [
    new MakerSquirrel({
      exe: "repro exe name 2",
      name: "repro new name 2",
      setupExe:"repro setup name 1",
      title: "repro nuget name 1",

    }), 

// contents after the Squirrel maker cut for brevity
  1. Change the package.json file's productName property as well, for good measure.
{
  "name": "repro-project",
  "productName": "Repro Project Product Name 1",
  "version": "1.0.0",
  "description": "My Electron application description",
// contents cut for brevity, but it's unchanged below the productName line anyway
  1. Run the npm run make command again, and check the output files generated. For example, with the properties used above, my output is (on the left):

Image

  1. Install the made app, and check the installed files to see how else the properties are used:

Image


A repro is attached, but the steps above are it. Behaviour happens to my projects made with the 7.6.1 version of the template on both Linux Mint (Ubuntu) and Windows 11 (no WSL, just Windows).

electron-package-name-repro.zip

Additional information

I wasn't getting this issue ~6 months ago, but I wanted to update and overhaul a couple of Electron projects and moved to the latest version of things... so... the "last working version" may be slightly off, but that's the general time range of changes that I'm looking at.

This issue was also explored a bit here: #3753 (comment)

And some at-a-glance maybe-related issues:

@erickzhao
Copy link
Member

Related as well: #3118

@erickzhao erickzhao self-assigned this Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants