1

我正在使用 electron builder 打包应用程序并在 github 私有存储库上发布,还实现了 electron-updater 在后台自动更新应用程序,一切正常。

但问题是每次我使用以下脚本在 github 上发布应用程序时

"scripts": {
      "deploy": "electron-builder --config=electron-builder.yml build --win --x64 --ia32 --publish always" 
 },

电子生成器配置文件

directories:
  output: dist
  buildResources: build

nsis:
  allowToChangeInstallationDirectory: true
  oneClick: false
  perMachine: false
  deleteAppDataOnUninstall: true
  license: ./license.txt

win:
  target:
    - target: nsis
  icon: ./icons/logo.png   
  
mac:
  icon: ./icons/icon.icns
  target:
    - target: dmg
    - target: zip

  hardenedRuntime: true
  gatekeeperAssess: false
  entitlements: build/macos/entitlements.mac.plist
  entitlementsInherit: build/macos/entitlements.mac.plist

dmg:
  sign: false

linux:  
  target:
    - target: deb
    - target: tar.gz
    - target: snap 

asar: true
buildDependenciesFromSource: true
compression: store

publish:
  provider: github
  token: xxxxxxxxxxxxxxxxxxxxxxxxxxx
  releaseType: release

包笼.json

{
  "name": "testapp",
  "productName": "testapp",
  "version": "0.0.1",
  "description": "My Electron application description",
  "main": "src/main.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\"",
    "clean": "npm cache clean --force",
    "build": "electron-builder --config=electron-builder.yml build --win --x64 --ia32 --publish never",
     "deploy": "electron-builder --config=electron-builder.yml build --win --x64 --ia32 --publish always",
    "postinstall": "electron-builder install-app-deps"
  },
  "repository": {
    "type": "git",
    "url": "repourl"
  },
  "keywords": [],
  "author": {
    "name": "name",
    "email": "emailid"
  },
  "license": "MIT",
  "build": {
    "appId": "appid",
    "category": "Business",
    "publish": [
      {
        "provider": "github",
        "private": true,
        "owner": "user",
        "repo": "reponmae"
      }
    ]
  },
  "config": {
    "forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "DesktopDMS"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
    }
  },
  "dependencies": {
    "@progress/kendo-ui": "^2020.2.617", //i know kendo and synfusion UI packages increasing app size
    "@syncfusion/ej2": "^18.1.59",
    "axios": "^0.19.2",    
    "electron-json-storage": "^4.2.0",
    "electron-updater": "^4.3.5",
    "jquery": "^3.5.1",
    "jsrender": "^1.0.6",
    "material-datetime-picker": "^2.4.0",
    "materialize-css": "^1.0.0-rc.2"
  },
  "devDependencies": {
    "@electron-forge/cli": "^6.0.0-beta.52",
    "@electron-forge/maker-deb": "^6.0.0-beta.51",
    "@electron-forge/maker-rpm": "^6.0.0-beta.51",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.51",
    "@electron-forge/maker-zip": "^6.0.0-beta.51",
    "electron": "9.0.4",
    "electron-builder": "^22.8.0",
  }
}

电子生成器总是创建具有相同大小的新包/安装程序/应用程序[在 250-300MB 之间],电子更新程序正在下载应用程序的更新版本。

那么我怎样才能减少渐进式发布的大小[或仅发布修改后的模块/文件],因为每次下载完整的应用程序都非常令人沮丧。

我尝试过压缩[没有太大区别]并删除了一些未使用的软件包。据我所知, VS Code/Zoom/Slack正在管理这种情况,但我不知道如何。

我需要一些帮助/指导来实现它。提前致谢。

4

0 回答 0