bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
308 stars 82 forks source link

Cant generate a single universal build #238

Open andirsun opened 11 months ago

andirsun commented 11 months ago

Describe the bug A clear and concise description of what the bug is. I am trying to generate a single universal build for my application, I can do it with electron builder configuration but since I am using the nx-electron plugin and maker.options.json for some reason two builds are generated:

This is my maker.options.json file

{
  "$schema": "../../../../../node_modules/nx-electron/src/validation/maker.schema.json",
  "asar": true,
  "generateUpdatesFilesForAllChannels": true,
  "appId": "com.webalys.streamline",
  "productName": "Streamline",
  "copyright": "Copyright © 2023 Webalys",
  "afterSign": "apps/streamline-desktop/src/utils/notarize.js",
  "artifactName": "${productName}.${ext}",
  "protocols": [
    {
      "name": "electron-deep-linking",
      "schemes": ["streamline"]
    }
  ],
  "mac": {
    "icon": "apps/streamline-desktop/src/assets/icons/icon.icns",
    "hardenedRuntime": true,
    "entitlements": "apps/streamline-desktop/src/utils/entitlements.mac.inherit.plist",
    "category": "public.app-category.utilities",
    "singleArchFiles": "*",
    "target": [
      {
        "target": "dmg",
        "arch": ["universal"]
      }
    ]
  },
  "dmg": {
    "backgroundColor": "#ffffff",
    "writeUpdateInfo": false,
    "window": {
      "width": 400,
      "height": 300
    },
    "contents": [
      {
        "x": 100,
        "y": 100
      },
      {
        "x": 300,
        "y": 100,
        "type": "link",
        "path": "/Applications"
      }
    ]
  },
  "publish": [
    {
      "provider": "github",
      "releaseType": "release"
    }
  ]
}

And this is the build process.

❯ npm run pack:desktop  

> streamline-mono@5.0.0 pack:desktop
> nx run streamline-desktop:make --publishPolicy=never

> nx run streamline-desktop:make --publishPolicy=never

*********************************************************
DO NOT FORGET TO REBUILD YOUR FRONTEND & BACKEND PROJECTS
FOR PRODUCTION BEFORE PACKAGING / MAKING YOUR ARTIFACT!
*********************************************************
  • electron-builder  version=23.6.0 os=23.0.0
  • writing effective config  file=dist/executables/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=@parcel/watcher@2.0.4 platform=darwin arch=arm64
  • packaging       platform=darwin arch=arm64 electron=25.2.0 appOutDir=dist/executables/mac-arm64
  • signing         file=dist/executables/mac-arm64/Streamline.app identityName=Developer ID Application: Webalys, LLC (U7XNJG59LL) identityHash=D67BA83C59353EA2BB7501103EB25119DCBDF921 provisioningProfile=none
⏭️ Skipping notarization: PRODUCTION enviroment is needed
  • building        target=macOS zip arch=arm64 file=dist/executables/Streamline.zip
  • building        target=DMG arch=arm64 file=dist/executables/Streamline.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • rebuilding native dependencies  dependencies=@parcel/watcher@2.0.4 platform=darwin arch=x64
  • packaging       platform=darwin arch=x64 electron=25.2.0 appOutDir=dist/executables/mac-universal--x64
  • rebuilding native dependencies  dependencies=@parcel/watcher@2.0.4 platform=darwin arch=arm64
  • packaging       platform=darwin arch=arm64 electron=25.2.0 appOutDir=dist/executables/mac-universal--arm64
  • packaging       platform=darwin arch=universal electron=25.2.0 appOutDir=dist/executables/mac-universal
  • signing         file=dist/executables/mac-universal/Streamline.app identityName=Developer ID Application: Webalys, LLC (U7XNJG59LL) identityHash=D67BA83C59353EA2BB7501103EB25119DCBDF921 provisioningProfile=none
⏭️ Skipping notarization: PRODUCTION enviroment is needed
  • building        target=DMG arch=universal file=dist/executables/Streamline.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • building block map  blockMapFile=dist/executables/Streamline.zip.blockmap

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target make for project streamline-desktop (7m)

         With additional flags:
           --publishPolicy=never

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I dont need to always generate arm64 builds

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

ja-klaudiusz commented 6 months ago

Did you manage to figure out how to generate this build? I am trying to generate a .dmg file, but only a .app file is being generated.

maker.options.json:

 {
 "dmg": {
    "window": {
      "width": 660,
      "height": 400
    },
    "contents": [
      {
        "x": 110,
        "y": 150
      },
      {
        "x": 240,
        "y": 150,
        "type": "link",
        "path": "/Applications"
      }
    ]
  },
  "mac": {
    "category": "public.app-category.social-networking",
    "icon": "apps/desktop/src/app/options/resources/icon.icns",
    "target": ["zip", "dmg"],
    "minimumSystemVersion": "10.10",
    "hardenedRuntime": true,
    "entitlements": "apps/desktop/entitlements.plist",
    "entitlementsInherit": "apps/desktop/entitlementsInherit.plist"
  }
}

and my commands:

nx build desktop-client 
nx build desktop
nx run desktop:package

Desktop:

OS: Mac Os 14 Nx Electron Version ^17.0.1

andirsun commented 6 months ago

@ja-klaudiusz Did you try using :make instead of package ?

ja-klaudiusz commented 6 months ago

@andirsun Yes, I tried. But either I didn't notice that it goes into /dist/executables or it wasn't working before the Xcode update... Anyway, after updating Xcode, make: actually works.