Electron Forge packaging configuration not working
Asked Answered
M

0

7

I am trying to package my app with electron-forge package using the following configuration:

"config": {
  "forge": {
    "make_targets": {
      "linux": [
        "deb"
      ],
      "win32": [
        "squirrel"
      ]
    },
    "electronPackagerConfig": {
      "asar": false,
      "dir": "./src",
      "platform": [
        "linux",
        "win32"
      ],
      "arch": [
        "ia32",
        "x64"
      ],
      "ignore": [
        ".idea"
      ]
    }
  }
}

The version of electron-forge I am using is 3.0.1.

Only the values asar and ignore are recognized, while dir, platform and arch are ignored. I do not see an error and would highly appreciate help, a hint or a link to any working example.


Update:

It has since been suggested here to use the command line for providing these options.

While

electron-forge package --arch=ia32,x64 --platform=win32,linux

does package the app for all the specified systems, although the output looks like this:

✔ Checking your system
✔ Preparing to Package Application for arch: ia32,x64
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
✔ Preparing to Package Application for arch: armv7l <-- ???
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application

It does not seems to actually be packaging the app for the armv7l architecture as it says there, I think that this is just a bug with the console output, the results in the output directory look good.

Anyway.. providing the packaging options via command line does not solve my initial problem, because I still can not specify the dir option for electron-packer that way. So, while the documentation for electronPackagerConfig suggests all options for electron-packer can be set with this configuration object:

This config object provides options directly to electron-packager, the tool we use to package your app behind the scenes.

And while electron-forge package --help says I can set the current working directory after the options:

Usage: electron-forge-package [options] [cwd]

Which is actually not the case, this just simply sets the out directory where everything is written to.

I am still stuck with this. Is there any way to provide the dir option via electron-forge? If not, my suggestion to the developers of electron-forge would be to implement the configuration for this in a way that makes my initial configuration from above work, because I think this is an intuitive way to configurate these parameters, using the command line to override them could still be an option, I guess.

Mccahill answered 24/5, 2017 at 1:24 Comment(1)
Since my problem with all this is that unwanted directories get packaged into the final app, I am currently using ignore as a workaround. This is not really a satisfying solution, as I want to set all options for electron-packager with the corresponding configuration object (i.e. electronPackagerConfig), especially the dir option for the source directory, but for now I will just stick with ignore until a better solution arrives.Mccahill

© 2022 - 2024 — McMap. All rights reserved.