diff options
| author | Oskar <oskar@mullvad.net> | 2024-09-20 16:29:26 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-09-24 13:18:18 +0200 |
| commit | 4bb25616f02af4e15b0140767c07b61e49e8aa83 (patch) | |
| tree | ed5371911d23ba2bab8e701f351d822202d63d57 /gui/tasks | |
| parent | 659aa11f05ae2b278eef6ab0ef5bc537e756109a (diff) | |
| download | mullvadvpn-4bb25616f02af4e15b0140767c07b61e49e8aa83.tar.xz mullvadvpn-4bb25616f02af4e15b0140767c07b61e49e8aa83.zip | |
Fix linting errors
Diffstat (limited to 'gui/tasks')
| -rw-r--r-- | gui/tasks/assets.js | 9 | ||||
| -rw-r--r-- | gui/tasks/distribution.js | 96 | ||||
| -rw-r--r-- | gui/tasks/scripts.js | 4 |
3 files changed, 77 insertions, 32 deletions
diff --git a/gui/tasks/assets.js b/gui/tasks/assets.js index 56b0c7a8ad..8028124180 100644 --- a/gui/tasks/assets.js +++ b/gui/tasks/assets.js @@ -31,7 +31,14 @@ copyHtml.displayName = 'copy-html'; copyLocales.displayName = 'copy-locales'; copyGeoData.displayName = 'copy-geo-data'; -exports.copyAll = parallel(copyStaticAssets, copyConfig, copyCss, copyHtml, copyLocales, copyGeoData); +exports.copyAll = parallel( + copyStaticAssets, + copyConfig, + copyCss, + copyHtml, + copyLocales, + copyGeoData, +); exports.copyStaticAssets = copyStaticAssets; exports.copyCss = copyCss; exports.copyHtml = copyHtml; diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index a7f7c29d6d..0e80c3c73f 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -42,7 +42,7 @@ const config = { name: 'mullvad-vpn', // We have to stick to semver on Windows for now due to: // https://github.com/electron-userland/electron-builder/issues/7173 - version: productVersion(process.platform === 'win32' ? ['semver'] : []) + version: productVersion(process.platform === 'win32' ? ['semver'] : []), }, files: [ @@ -139,23 +139,44 @@ const config = { publisherName: 'Mullvad VPN AB', extraResources: [ { from: distAssets(path.join(getWindowsDistSubdir(), 'mullvad.exe')), to: '.' }, - { from: distAssets(path.join(getWindowsDistSubdir(), 'mullvad-problem-report.exe')), to: '.' }, + { + from: distAssets(path.join(getWindowsDistSubdir(), 'mullvad-problem-report.exe')), + to: '.', + }, { from: distAssets(path.join(getWindowsDistSubdir(), 'mullvad-daemon.exe')), to: '.' }, { from: distAssets(path.join(getWindowsDistSubdir(), 'talpid_openvpn_plugin.dll')), to: '.' }, { - from: root(path.join('windows', 'winfw', 'bin', getWindowsTargetArch() + '-${env.CPP_BUILD_MODE}', 'winfw.dll')), + from: root( + path.join( + 'windows', + 'winfw', + 'bin', + getWindowsTargetArch() + '-${env.CPP_BUILD_MODE}', + 'winfw.dll', + ), + ), to: '.', }, // TODO: OpenVPN does not have an ARM64 build yet. { from: distAssets('binaries/x86_64-pc-windows-msvc/openvpn.exe'), to: '.' }, - { from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'apisocks5.exe')), to: '.' }, - { from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'wintun/wintun.dll')), to: '.' }, { - from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'split-tunnel/mullvad-split-tunnel.sys')), - to: '.' + from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'apisocks5.exe')), + to: '.', + }, + { + from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'wintun/wintun.dll')), + to: '.', + }, + { + from: distAssets( + path.join('binaries', getWindowsTargetSubdir(), 'split-tunnel/mullvad-split-tunnel.sys'), + ), + to: '.', }, { - from: distAssets(path.join('binaries', getWindowsTargetSubdir(), 'wireguard-nt/mullvad-wireguard.dll')), + from: distAssets( + path.join('binaries', getWindowsTargetSubdir(), 'wireguard-nt/mullvad-wireguard.dll'), + ), to: '.', }, { from: distAssets('maybenot_machines'), to: '.' }, @@ -180,7 +201,10 @@ const config = { extraResources: [ { from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-problem-report')), to: '.' }, { from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-setup')), to: '.' }, - { from: distAssets(path.join(getLinuxTargetSubdir(), 'libtalpid_openvpn_plugin.so')), to: '.' }, + { + from: distAssets(path.join(getLinuxTargetSubdir(), 'libtalpid_openvpn_plugin.so')), + to: '.', + }, { from: distAssets(path.join('linux', 'apparmor_mullvad')), to: '.' }, { from: distAssets(path.join('binaries', '${env.TARGET_TRIPLE}', 'openvpn')), to: '.' }, { from: distAssets(path.join('binaries', '${env.TARGET_TRIPLE}', 'apisocks5')), to: '.' }, @@ -197,8 +221,10 @@ const config = { distAssets('linux/before-install.sh'), '--before-remove', distAssets('linux/before-remove.sh'), - distAssets('linux/mullvad-daemon.service') +'=/usr/lib/systemd/system/mullvad-daemon.service', - distAssets('linux/mullvad-early-boot-blocking.service') +'=/usr/lib/systemd/system/mullvad-early-boot-blocking.service', + distAssets('linux/mullvad-daemon.service') + + '=/usr/lib/systemd/system/mullvad-daemon.service', + distAssets('linux/mullvad-early-boot-blocking.service') + + '=/usr/lib/systemd/system/mullvad-early-boot-blocking.service', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad')) + '=/usr/bin/', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-daemon')) + '=/usr/bin/', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-exclude')) + '=/usr/bin/', @@ -228,8 +254,10 @@ const config = { distAssets('linux/before-remove.sh'), '--rpm-posttrans', distAssets('linux/post-transaction.sh'), - distAssets('linux/mullvad-daemon.service') +'=/usr/lib/systemd/system/mullvad-daemon.service', - distAssets('linux/mullvad-early-boot-blocking.service') +'=/usr/lib/systemd/system/mullvad-early-boot-blocking.service', + distAssets('linux/mullvad-daemon.service') + + '=/usr/lib/systemd/system/mullvad-daemon.service', + distAssets('linux/mullvad-early-boot-blocking.service') + + '=/usr/lib/systemd/system/mullvad-early-boot-blocking.service', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad')) + '=/usr/bin/', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-daemon')) + '=/usr/bin/', distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-exclude')) + '=/usr/bin/', @@ -265,7 +293,7 @@ function packWin() { process.env.SETUP_SUBDIR = 'aarch64-pc-windows-msvc'; break; default: - throw new Error(`Invalid or unknown target (only one may be specified)`); + throw new Error('Invalid or unknown target (only one may be specified)'); } return true; }, @@ -279,9 +307,12 @@ function packWin() { for (const artifactPath of buildResult.artifactPaths) { const artifactDir = path.dirname(artifactPath); const artifactSemverFilename = path.basename(artifactPath); - const artifactDesiredFilename = artifactSemverFilename.replace(productSemverVersion, productTargetVersion); + const artifactDesiredFilename = artifactSemverFilename.replace( + productSemverVersion, + productTargetVersion, + ); const targetArtifactPath = path.join(artifactDir, artifactDesiredFilename); - console.log("Moving", artifactSemverFilename, "=>", artifactDesiredFilename); + console.log('Moving', artifactSemverFilename, '=>', artifactDesiredFilename); fs.renameSync(artifactPath, targetArtifactPath); } }, @@ -310,9 +341,8 @@ function packMac() { break; } - process.env.BINARIES_PATH = hostTargetTriple !== process.env.TARGET_TRIPLE - ? process.env.TARGET_TRIPLE - : ''; + process.env.BINARIES_PATH = + hostTargetTriple !== process.env.TARGET_TRIPLE ? process.env.TARGET_TRIPLE : ''; return true; }, @@ -322,8 +352,12 @@ function packMac() { // if they're present for both targets. So make sure we remove libraries for other archs. // Remove the workaround once the issue has been fixed: // https://github.com/electron/universal/issues/41#issuecomment-1496288834 - await fs.promises.rm('node_modules/nseventmonitor/lib/binding/Release', { recursive: true }); - } catch {} + await fs.promises.rm('node_modules/nseventmonitor/lib/binding/Release', { + recursive: true, + }); + } catch { + // noop + } config.beforePack?.(context); }, afterPack: (context) => { @@ -336,13 +370,15 @@ function packMac() { return Promise.resolve(); }, - afterAllArtifactBuild: async (buildResult) => { + afterAllArtifactBuild: async (_buildResult) => { // Remove the folder that contains the unpacked app. Electron builder cleans up some of // these directories and it's changed between versions without a mention in the changelog. for (const dir of appOutDirs) { try { await fs.promises.rm(dir, { recursive: true }); - } catch {} + } catch { + // noop + } } }, afterSign: (context) => { @@ -359,7 +395,7 @@ function packLinux() { } if (targets && targets === 'aarch64-unknown-linux-gnu') { - config.rpm.fpm.unshift('--architecture', 'aarch64') + config.rpm.fpm.unshift('--architecture', 'aarch64'); } return builder.build({ @@ -422,7 +458,7 @@ function getWindowsTargetArch() { if (targets === 'aarch64-pc-windows-msvc') { return 'arm64'; } - throw new Error(`Invalid or unknown target (only one may be specified)`); + throw new Error('Invalid or unknown target (only one may be specified)'); } // Use host architecture (we assume this is x64 since building on Arm64 isn't supported). return 'x64'; @@ -433,7 +469,7 @@ function getWindowsTargetSubdir() { if (targets === 'aarch64-pc-windows-msvc') { return targets; } - throw new Error(`Invalid or unknown target (only one may be specified)`); + throw new Error('Invalid or unknown target (only one may be specified)'); } // Use host architecture (we assume this is x64 since building on Arm64 isn't supported). return 'x86_64-pc-windows-msvc'; @@ -444,7 +480,7 @@ function getLinuxTargetArch() { if (targets === 'aarch64-unknown-linux-gnu') { return 'arm64'; } - throw new Error(`Invalid or unknown target (only one may be specified)`); + throw new Error('Invalid or unknown target (only one may be specified)'); } // Use host architecture. return undefined; @@ -455,7 +491,7 @@ function getLinuxTargetSubdir() { if (targets === 'aarch64-unknown-linux-gnu') { return targets; } - throw new Error(`Invalid or unknown target (only one may be specified)`); + throw new Error('Invalid or unknown target (only one may be specified)'); } return ''; } @@ -489,8 +525,8 @@ function getLinuxVersion() { // Returns the product version. The `args` argument is optional. Set it to `'semver'` // to get the version in semver format. -function productVersion(extra_args) { - const args = ['run', '-q', '--bin', 'mullvad-version', ...extra_args]; +function productVersion(extraArgs) { + const args = ['run', '-q', '--bin', 'mullvad-version', ...extraArgs]; return execFileSync('cargo', args, { encoding: 'utf-8' }).trim(); } diff --git a/gui/tasks/scripts.js b/gui/tasks/scripts.js index 36b9def82d..20acc69c35 100644 --- a/gui/tasks/scripts.js +++ b/gui/tasks/scripts.js @@ -37,7 +37,9 @@ function makeWatchCompiler(onFirstSuccess, onSuccess) { ) { lastBundle = bundle; lastPreloadBundle = preloadBundle; - !wasFirstBuild && onSuccess(); + if (!wasFirstBuild) { + onSuccess(); + } } }), ); |
