Skip to content

Commit

Permalink
feat: utilize biome.js (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexpid authored Mar 9, 2024
1 parent ed6e069 commit 4afd0a4
Show file tree
Hide file tree
Showing 67 changed files with 3,570 additions and 2,734 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 80
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: main

- name: Checkout builds
uses: actions/checkout@v4
with:
Expand All @@ -25,8 +28,13 @@ jobs:
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
working-directory: main
run: bun i

- name: CI
working-directory: main
run: bun run format

- name: Build
run: bun run build-bun

Expand All @@ -35,8 +43,6 @@ jobs:
rm $GITHUB_WORKSPACE/builds/* || true
cp -r dist/* $GITHUB_WORKSPACE/builds || true
cd $GITHUB_WORKSPACE/builds
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Build $GITHUB_SHA" || exit 0
git push
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ A modification for Discord mobile apps. Continuation of [Vendetta](https://githu
#### Non-root

1. Install [Vendetta Manager](https://github.com/vendetta-mod/VendettaManager/releases/latest/download/Manager.apk)
2. Download *(don't install!)* the latest [Xposed module](https://github.com/revenge-mod/RevengeXposed/releases/latest/download/app-release.apk)
2. Download _(don't install!)_ the latest [Xposed module](https://github.com/revenge-mod/RevengeXposed/releases/latest/download/app-release.apk)
3. Go to Vendetta Manager's **Settings > About** and press version number **10 times**
4. Set **Custom Xposed module location** to:
```
/storage/emulated/0/Download/app-release.apk
```
> [!NOTE]
> This is default location of downloaded module if you use the default `Downloads` folder **and** you don't have any file with the same name saved. If these two conditions don't match, you will have to change the path respectively.
` /storage/emulated/0/Download/app-release.apk
`

> [!NOTE]
> This is default location of downloaded module if you use the default `Downloads` folder **and** you don't have any file with the same name saved. If these two conditions don't match, you will have to change the path respectively.
5. Head back to main screen and install!

Expand All @@ -42,19 +42,20 @@ A modification for Discord mobile apps. Continuation of [Vendetta](https://githu
5. Head to **Settings > Developer** under the **Vendetta** section
6. Toggle on the **Load Vendetta from custom URL** option
7. Input the following in the text field that appears
```
https://cdn.jsdelivr.net/gh/revenge-mod/builds@main/revenge.js
```
```
https://cdn.jsdelivr.net/gh/revenge-mod/builds@main/revenge.js
```
8. Restart the app again, and that should be it!

## 💖 Contributing

1. Follow the first two steps listed in [**⬇️ Installing**](#%EF%B8%8F-installing) section

2. Clone the repository
```
git clone https://github.com/revenge-mod/Revenge
```

```
git clone https://github.com/revenge-mod/Revenge
```

3. Install dependencies
```
Expand Down
54 changes: 42 additions & 12 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"javascript": {
"formatter": {
"enabled": true,
"bracketSpacing": true,
"indentSize": 4,
"indentStyle": "space",
"jsxQuoteStyle": "double",
"lineWidth": 240,
"quoteStyle": "double"
}
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"javascript": {
"formatter": {
"bracketSpacing": true,
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"quoteStyle": "double",
"trailingComma": "none"
}
}
},
"linter": {
"rules": {
"complexity": {
"noForEach": "off"
},
"correctness": {
"noChildrenProp": "off"
},
"performance": {
"noDelete": "off"
},
"recommended": true,
"style": {
"noCommaOperator": "off",
"noNonNullAssertion": "off",
"noParameterAssign": "off"
},
"suspicious": {
"noAssignInExpressions": "off",
"noExplicitAny": "off"
},
"security": {
"noGlobalEval": "off"
}
}
},
"organizeImports": {
"enabled": true
}
}
89 changes: 46 additions & 43 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,55 @@ import path from "path";
const exec = promisify(_exec);

const tsconfig = JSON.parse(await fs.readFile("./tsconfig.json"));
const aliases = Object.fromEntries(Object.entries(tsconfig.compilerOptions.paths).map(([alias, [target]]) => [alias, path.resolve(target)]));
const commit = (await exec("git rev-parse HEAD")).stdout.trim().substring(0, 7) || "custom";
const aliases = Object.fromEntries(
Object.entries(tsconfig.compilerOptions.paths).map(([alias, [target]]) => [
alias,
path.resolve(target),
])
);
const commit =
(await exec("git rev-parse HEAD")).stdout.trim().substring(0, 7) || "custom";

try {
await build({
entryPoints: ["./src/entry.ts"],
outfile: "./dist/revenge.js",
minify: true,
bundle: true,
format: "iife",
target: "esnext",
plugins: [
{
name: "swc",
setup: (build) => {
build.onLoad({ filter: /\.[jt]sx?/ }, async (args) => {
// This actually works for dependencies as well!!
const result = await swc.transformFile(args.path, {
jsc: {
externalHelpers: true,
},
env: {
targets: "defaults",
include: [
"transform-classes",
"transform-arrow-functions",
],
},
});
return { contents: result.code };
});
},
},
alias(aliases),
],
define: {
__revengeVersion: `"${commit}"`,
await build({
entryPoints: ["./src/entry.ts"],
outfile: "./dist/revenge.js",
minify: true,
bundle: true,
format: "iife",
target: "esnext",
plugins: [
{
name: "swc",
setup: (build) => {
build.onLoad({ filter: /\.[jt]sx?/ }, async (args) => {
// This actually works for dependencies as well!!
const result = await swc.transformFile(args.path, {
jsc: {
externalHelpers: true,
},
env: {
targets: "defaults",
include: ["transform-classes", "transform-arrow-functions"],
},
});
return { contents: result.code };
});
},
footer: {
js: "//# sourceURL=Revenge",
},
legalComments: "none",
});
},
alias(aliases),
],
define: {
__revengeVersion: `"${commit}"`,
},
footer: {
js: "//# sourceURL=Revenge",
},
legalComments: "none",
});

console.log("Build successful!");
console.log("Build successful!");
} catch (e) {
console.error("Build failed...", e);
process.exit(1);
console.error("Build failed...", e);
process.exit(1);
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "A modification for the Discord Android app.",
"scripts": {
"build": "node build.mjs",
"build-bun": "bun run build.mjs"
"build-bun": "bun run build.mjs",
"format": "biome check --apply-unsafe src"
},
"keywords": [
"discord",
Expand All @@ -15,7 +16,7 @@
"author": "maisymoe",
"license": "BSD-3-Clause",
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@biomejs/biome": "^1.6.0",
"@react-native-clipboard/clipboard": "1.10.0",
"@swc/core": "1.3.50",
"@types/chroma-js": "^2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

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

Loading

0 comments on commit 4afd0a4

Please sign in to comment.