|
| 1 | +const BINARY_PREFIX = 'Insomnia.Core'; |
| 2 | + |
| 3 | +// NOTE: USE_HARD_LINKS |
| 4 | +// https://github.com/electron-userland/electron-builder/issues/4594#issuecomment-574653870 |
| 5 | + |
| 6 | +/** |
| 7 | + * @type {import('electron-builder').Configuration} |
| 8 | + * @see https://www.electron.build/configuration/configuration |
| 9 | + */ |
| 10 | +const config = { |
| 11 | + appId: 'com.insomnia.app', |
| 12 | + protocols: [ |
| 13 | + { |
| 14 | + name: 'Insomnia', |
| 15 | + role: 'Viewer', |
| 16 | + schemes: ['insomnia'], |
| 17 | + }, |
| 18 | + ], |
| 19 | + files: [ |
| 20 | + { |
| 21 | + from: './build', |
| 22 | + to: '.', |
| 23 | + filter: ['**/*', '!opensource-licenses.txt'], |
| 24 | + }, |
| 25 | + './package.json', |
| 26 | + ], |
| 27 | + publish: null, |
| 28 | + afterSign: './scripts/afterSignHook.js', |
| 29 | + extraResources: [ |
| 30 | + { |
| 31 | + from: './bin', |
| 32 | + to: './bin', |
| 33 | + filter: 'yarn-standalone.js', |
| 34 | + }, |
| 35 | + { |
| 36 | + from: './build', |
| 37 | + to: '.', |
| 38 | + filter: 'opensource-licenses.txt', |
| 39 | + }, |
| 40 | + ], |
| 41 | + extraMetadata: { |
| 42 | + main: 'main.min.js', // Override the main path in package.json |
| 43 | + }, |
| 44 | + fileAssociations: [], |
| 45 | + mac: { |
| 46 | + hardenedRuntime: true, |
| 47 | + category: 'public.app-category.developer-tools', |
| 48 | + entitlements: './build/static/entitlements.mac.inherit.plist', |
| 49 | + artifactName: `${BINARY_PREFIX}-\${version}.\${ext}`, |
| 50 | + target: [ |
| 51 | + { |
| 52 | + target: 'dmg', |
| 53 | + arch: 'universal', |
| 54 | + }, |
| 55 | + { |
| 56 | + target: 'zip', |
| 57 | + arch: 'universal', |
| 58 | + }, |
| 59 | + ], |
| 60 | + extendInfo: { |
| 61 | + NSRequiresAquaSystemAppearance: false, |
| 62 | + }, |
| 63 | + }, |
| 64 | + dmg: { |
| 65 | + window: { |
| 66 | + width: 540, |
| 67 | + height: 380, |
| 68 | + }, |
| 69 | + contents: [ |
| 70 | + { |
| 71 | + x: 130, |
| 72 | + y: 186, |
| 73 | + }, |
| 74 | + { |
| 75 | + x: 409, |
| 76 | + y: 186, |
| 77 | + type: 'link', |
| 78 | + path: '/Applications', |
| 79 | + }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + win: { |
| 83 | + target: [ |
| 84 | + { |
| 85 | + target: 'squirrel', |
| 86 | + }, |
| 87 | + { |
| 88 | + target: 'portable', |
| 89 | + }, |
| 90 | + ], |
| 91 | + }, |
| 92 | + squirrelWindows: { |
| 93 | + artifactName: `${BINARY_PREFIX}-\${version}.\${ext}`, |
| 94 | + iconUrl: |
| 95 | + 'https://github.com/kong/insomnia/blob/develop/packages/insomnia-app/app/icons/icon.ico?raw=true', |
| 96 | + }, |
| 97 | + portable: { |
| 98 | + artifactName: `${BINARY_PREFIX}-\${version}-portable.\${ext}`, |
| 99 | + }, |
| 100 | + linux: { |
| 101 | + artifactName: `${BINARY_PREFIX}-\${version}.\${ext}`, |
| 102 | + executableName: 'insomnia', |
| 103 | + synopsis: 'The Collaborative API Client and Design Tool', |
| 104 | + category: 'Development', |
| 105 | + target: [ |
| 106 | + { |
| 107 | + target: 'AppImage', |
| 108 | + }, |
| 109 | + { |
| 110 | + target: 'deb', |
| 111 | + }, |
| 112 | + { |
| 113 | + target: 'tar.gz', |
| 114 | + }, |
| 115 | + { |
| 116 | + target: 'rpm', |
| 117 | + }, |
| 118 | + { |
| 119 | + target: 'snap', |
| 120 | + }, |
| 121 | + ], |
| 122 | + }, |
| 123 | +}; |
| 124 | + |
| 125 | +const { env: { BUILD_TARGETS }, platform } = process; |
| 126 | +const targets = BUILD_TARGETS?.split(','); |
| 127 | +if (platform && targets) { |
| 128 | + console.log('overriding build targets to: ', targets); |
| 129 | + const PLATFORM_MAP = { darwin: 'mac', linux: 'linux', win32: 'win' }; |
| 130 | + config[PLATFORM_MAP[platform]].target = config[PLATFORM_MAP[platform]].target.filter(({ target }) => targets.includes(target)); |
| 131 | +} |
| 132 | +module.exports = config; |
0 commit comments