-
Notifications
You must be signed in to change notification settings - Fork 113
Building
In order to use BDv2 yourself, you will for the time being have to build it yourself locally.
Discord Canary was updated to Electron v2.0.0 (was 1.6.15). If you're using Discord Canary use the node-sass bindings from here (darwin-x64-57, linux-x64-57 or win32-ia32-57) instead ofother/node_sass_bindings
. You probably already have these if you're using Node.js v8 on macOS/Linux.
Follow these instructions to set up a development environment for BDv2. If you just want to test it or write plugins/themes, go to the release section.
-
Clone the repo/your fork.
-
Run
npm install
andnpm run build
in the root of the repo. -
Build the node-sass binding or copy the prebuilt binding from
other/node_sass_bindings
. To build the binding for Electron 1.6 on your OS and move them to the correct location runnpm run build_node-sass
. Or run the command for your OS to copy the prebuilt bindings to the correct location:# 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
:: Windows copy "other\node_sass_bindings\win32-ia32-53" "node_modules\node-sass\vendor\win32-ia32-53"
-
Download the emote data from https://github.com/JsSucks/BetterDiscordApp/releases/tag/emotedb and move it to
tests/data
. You can skip this step if you don't want to see emotes.# macOS and Linux wget https://github.com/JsSucks/BetterDiscordApp/releases/download/emotedb/emotes.zip unzip emotes.zip mkdir -p tests/data mv emotes.json tests/data/emotes.json rm emotes.zip
-
Edit
discord_desktop_core/index.js
to contain the following:new (require('path-to-bd-fork/core').BetterDiscord)(); module.exports = require('./core.asar');
For the stable Discord client release, this file is located at
%APPDATA%\discord\0.0.301\modules\discord_desktop_core\index.js
on Windows,~/Library/Application Support/discord/0.0.251/modules/discord_desktop_core/index.js
on macOS and~/.config/discord/0.0.5/modules/discord_desktop_core/index.js
on Linux.OR
-
Navigate to the resources folder* and create a new folder called
app
5-1. Inside the folder create a new filepackage.json
with the following contents{ "name": "betterdiscord", "description": "BetterDiscord", "author": "Jiiks", "version": "2.0.0a", "homepage": "https://betterdiscord.net", "license": "MIT", "main": "index.js", "contributors": [ "Jiiks", "Pohky" ], "repository": { "type": "git", "url": "https://github.com/JsSucks/BetterDiscordApp.git" } "dependencies": {} }
5-2. Also create an index.js
file with the following contents
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); new (require('path-to-bd-fork/core').BetterDiscord)();
5-3 (temporarily). In core/src/main.js change BetterDiscord.hookSessionRequest()
to electron.app.on('ready', BetterDiscord.hookSessionRequest);
and change the import from import { BrowserWindow, dialog, session } from 'electron';
to import electron, { BrowserWindow, dialog, session } from 'electron';
*For the stable Discord client release, this file is located at `%localappdata%\Discord\app-0.0.301\resources` on Windows.
To rebuild the core and the client and CSS editor bundles, run npm run build
in the root of the repo.
To watch the core, run npm run watch_core
in the root of the repo.
To watch the client, run npm run watch_client
in the root of the repo.
To watch the CSS editor, run npm run watch_csseditor
in the root of the repo.
Core rebuild requires full Discord restart. Client and CSS editor bundles can be reloaded with Ctrl + R
(Windows and Linux) or Cmd + R
(macOS).
Follow these instructions if you want to test BDv2 exactly how it will run when released. Use this if you're developing plugins and/or themes. This will also generate a package for the installer (release/full.zip
).
- Clone the repo.
- Run
npm install
andnpm run release
in the root of the repo. This will delete therelease
directory, including any user data, rebuild it and copy the node-sass bindings. - Download the emote data from https://github.com/JsSucks/BetterDiscordApp/releases/tag/emotedb and move it to
release/data
. You can skip this step if you don't want to see emotes.# macOS and Linux wget https://github.com/JsSucks/BetterDiscordApp/releases/download/emotedb/emotes.zip unzip emotes.zip # Run this after building the release mkdir -p release/data cp emotes.json release/data/emotes.json
- Edit
discord_desktop_core/index.js
to contain the following:For the stable Discord client release, this file is located atnew (require('path-to-bd-fork/release').BetterDiscord)(); module.exports = require('./core.asar');
%APPDATA%\Roaming\discord\0.0.301\modules\discord_desktop_core\index.js
on Windows,~/Library/Application Support/discord/0.0.251/modules/discord_desktop_core/index.js
on macOS and~/.config/discord/0.0.5/modules/discord_desktop_core/index.js
on Linux.
To rebuild the release, follow steps 2 and 3 again.