const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
  packagerConfig: {
    "name": "MyElectronApp", // 应用程序的名称
    "files": [],
    "productName": "My Electron App", // 产品名称（用于生成安装包的名称）
    // "icon": "path/to/icon.png", // 应用程序的图标路径
    "out": "build/", // 输出目录的路径
    "overwrite": true, // 是否覆盖已存在的打包文件
    "asar": true, // 是否使用asar打包格式
    "version": "0.0.1", // 应用程序版本号
    // "copyright": "Copyright © 2023", // 版权信息
    // "ignore": [ // 不需要打包的文件和文件夹的路径列表
    //   ".git",
    //   ".vscode",
    //   "node_modules/.cache",
    //   "src"
    // ],
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {}
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {},
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {},
    },
    // Fuses are used to enable/disable various Electron functionality
    // at package time, before code signing the application
    new FusesPlugin({
      version: FuseVersion.V1,
      [FuseV1Options.RunAsNode]: false,
      [FuseV1Options.EnableCookieEncryption]: true,
      [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
      [FuseV1Options.EnableNodeCliInspectArguments]: false,
      [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
      [FuseV1Options.OnlyLoadAppFromAsar]: true,
    }),
  ],
};
