Skip to content

Commit 21b3447

Browse files
BREAKING CHANGE: remove CJS build, polyfills, dependencies
This commit changes revolt.js so that there is no longer a CJS build. CJS users of revolt.js can still import it using versions of Node.js after nodejs/node#51977 was merged. The dependencies on the isomorphic-ws and ws packages were also removed. This does make the minimum supported version the latest LTS, Node.js 22. In browsers and Deno, nothing should change. The dependencies on Solid.js were also removed, making a breaking change for users who used the reactivity from the Solid.js wrappers. Import paths throughout the project were rewritten to import from the original source files everywhere. Prettier, ESLint, and Typescript were all updated to their latest versions as well. Signed-off-by: Jersey <[email protected]>
1 parent 63c2b64 commit 21b3447

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1837
-2942
lines changed

.eslintrc.json

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ main ]
16+
branches: [main]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ main ]
19+
branches: [main]
2020
schedule:
21-
- cron: '40 21 * * 6'
21+
- cron: "40 21 * * 6"
2222

2323
jobs:
2424
analyze:
@@ -32,40 +32,40 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'javascript' ]
35+
language: ["javascript"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3737
# Learn more:
3838
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3939

4040
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v2
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
4343

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
47-
with:
48-
languages: ${{ matrix.language }}
49-
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
51-
# Prefix the list here with "+" to use these queries and those in the config file.
52-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v2
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5353

54-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55-
# If this step fails, then you should remove it and run the build manually (see below)
56-
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v2
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v2
5858

59-
# ℹ️ Command-line programs to run using the OS shell.
60-
# 📚 https://git.io/JvXDl
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
6161

62-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63-
# and modify them (or add more) to build your code if your project
64-
# uses a compiled language
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
6565

66-
#- run: |
67-
# make bootstrap
68-
# make release
66+
#- run: |
67+
# make bootstrap
68+
# make release
6969

70-
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v2
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2

.prettierrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
"tabWidth": 2,
33
"useTabs": false,
44
"plugins": ["@trivago/prettier-plugin-sort-imports"],
5-
"importOrder": [
6-
"^solid",
7-
"<THIRD_PARTY_MODULES>",
8-
"^\\.\\.",
9-
"^[./]"
10-
],
5+
"importOrder": ["<THIRD_PARTY_MODULES>", "^\\.\\.", "^[./]"],
116
"importOrderSeparation": true,
127
"importOrderSortSpecifiers": true
138
}

README.md

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# revolt.js
22

