Skip to content
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

Feature request: override configuration per target or allow specifying a platform more than once #8201

Open
mat-sz opened this issue May 4, 2024 · 0 comments

Comments

@mat-sz
Copy link

mat-sz commented May 4, 2024

  • Electron-Builder Version: 25.0.0-alpha.6
  • Node Version: 21.7.3
  • Electron Version: 30.0.1
  • Electron Type (current, beta, nightly): current
  • Target: macOS

I'm trying to build an app with native dependencies that require asarUnpack and to reduce the installer size I'd love to only package the exact dependencies I need.

Currently I have:

{
  "mac": {
    "target": {
      "target": "dmg",
      "arch": ["arm64", "x64"]
    },
    "asarUnpack": ["**/node_modules/sharp/**/*", "**/node_modules/@img/**/*"],
    "artifactName": "${productName}-darwin-${arch}-${version}.${ext}",
    "category": "public.app-category.utilities"
  }
}

I'd propose the structure of the config file to either be changed to something like this:

{
  "platforms": [
    {
      "type": "mac",
      "target": {
        "target": "dmg",
        "arch": "arm64"
      },
      "asarUnpack": ["**/node_modules/sharp/**/*", "**/node_modules/@img/*-arm64/**/*"],
      "artifactName": "${productName}-darwin-${arch}-${version}.${ext}",
      "category": "public.app-category.utilities"
    },
    {
      "type": "mac",
      "target": {
        "target": "dmg",
        "arch": "x64"
      },
      "asarUnpack": ["**/node_modules/sharp/**/*", "**/node_modules/@img/*-x64/**/*"],
      "artifactName": "${productName}-darwin-${arch}-${version}.${ext}",
      "category": "public.app-category.utilities"
    }
  ]
}

...or allowing targets to override other configuration options:

{
  "mac": {
    "target": [
      {
        "target": "dmg",
        "arch": "arm64",
        "asarUnpack": ["**/node_modules/sharp/**/*", "**/node_modules/@img/*-arm64/**/*"],
      },
      {
        "target": "dmg",
        "arch": "x64",
        "asarUnpack": ["**/node_modules/sharp/**/*", "**/node_modules/@img/*-x64/**/*"],
      },
    ],
    "artifactName": "${productName}-darwin-${arch}-${version}.${ext}",
    "category": "public.app-category.utilities"
  }
}

If you're interested, I can contribute a PR to the project with those changes.

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

No branches or pull requests

1 participant