Electron build and archive (at the same time)


#1

Hi, everyone.

I’m pretty new to electron so I’m not sure if this is possible. I’m using electron-packager to build and asar to archive. Is it possible to build the application and archive it (create asar file and not app folder) in the same script so that I don’t have to run two commands and then go delete the /resources/app folder afterwards?

If it’s not possible how would I go about archiving for multiple platforms and architectures? Should I just create an archive script for each platform?

Here’s what my package json looks like:

    {
      "name": "appname",
      "version": "1.0.0",
      "description": "The app's description",
      "main": "main.js",
      "author": "Derek Crosson",
      "license": "MIT",
      "scripts": {
        "start": "electron .",
        "build": "electron-packager . ElectronBasic --platform=win32 --arch=x64 --overwrite",
        "archive": "asar pack ElectronBasic-win32-x64/resources/app ElectronBasic-win32-x64/resources/app.asar"
      },
      "devDependencies": {
        "asar": "^0.11.0",
        "electron-packager": "^7.3.0",
        "electron-prebuilt": "^1.2.7"
      }
    }