3-
![revolt.js](https://img.shields.io/npm/v/revolt.js) ![revolt-api](https://img.shields.io/npm/v/revolt-api?label=Revolt%20API)
3+
![revolt.js](https://img.shields.io/npm/v/revolt.js)
4+
![revolt-api](https://img.shields.io/npm/v/revolt-api?label=Revolt%20API)
45

5-
**revolt.js** is a JavaScript library for interacting with the entire Revolt API.
6+
**revolt.js** is a JavaScript library for interacting with the entire Revolt
7+
API.
68

79
## Example Usage
810

@@ -14,8 +16,9 @@ const { Client } = require("revolt.js");
1416

1517
let client = new Client();
1618

17-
client.on("ready", async () =>
18-
console.info(`Logged in as ${client.user.username}!`)
19+
client.on(
20+
"ready",
21+
async () => console.info(`Logged in as ${client.user.username}!`),
1922
);
2023

2124
client.on("messageCreate", async (message) => {
@@ -26,32 +29,3 @@ client.on("messageCreate", async (message) => {
2629

2730
client.loginBot("..");
2831
```
29-
30-
## Reactivity with Signals & Solid.js Primitives
31-
32-
All objects have reactivity built-in and can be dropped straight into any Solid.js project.
33-
34-
```tsx
35-
const client = new Client();
36-
// initialise the client
37-
38-
function MyApp() {
39-
return (
40-
<h1>Your username is: {client.user?.username ?? "[logging in...]"}</h1>
41-
);
42-
}
43-
```
44-
45-
## Revolt API Types
46-
47-
> [!WARNING]
48-
> It is advised you do not use this unless necessary. If you find somewhere that isn't covered by the library, please open an issue as this library aims to transform all objects.
49-
50-
All `revolt-api` types are re-exported from this library under `API`.
51-
52-
```typescript
53-
import { API } from "revolt.js";
54-
55-
// API.Channel;
56-
// API.[..];
57-
```

eslint.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import eslint from "@eslint/js";
2+
import prettier from "eslint-plugin-prettier/recommended";
3+
import { defineConfig } from "eslint/config";
4+
import tseslint from "typescript-eslint";
5+
6+
export default defineConfig([
7+
eslint.configs.recommended,
8+
tseslint.configs.recommended,
9+
{
10+
rules: {
11+
"@typescript-eslint/no-unused-vars": [
12+
"warn",
13+
{
14+
caughtErrors: "all",
15+
varsIgnorePattern: "^_",
16+
},
17+
],
18+
},
19+
},
20+
prettier,
21+
]);

package-esm.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
22
"name": "revolt.js",
33
"version": "7.0.5",
4-
"main": "lib/cjs/index.js",
5-
"module": "lib/esm/index.js",
6-
"types": "lib/esm/index.d.ts",
4+
"type": "module",
5+
"module": "lib/index.js",
6+
"types": "lib/index.d.ts",
77
"repository": "https://github.com/revoltchat/revolt.js",
88
"author": "Paul Makles <insrt.uk>",
99
"license": "MIT",
1010
"scripts": {
11-
"build": "pnpm run build:esm && pnpm run build:cjs",
12-
"build:esm": "tsc && cp package-esm.json lib/esm/package.json",
13-
"build:cjs": "tsc -p tsconfig.cjs.json",
14-
"build:watch": "tsc-watch --onSuccess \"node .\"",
11+
"build": "tsc",
1512
"lint": "eslint --ext .ts,.tsx src/",
1613
"lint:fix": "eslint --fix --ext .ts,.tsx src/",
1714
"typecheck": "tsc --noEmit",
@@ -26,32 +23,19 @@
2623
"description": "Library for interacting with the Revolt API.",
2724
"packageManager": "[email protected]",
2825
"dependencies": {
29-
"@solid-primitives/map": "^0.4.11",
30-
"@solid-primitives/set": "^0.4.11",
3126
"eventemitter3": "^5.0.1",
32-
"isomorphic-ws": "^5.0.0",
33-
"long": "^5.2.3",
3427
"revolt-api": "0.8.3",
35-
"solid-js": "^1.8.15",
36-
"ulid": "^2.3.0",
37-
"ws": "^8.16.0"
28+
"ulid": "^2.3.0"
3829
},
3930
"devDependencies": {
40-
"@mxssfd/typedoc-theme": "^1.1.3",
41-
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
42-
"@types/node": "^18.19.24",
43-
"@types/ws": "^8.5.10",
44-
"@typescript-eslint/eslint-plugin": "^5.62.0",
45-
"@typescript-eslint/parser": "^5.62.0",
46-
"dotenv": "^16.4.5",
47-
"eslint": "^8.57.0",
48-
"eslint-config-prettier": "^8.10.0",
49-
"eslint-plugin-solid": "^0.12.1",
50-
"eslint-plugin-spellcheck": "^0.0.20",
51-
"prettier": "^2.8.8",
52-
"tsc-watch": "^6.0.4",
53-
"typed-emitter": "^2.1.0",
54-
"typedoc": "^0.25.1",
55-
"typescript": "^5.4.2"
31+
"@mxssfd/typedoc-theme": "^1.1.7",
32+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
33+
"@types/node": "^22.13.10",
34+
"eslint-plugin-prettier": "^5.2.3",
35+
"eslint": "^9.22.0",
36+
"prettier": "^3.5.3",
37+
"typedoc": "^0.27.9",
38+
"typescript-eslint": "^8.26.1",
39+
"typescript": "^5.8.2"
5640
}
57-
}
41+
}

0 commit comments

Comments
 (0)