Skip to content

Commit cc14fb8

Browse files
deps,actions: update deps and make tweaks (#75)
* deps,actions: update deps and make tweaks - Update dependencies and developer dependencies to their latest versions. - Switch from Node-Fetch to Undici. - Update the GitHub Actions workflows to their latest versions. - Remove Node.js v12 from the testing matrix as it reached it's EoL (End-of-Life) stage, and add Node.js v16 and v18 to the testing matrix. - Align all examples (in README and JSDocs) to the code style of the codebase. - Inline JSDocs that only have a description. - Format the `typedoc.json` file and remove the usage of the `minimal` theme as it was removed. - Move the `APIOptions` interface to the `src/typings.ts` file and export it so it's shown in the documentation. - Bump version to 3.1.4. --------- Co-authored-by: Julian Berryessa <jb@bit.kiwi>
1 parent a2d9685 commit cc14fb8

11 files changed

Lines changed: 248 additions & 334 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: [12, 14]
14+
node: [14, 16, 18]
1515
steps:
16-
- uses: actions/checkout@master
17-
- name: Cache node modules
18-
uses: actions/cache@v2
16+
- uses: actions/checkout@v3
17+
- name: Cache node_modules
18+
uses: actions/cache@v3
1919
env:
2020
cache-name: cache-node-modules
2121
with:
@@ -25,12 +25,13 @@ jobs:
2525
${{ runner.os }}-build-${{ env.cache-name }}-
2626
${{ runner.os }}-build-
2727
${{ runner.os }}-
28-
- name: Setup node
29-
uses: actions/setup-node@v1
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v3
3030
with:
3131
node-version: ${{ matrix.node }}
32+
check-latest: true
3233
registry-url: https://registry.npmjs.org/
33-
- name: Compile typescript
34+
- name: Compile TypeScript
3435
run: npm run build:ci
35-
- name: Lint typescript
36+
- name: Lint TypeScript
3637
run: npm run lint:ci

.github/workflows/publish.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions/setup-node@v1
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
1313
with:
14-
node-version: 14
14+
node-version: 18
15+
check-latest: true
1516
registry-url: https://registry.npmjs.org/
16-
- run: npm publish --unsafe-perm
17+
- run: npm publish
1718
env:
18-
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}
19+
NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ typings/
105105
.tern-port
106106
package-lock.json
107107
yarn.lock
108-
eslint_report.json
108+
eslint_report.json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.9.0

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,36 @@ You can also setup webhooks via Topgg.Webhook, look down below at the examples f
2727
If you're looking for an easy way to post your bot's stats (server count, shard count), check out [`topgg-autoposter`](https://npmjs.com/package/topgg-autoposter)
2828

2929
```js
30-
const client = Discord.Client() // Your discord.js client or any other
31-
const { AutoPoster } = require('topgg-autoposter')
30+
const client = Discord.Client(); // Your discord.js client or any other
31+
const { AutoPoster } = require("topgg-autoposter");
3232

33-
AutoPoster('topgg-token', client)
34-
.on('posted', () => {
35-
console.log('Posted stats to Top.gg!')
36-
})
33+
AutoPoster("topgg-token", client).on("posted", () => {
34+
console.log("Posted stats to Top.gg!");
35+
});
3736
```
37+
3838
With this your server count and shard count will be posted to Top.<span>gg
3939

4040
## Webhook server
4141

4242
```js
43-
const express = require('express')
44-
const Topgg = require('@top-gg/sdk')
43+
const express = require("express");
44+
const Topgg = require("@top-gg/sdk");
4545

46-
const app = express() // Your express app
46+
const app = express(); // Your express app
4747

48-
const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)
48+
const webhook = new Topgg.Webhook("topggauth123"); // add your Top.gg webhook authorization (not bot token)
4949

50-
app.post('/dblwebhook', webhook.listener(vote => {
51-
// vote is your vote object
52-
console.log(vote.user) // 221221226561929217
53-
})) // attach the middleware
50+
app.post(
51+
"/dblwebhook",
52+
webhook.listener((vote) => {
53+
// vote is your vote object
54+
console.log(vote.user); // 221221226561929217
55+
})
56+
); // attach the middleware
5457

55-
app.listen(3000) // your port
58+
app.listen(3000); // your port
5659
```
60+
5761
With this example, your webhook dashboard should look like this:
5862
![](https://i.imgur.com/wFlp4Hg.png)

package.json

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@top-gg/sdk",
3-
"version": "3.1.3",
3+
"version": "3.1.4",
44
"description": "Official Top.gg Node SDK",
55
"main": "./dist/index.js",
66
"scripts": {
77
"build": "tsc",
8-
"build:ci": "npm i --also=dev && tsc",
8+
"build:ci": "npm i --include=dev && tsc",
99
"docs": "typedoc",
1010
"prepublishOnly": "npm run build:ci",
1111
"lint": "eslint src/**/*.ts",
@@ -23,25 +23,24 @@
2323
},
2424
"homepage": "https://topgg.js.org",
2525
"devDependencies": {
26-
"@top-gg/eslint-config": "^0.0.2",
27-
"@types/express": "^4.17.11",
28-
"@types/node": "^14.14.41",
29-
"@types/node-fetch": "^2.5.10",
30-
"@typescript-eslint/eslint-plugin": "^4.26.0",
31-
"@typescript-eslint/parser": "^4.26.0",
32-
"eslint": "^7.27.0",
33-
"eslint-config-prettier": "^8.3.0",
34-
"eslint-plugin-jest": "^24.3.6",
35-
"express": "^4.17.1",
36-
"husky": "^6.0.0",
37-
"lint-staged": "^11.0.0",
38-
"prettier": "^2.3.0",
39-
"typedoc": "^0.21.0",
40-
"typescript": "^4.4.4"
26+
"@top-gg/eslint-config": "^0.0.3",
27+
"@types/express": "^4.17.17",
28+
"@types/node": "^18.15.5",
29+
"@typescript-eslint/eslint-plugin": "^5.56.0",
30+
"@typescript-eslint/parser": "^5.56.0",
31+
"eslint": "^8.36.0",
32+
"eslint-config-prettier": "^8.8.0",
33+
"eslint-plugin-jest": "^27.2.1",
34+
"express": "^4.18.2",
35+
"husky": "^8.0.3",
36+
"lint-staged": "^13.2.0",
37+
"prettier": "^2.8.6",
38+
"typedoc": "^0.23.28",
39+
"typescript": "^5.0.2"
4140
},
4241
"dependencies": {
43-
"node-fetch": "^2.6.1",
44-
"raw-body": "^2.4.1"
42+
"raw-body": "^2.5.2",
43+
"undici": "^5.21.0"
4544
},
4645
"types": "./dist/index.d.ts"
4746
}

0 commit comments

Comments
 (0)