Building Electron with Electron Builder without downloading packages from github

424 Views Asked by At

I'm trying to build an electron app with electron builder, but I encountered a problem: my network blocks packages from GitHub on downloading.

Is there any other way to disable the look for the packages while online?

the script code:

"electron:admin": "electron-builder -c.extraMetadata.main=build/main.js",

the electron builder part of package.json:

  "build": {
    "extends": null,
    "icon": "build/logo.ico",
    "files": [
      "build/**/*",
      "package.json"
    ],
    "extraFiles": [
      {
        "from": "../database-client.db",
        "to": "./database-client.db",
        "filter": [
          "**/*"
        ]
      },
      {
        "from": "../clientUploads/",
        "to": "./uploads/",
        "filter": [
          "**/*"
        ]
      }
    ],
    "directories": {
      "buildResources": "assets"
    }
  },

I'm building for windows only

I solved that by building the application outside the network and copying the AppData files of electron and electron builder. When I'm building the app I turn down the connection to the internet so the electron builder will not look for the GitHub packages.

I still did not find a way to do that While I'm online.

1

There are 1 best solutions below

0
Sérgio On

is possible with :

_electron_dist=/usr/lib/electron
_electron_ver=$(cat ${_electron_dist}/version)

npm exec -c "electron-builder --linux --dir -c.electronDist=${_electron_dist} -c.electronVersion=${_electron_ver}"