Update all non-major dependencies
[ProtonMail-WebClient.git] / applications / pass-desktop / forge.config.js
blobb910c0eda59e723ff8d2a9cc0d7aca401ce42d26
1 const { AutoUnpackNativesPlugin } = require('@electron-forge/plugin-auto-unpack-natives');
2 const { FusesPlugin } = require('@electron-forge/plugin-fuses');
3 const { WebpackPlugin } = require('@electron-forge/plugin-webpack');
4 const { MakerSquirrel } = require('@electron-forge/maker-squirrel');
5 const { MakerZIP } = require('@electron-forge/maker-zip');
6 const { MakerDMG } = require('@electron-forge/maker-dmg');
7 const { MakerDeb } = require('@electron-forge/maker-deb');
8 const { MakerRpm } = require('@electron-forge/maker-rpm');
9 const { FuseV1Options, FuseVersion } = require('@electron/fuses');
10 const mainConfig = require('./webpack.main.config');
11 const rendererConfig = require('./webpack.renderer.config');
12 const path = require('path');
13 const pkg = require('./package.json');
14 const getExtraResource = require('./src/utils/extra-resource');
16 /** @type {import('@electron-forge/shared-types').ForgeConfig} */
17 const config = {
18     packagerConfig: {
19         asar: true,
20         icon: 'assets/logo',
21         extraResource: ['assets', ...getExtraResource()],
22         appBundleId: 'me.proton.pass.electron',
23         executableName: process.platform === 'win32' ? 'ProtonPass' : 'Proton Pass',
24         // required for debian, else MakerDeb will incorrectly use name from package.json
25         name: 'Proton Pass',
26         appCategoryType: 'public.app-category.productivity',
27         osxSign: {},
28         osxNotarize:
29             process.env.CI || process.env.PASS_DESKTOP_NOTARIZE
30                 ? {
31                       appleId: process.env.PASS_DESKTOP_APPLE_ID,
32                       appleIdPassword: process.env.PASS_DESKTOP_APPLE_ID_PASSWORD,
33                       teamId: process.env.PASS_DESKTOP_APPLE_TEAM_ID,
34                   }
35                 : undefined,
36     },
37     rebuildConfig: {},
38     makers: [
39         // Windows
40         new MakerSquirrel({
41             loadingGif: path.join(__dirname, 'assets', 'installSpinner.gif'),
42             iconUrl: path.join(__dirname, 'assets', 'logo.ico'),
43             setupIcon: path.join(__dirname, 'assets', 'logo.ico'),
44             signWithParams: process.env.SQUIRREL_SIGNTOOL_ARGS,
45             setupExe: `ProtonPass_Setup_${pkg.version}.exe`,
46             name: 'ProtonPass',
47             vendorDirectory: `${__dirname}/../../packages/shared/lib/squirrel/assets`,
48         }),
49         // macOS
50         new MakerDMG((arch) => ({
51             name: `ProtonPass_${pkg.version}`,
52             background: path.join(__dirname, 'assets', 'dmg-background.png'),
53             icon: path.join(__dirname, 'assets', 'volume-icon.icns'),
54             contents: () => [
55                 {
56                     x: 150,
57                     y: 180,
58                     type: 'file',
59                     path: `${process.cwd()}/out/Proton Pass-darwin-${arch}/Proton Pass.app`,
60                 },
61                 { x: 350, y: 180, type: 'link', path: '/Applications' },
62             ],
63             additionalDMGOptions: {
64                 window: {
65                     size: {
66                         width: 500,
67                         height: 345,
68                     },
69                 },
70             },
71         })),
72         // ZIP for macOS updates
73         new MakerZIP(
74             {
75                 macUpdateManifestBaseUrl: 'https://proton.me/download/PassDesktop/darwin/universal',
76             },
77             ['darwin']
78         ),
79         // Linux Debian
80         new MakerDeb({
81             name: 'proton-pass',
82             categories: ['Utility'],
83             productName: 'Proton Pass',
84             bin: 'Proton Pass',
85             genericName: 'Password Manager',
86             productDescription: 'Open-source and secure identity manager.',
87             homepage: 'https://proton.me/pass',
88             icon: path.join(__dirname, 'assets', 'logo.svg'),
89             maintainer: 'Proton',
90         }),
91         // Linux Fedora
92         new MakerRpm({
93             name: 'proton-pass',
94             categories: ['Utility'],
95             productName: 'Proton Pass',
96             bin: 'Proton Pass',
97             genericName: 'Password Manager',
98             productDescription: 'Open-source and secure identity manager.',
99             homepage: 'https://proton.me/pass',
100             icon: path.join(__dirname, 'assets', 'logo.svg'),
101         }),
102     ],
103     plugins: [
104         new AutoUnpackNativesPlugin({}),
105         new WebpackPlugin({
106             devContentSecurityPolicy: `default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;`,
107             devServer: {
108                 client: {
109                     overlay: false,
110                 },
111                 liveReload: false,
112             },
113             mainConfig,
114             renderer: {
115                 config: rendererConfig,
116                 entryPoints: [
117                     {
118                         html: './src/app/index.ejs',
119                         js: './src/app/renderer.tsx',
120                         name: 'main_window',
121                         preload: {
122                             js: './src/preload.ts',
123                         },
124                     },
125                 ],
126             },
127         }),
128         new FusesPlugin({
129             version: FuseVersion.V1,
130             // Disables ELECTRON_RUN_AS_NODE
131             [FuseV1Options.RunAsNode]: false,
132             // Enables cookie encryption
133             [FuseV1Options.EnableCookieEncryption]: true,
134             // Disables the NODE_OPTIONS environment variable
135             [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
136             // Disables the --inspect and --inspect-brk family of CLI options
137             [FuseV1Options.EnableNodeCliInspectArguments]: false,
138             // Enables validation of the app.asar archive on macOS
139             [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
140             // Enforces that Electron will only load your app from "app.asar" instead of its normal search paths
141             [FuseV1Options.OnlyLoadAppFromAsar]: true,
142             [FuseV1Options.GrantFileProtocolExtraPrivileges]: true,
143         }),
144     ],
147 module.exports = config;