forked from Strencher/BdBrowser
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring: Project Structure & Tooling
- Switched from npm to pnpm. - Modularized the build for each component. - Improved the bundling, all required artifacts for the extension are now being collected in the `dist` directory after `build-prod`. - Fanned out the modules in `frontend` to make it easier to identify what is a Node shim, an Electron shim etc. This is still ongoing. - Applied the BetterDiscord ESLint rules to BdBrowser and fixed most of the issues ESLint reported. - Added GitHub Actions workflow to automatically generate build artifacts. - Removed the `dist` folder from the repository, please download a release from the GitHub releases page instead or build BdBrowser yourself. - Added `dist` directory to .gitignore to reinforce the previous point. - Changed the location of local BetterDiscord renderer overrides. Instead of putting the betterdiscord.asar or renderer.js into the `dist` directory, please put them into `dist/bd/` instead. Note: BD's renderer.js is now expected as `renderer.js` instead of the previous name `betterdiscord.js`. - Corrected some minor spelling errors. - Early shim for BetterDiscord's upcoming nativeFetch.
- Loading branch information
Showing
67 changed files
with
3,186 additions
and
7,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"webextensions": true, | ||
"browser": true, | ||
"node": true, | ||
"es2020": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2022, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"accessor-pairs": "error", | ||
"block-spacing": ["error", "never"], | ||
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}], | ||
"curly": ["error", "multi-line", "consistent"], | ||
"dot-location": ["error", "property"], | ||
"dot-notation": "error", | ||
"func-call-spacing": "error", | ||
"handle-callback-err": "error", | ||
"key-spacing": "error", | ||
"keyword-spacing": "error", | ||
"new-cap": ["error", {"newIsCap": true}], | ||
"no-array-constructor": "error", | ||
"no-caller": "error", | ||
"no-console": "error", | ||
"no-duplicate-imports": "error", | ||
"no-else-return": "error", | ||
"no-eval": "error", | ||
"no-floating-decimal": "error", | ||
"no-implied-eval": "error", | ||
"no-iterator": "error", | ||
"no-label-var": "error", | ||
"no-labels": "error", | ||
"no-lone-blocks": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-spaces": "error", | ||
"no-multi-str": "error", | ||
"no-new": "error", | ||
"no-new-func": "error", | ||
"no-new-object": "error", | ||
"no-new-wrappers": "error", | ||
"no-octal-escape": "error", | ||
"no-path-concat": "error", | ||
"no-proto": "error", | ||
"no-prototype-builtins": "off", | ||
"no-redeclare": ["error", {"builtinGlobals": true}], | ||
"no-self-compare": "error", | ||
"no-sequences": "error", | ||
"no-shadow": ["warn", {"builtinGlobals": false, "hoist": "functions"}], | ||
"no-tabs": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-throw-literal": "error", | ||
"no-undef": "error", | ||
"no-undef-init": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-useless-call": "error", | ||
"no-useless-computed-key": "error", | ||
"no-useless-constructor": "error", | ||
"no-useless-rename": "error", | ||
"no-var": "error", | ||
"no-whitespace-before-property": "error", | ||
"object-curly-spacing": ["error", "never", {"objectsInObjects": false}], | ||
"object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}], | ||
"operator-linebreak": ["error", "none", {"overrides": {"?": "before", ":": "before"}}], | ||
"prefer-const": "error", | ||
"quote-props": ["error", "consistent-as-needed", {"keywords": true}], | ||
"quotes": ["error", "double", {"allowTemplateLiterals": true}], | ||
"rest-spread-spacing": "error", | ||
"semi": "error", | ||
"semi-spacing": "error", | ||
"space-before-blocks": "error", | ||
"space-in-parens": "error", | ||
"space-infix-ops": "error", | ||
"space-unary-ops": ["error", {"words": true, "nonwords": false, "overrides": {"typeof": false}}], | ||
"spaced-comment": ["error", "always", {"exceptions": ["-", "*"]}], | ||
"template-curly-spacing": "error", | ||
"wrap-iife": ["error", "inside"], | ||
"yield-star-spacing": "error", | ||
"yoda": "error" | ||
}, | ||
"globals": { | ||
"DiscordNative": "readonly", | ||
"__non_webpack_require__": "readonly" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: BdBrowser CI Build | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
tags: [ "**" ] | ||
|
||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source-code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.x | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 19.x | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build BdBrowser | ||
run: pnpm run build-prod | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: bdbrowser-extension | ||
path: dist/ | ||
retention-days: 30 | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/betterdiscord | ||
/dist | ||
/node_modules | ||
/.idea | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@bdbrowser/backend", | ||
"description": "BDBrowser Backend", | ||
"version": "0.0.0", | ||
"main": "src/index.js", | ||
"private": true, | ||
"scripts": { | ||
"build": "webpack --progress --color", | ||
"build-prod": "webpack --stats minimal --mode production", | ||
"lint": "eslint --ext .js src/" | ||
} | ||
} |
Oops, something went wrong.