electron-vue 配置文件详解

一、配置文件

{
  "name": "test-demo", // 项目名称
  "version": "0.0.1", // 版本号,打包后setup版本号同此
  "author": "mingmei <1249064106@qq.com>",
  "description": "An electron-vue project",
  "license": null, // 如有许可证文件,可添加文件路径
  "main": "./dist/electron/main.js",
  "scripts": {
    "build": "node .electron-vue/build.js && electron-builder",
    "build:dir": "node .electron-vue/build.js && electron-builder --dir",
    "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
    "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
    "dev": "node .electron-vue/dev-runner.js",
    "pack": "npm run pack:main && npm run pack:renderer",
    "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
    "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
    "postinstall": ""
  },
  "build": {
    "productName": "test-demo", // 项目名,也是打包后安装包前缀名
    "appId": "com.test.app", // 包名
    "copyright":"xxxx",// 可在此处添加版权信息
    "directories": { // 输出文件夹
      "output": "build" // 打包文件输出位置
    },
    "files": [
      "dist/electron/**/*"
    ],
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "mac": {
      "icon": "build/icons/icon.icns"
    },
    "win": {
      "icon": "build/icons/icon.ico",  //app图标
      "artifactName": "${productName}_setup_${version}.${ext}",
      "target": [
        {
          "target": "nsis", // 目标为 nsis配置文件
          "arch": [
            "x64"  //打包文件适用系统
          ]
        }
      ]
    },
    "linux": {
      "icon": "build/icons"
    },
    "nsis": {
      "oneClick": false,  // oneClick: 是否可以一键安装,若需自定义安装路径,此处为false
      "allowElevation": true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。
      "allowToChangeInstallationDirectory": true, // 允许修改安装路径
      "installerIcon": "./build/icons/icon.ico",// 安装图标
      "uninstallerIcon": "./build/icons/icon.ico", // 卸载图标
      "installerHeaderIcon": "./build/icons/icon.ico", // 安装时的头部图标
      "createDesktopShortcut": true, // 创建桌面快捷键
      "createStartMenuShortcut": true,// 创建开始菜单图标
      "shortcutName":"zero-desktop" //快捷键名称
      "include": "build/script/installer.nsh", // 若有自定义nsis脚本,可添加,没有则省略此句    
    },
    "publish": [
      {
        "provider": "generic", // 服务器提供商
        "url": "http://xxxxx/" // 服务器地址,根据实际情况添加
      }
    ],
  },
  "dependencies": {
    "axios": "^0.18.0",
    "multispinner": "^0.2.1",
    "vue": "^2.5.16",
    "vue-electron": "^1.0.6",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1",
    "vuex-electron": "^1.0.0"
  },
  "devDependencies": {
    "ajv": "^6.5.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "babel-minify-webpack-plugin": "^0.3.1",
    "cfonts": "^2.1.2",
    "chalk": "^2.4.1",
    "copy-webpack-plugin": "^4.5.1",
    "cross-env": "^5.1.6",
    "css-loader": "^0.28.11",
    "del": "^3.0.0",
    "devtron": "^1.4.0",
    "electron": "^2.0.4",
    "electron-debug": "^1.5.0",
    "electron-devtools-installer": "^2.2.4",
    "electron-builder": "^20.19.2",
    "mini-css-extract-plugin": "0.4.0",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.2.0",
    "listr": "^0.14.3",
    "node-loader": "^0.6.0",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "vue-html-loader": "^1.2.4",
    "vue-loader": "^15.2.4",
    "vue-style-loader": "^4.1.0",
    "vue-template-compiler": "^2.5.16",
    "webpack-cli": "^3.0.8",
    "webpack": "^4.15.1",
    "webpack-dev-server": "^3.1.4",
    "webpack-hot-middleware": "^2.22.2",
    "webpack-merge": "^4.1.3"
  }
}

安装包及快捷方式:
在这里插入图片描述
开始菜单图标
在这里插入图片描述

Logo

前往低代码交流专区

更多推荐