Skip to content

Commit

Permalink
Fix build and add instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
zerebos committed Mar 18, 2021
1 parent 847ef94 commit 1312bca
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 22 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,16 @@ See this [gist](https://gist.github.com/ObserverOfTime/d7e60eb9aa7fe837545c8cb77
6. Move the `app` folder (the one you downloaded and renamed) inside of `Resources`.
7. Fully quit Discord and restart it.

## Local Installation
## Development Installation

By default BD loads majority of the package through a CDN at runtime so you always have the latest version. However, if you'd rather only load something from your PC and update when you want, you can do that too!
For normal users, installing via the installers makes the most sense. However when wanting to either develop BetterDiscord, or when the installers do not work, this option can be used.

**Prerequisites**: [Node.js](https://nodejs.org/en/) 12.x+ and the package manager [npm](https://www.npmjs.com/).

1. Clone this repository `git clone https://github.com/rauenzi/BetterDiscordApp.git`
2. Install dependencies with `npm install`
3. Build both the JavaScript and CSS bundles with `npm run deploy` this will create a `style.css` and `remote.js` in the `dist` folder.
4. Follow the steps for [manual installation](#manual-installation) from before.
5. Inside the `app` folder you created as a part of that process, find the file `betterdiscord\config.json`
6. Edit the file and change the value of `local` to `true` and change the `localPath` value to match the <u>absolute</u> path of the `dist` folder from step 3.
7. Fully quit Discord and restart it.
3. Build both the Injector and Renderer bundles with `npm run build` this will create a `injector.js`, `preload.js`, and `renderer.js` in the `dist` folder.
4. Run the inject script to inject the local files into your Discord client (`npm run inject`). Alternately install it to non-stable using `npm run inject canary`.

# FAQ

Expand Down
195 changes: 195 additions & 0 deletions injector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions injector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"main": "src/index.js",
"private": true,
"scripts": {
"build": "cp ./src/preload.js ../dist/preload.js && webpack --progress --color",
"watch": "cp ./src/preload.js ../dist/preload.js && webpack --progress --color --watch",
"build-prod": "cp ./src/preload.js ../dist/preload.js && webpack --stats minimal --mode production",
"build": "webpack --progress --color",
"watch": "webpack --progress --color --watch",
"build-prod": "webpack --stats minimal --mode production",
"lint": "eslint --ext .js src/"
},
"devDependencies": {
"circular-dependency-plugin": "^5.2.2",
"copy-webpack-plugin": "^8.0.0",
"eslint": "^7.21.0",
"webpack": "^5.24.2",
"webpack-cli": "^4.5.0"
Expand Down
9 changes: 9 additions & 0 deletions injector/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const TerserPlugin = require("terser-webpack-plugin");

Expand Down Expand Up @@ -32,6 +33,14 @@ module.exports = (env, argv) => ({
new CircularDependencyPlugin({
exclude: /node_modules/,
cwd: process.cwd(),
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, "src", "preload.js"),
to: path.resolve(__dirname, "..", "dist", "preload.js")
},
],
})
],
optimization: {
Expand Down
Loading

0 comments on commit 1312bca

Please sign in to comment.