From 69018610b6307a666b4837e709cf39d664f7201f Mon Sep 17 00:00:00 2001 From: dperolio Date: Sun, 27 Feb 2022 19:17:11 -0500 Subject: [PATCH] remove discord development from setup options and clean it up a bit --- renderer/src/setup/index.js | 38 ++++++++++------------------ renderer/src/setup/webpack.config.js | 7 +++-- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/renderer/src/setup/index.js b/renderer/src/setup/index.js index e477e3cb..6174f0ea 100644 --- a/renderer/src/setup/index.js +++ b/renderer/src/setup/index.js @@ -131,7 +131,7 @@ async function promptManualPathCompletion (action) { } if (!discordAppPath || !(await confirmExistAndHasPermissions(discordAppPath))) { - error(`${release}'s app directory couldn't be located and ${responses.action}ion has been cancelled.`); + error(`${release}'s app directory couldn't be located and ${action}ion has been cancelled.`); return promptForRestartOrExit(); } @@ -179,8 +179,7 @@ async function getDiscordAppPath () { * Get the latest version's folder. Then find and return the app directory path. */ const latestVersionDirectory = discordDirectory.filter(path => path.startsWith('app-')).sort().reverse()[0]; - const discordAppPath = join(discordPath, latestVersionDirectory, 'resources', 'app'); - return discordAppPath; + return join(discordPath, latestVersionDirectory, 'resources', 'app'); /** * Mac */ @@ -192,8 +191,7 @@ async function getDiscordAppPath () { return promptManualPathCompletion('inject'); } - const discordAppPath = join(discordPath, 'Contents', 'Resources', 'app'); - return discordAppPath; + return join(discordPath, 'Contents', 'Resources', 'app'); } /** @@ -228,14 +226,12 @@ async function getDiscordAppPath () { return promptManualPathCompletion('inject'); } - const discordAppPath = join(discordPath, 'resources', 'app'); - return discordAppPath; + return join(discordPath, 'resources', 'app'); } const discordPath = discordProcess[4].split('/'); discordPath.splice(discordPath.length - 1, 1); - const discordAppPath = join('/', ...discordPath, 'resources', 'app'); - return discordAppPath; + return join('/', ...discordPath, 'resources', 'app'); } /** @@ -245,13 +241,13 @@ async function getDiscordAppPath () { */ function installDependencies () { return new Promise((resolve, reject) => { - const command = spawn('npm', [ 'install', '--only=production', '--silent' ], { cwd: join(__dirname, '..', '..', '..'), stdio: 'inherit', shell: true }); - command.on('close', () => { - resolve(); - }); - command.on('error', err => { - reject(err); + const command = spawn('npm', [ 'install', '--only=production', '--silent' ], { + cwd: join(__dirname, '..', '..', '..'), + stdio: 'inherit', + shell: true }); + command.on('close', () => resolve()); + command.on('error', err => reject(err)); }); } @@ -471,8 +467,7 @@ async function startInjectionProcess () { choices: wrapChoicesInColor([ 'Discord Stable', 'Discord PTB', - 'Discord Canary', - 'Discord Development' + 'Discord Canary' ]) }, { @@ -484,8 +479,7 @@ async function startInjectionProcess () { choices: wrapChoicesInColor([ 'Discord Stable', 'Discord PTB', - 'Discord Canary', - 'Discord Development' + 'Discord Canary' ]) }, { @@ -497,8 +491,7 @@ async function startInjectionProcess () { choices: wrapChoicesInColor([ 'Discord Stable', 'Discord PTB', - 'Discord Canary', - 'Discord Development' + 'Discord Canary' ]) } ]); @@ -519,9 +512,6 @@ async function startInjectionProcess () { case release.includes('Canary'): release = 'Discord Canary'; break; - case release.includes('Development'): - release = 'Discord Development'; - break; } switch (true) { case action.includes('Inject'): diff --git a/renderer/src/setup/webpack.config.js b/renderer/src/setup/webpack.config.js index 1f49cbe4..d0c6f277 100644 --- a/renderer/src/setup/webpack.config.js +++ b/renderer/src/setup/webpack.config.js @@ -1,7 +1,7 @@ const TerserPlugin = require('terser-webpack-plugin'); const { resolve } = require('path'); -module.exports = () => ({ +module.exports = (_env, _argv) => ({ mode: 'production', target: 'node', entry: './renderer/src/setup/index.js', @@ -13,11 +13,14 @@ module.exports = () => ({ extensions: [ '.js' ] }, optimization: { - minimize: true, minimizer: [ new TerserPlugin({ extractComments: false, terserOptions: { + keep_classnames: true, + compress: { + drop_debugger: false + }, format: { comments: false }