如何最好地在电子

时间:2018-01-26 10:22:06

标签: package electron production

我一直在努力创建一个依赖第三方可执行文件的电子应用程序。每当我尝试捆绑应用程序时,可执行文件都会以asar格式与应用程序的其余部分捆绑在一起,从而无法从电子\节点环境外部访问。

我的问题是我应该如何设置环境或构建配置以实现第三方可执行文件位于已安装应用程序根目录的安装?

PS:我正在使用电子制作工具和两个package.json格式,我得到了一个 成功建立减去这个警告。

这是我的构建配置

"build": {
    "appId": "com.toutici.asd",
    "asar": true,
    "directories": {
      "app": "./app",
      "buildResources": "./build",
      "output": "./dist"
    },
    "electronDownload": {
      "cache": ".electron",
      "verifyChecksum": true
    },
    "electronVersion": "1.7.11",
    "fileAssociations": {
      "ext": "asd",
      "icon": "./www/assets/icon/win/icon.ico"
    },
    "productName": "Android SMS Delimiter",
    "mac": {
      "category": "public.app-category.productivity",
      "target": [
        "dmg",
        "mas"
      ],
      "icon": "./build/icon.icns"
    },
    "dmg": {
      "contents": [
        {
          "x": 110,
          "y": 150
        },
        {
          "x": 240,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "deb": {
      "compression": "gz",
      "icon": "./build/background.png"
    },
    "linux": {
      "target": [
        "AppImage",
        "apk",
        "deb",
        "rpm",
        "snap",
        "tar.gz",
        "zip"
      ]
    },
    "win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "ia32"
          ]
        }
      ],
      "icon": "build/icon.ico"
    },
    "nsis": {
      "oneClick": true,
      "perMachine": true,
      "allowElevation": true,
      "allowToChangeInstallationDirectory": false,
      "createDesktopShortcut": true,
      "runAfterFinish": true,
      "installerIcon": "./build/icon.ico"
    },
    "portable": {
      "requestExecutionLevel": "user"
    },
    "squirrelWindows": {
      "iconUrl": "./build/icon.ico",
      "loadingGif": "./build/install-spinner.gif",
      "msi": true
    }
  }

1 个答案:

答案 0 :(得分:1)

添加

  

extraFiles

electron-builder.json

config属性似乎可以解决问题。

例如:

updateSelectInput

另请参阅电子配置文档:https://www.electron.build/configuration/contents#extrafiles