-
Notifications
You must be signed in to change notification settings - Fork 113
Building
For the time being, you'll have to build BDv2 locally by yourself.
- Node 6.7 or later
Follow these instructions if you want to test how BDv2 would run when it's released to the public, it's also preferred to use this when you're developing a theme or a plugin.
This will also generate a zip archive for the installer.
-
Clone the repository
-
Run
npm ci
andnpm run release
in the root folder
This will delete therelease
directory, including any user data, rebuilds it and copy thenode-sass
bindings -
Download the emote data and move it to
release/data
You can skip this step if you don't need to see the emotes -
Edit
discord_desktop_core/index.js
to contain the followingnew (require('path-to-bd/release').BetterDiscord)(); module.exports = require('./core.asar');
This is usually located at
- for Windows,
%appdata%\discord[channel]\<version>\modules\discord_desktop_core\index.js
- for macOS,
~/Library/Application Support/discord[channel]/<version>/modules/discord_desktop_core/index.js
- for Linux,
~/.config/discord[channel]/<version>/modules/discord_desktop_core/index.js
- for Windows,
To rebuild the release, follow step 2 and 3 again.
Follow these instructions if you're going to set up a development environment for BDv2
-
Clone the repository
-
Run
npm ci
andnpm run build
in the root folder -
Build the
node-sass
bindings by yourself usingnpm run build_node-sass
, or copy the prebuilt bindings fromother/node_sass_bindings
:: Windows copy "other\node_sass_bindings\win32-ia32-53" "node_modules\node-sass\vendor\win32-ia32-53"
# macOS cp -R other/node_sass_bindings/darwin-x64-53 node_modules/node-sass/vendor/darwin-x64-53 # Linux cp -R other/node_sass_bindings/linux-x64-53 node_modules/node-sass/vendor/linux-x64-53
-
Download the emote data and move it to
tests/data
You can skip this step if you don't need to see the emotes -
There's 3 ways that you can take, the first one by using the inject script and the second and third one being manual injection.
Run
npm run inject
in the root folder
If you want to install to other release channels likPTB and Canary as well, you can runnpm run inject ptbor
npm run inject canary`The script injects the same way as the instructions below for injecting through local
-
Navigate to the
resources
folder and create a new folder calledapp
This is usually located at
- for Windows,
%localappdata%\Discord[channel]\app-<version>\resources
- for Windows,
-
Inside the folder, create the following files
-
package.json
{ "name": "betterdiscord", "description": "BetterDiscord", "main": "index.js", "private": true, "dependencies": {} }
-
index.js
const path = require('path'); const Module = require('module'); const electron = require('electron'); const basePath = path.join(__dirname, '..', 'app.asar'); const pkg = require(path.join(basePath, 'package.json')); electron.app.getAppPath = () => basePath; Module._load(path.join(basePath, pkg.main), null, true); electron.app.on('ready', () => {new (require('path-to-bd/core').BetterDiscord)();});
-
Edit
discord_desktop_core/index.js
to contain the followingnew (require('path-to-bd/core').BetterDiscord)(); module.exports = require('./core.asar');
This is usually located at
- for Windows,
%appdata%\discord[channel]\<version>\modules\discord_desktop_core\index.js
- for macOS,
~/Library/Application Support/discord[channel]/<version>/modules/discord_desktop_core/index.js
- for Linux,
~/.config/discord[channel]/<version>/modules/discord_desktop_core/index.js
-
To rebuild all, run npm run build
To watch the core, run npm run watch_core
To watch the client, run npm run watch_client
To watch the CSS Editor, ruun npm run watch_csseditor
Core rebuilds requires a full Discord restart, while client and CSS Editor you only need to reload Discord by pressing Ctrl/Cmd + R
While building, it might throw an error saying that node-sass
is missing the necessary bindings, in that case, you need to download the following files.
- for Windows,
- for macOS,
- for Linux,
Once downloaded, make a folder in node_modules/node-sass/vendor
with a name based on the binding file, for example win32-x64-64
from win32-x64-64_binding.node
, then move the binding file over and rename it to binding.node