Skip to content

refactor: typescript rewrite #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bbac183
initial commit
OfficialSirH Feb 2, 2025
6c193d1
initial commit
OfficialSirH Feb 2, 2025
0b3a1dc
chore: requested changes
OfficialSirH Feb 2, 2025
ab84d6e
chore: minor changes
OfficialSirH Feb 2, 2025
0e4c989
fix: lintstaged and prettier configs
sdanialraza Feb 3, 2025
de14e9a
Merge pull request #1 from sdanialraza/fix/lintstaged-prettier-configs
OfficialSirH Feb 3, 2025
92e4dd7
fix: types and methods
OfficialSirH Feb 9, 2025
c57e2fe
fix: resolve all type errors
OfficialSirH Feb 9, 2025
65e68bb
fix: import extensions
OfficialSirH Feb 9, 2025
0aca777
refactor: update examples
sdanialraza Feb 9, 2025
108b6e2
fix: types
OfficialSirH Feb 9, 2025
b4c3acd
skibidi this, skibidi that, how about stop committing that line, Micah
OfficialSirH Feb 9, 2025
7a5cb87
Merge branch 'ts-rewrite' into refactor/update-examples
sdanialraza Feb 9, 2025
8c95232
fix-ish: man, idk, authorize is silly
OfficialSirH Feb 9, 2025
c5f467c
Update README.md
OfficialSirH Feb 9, 2025
e255cd6
Update src/index.ts
OfficialSirH Feb 9, 2025
d975f24
Update src/util.ts
OfficialSirH Feb 9, 2025
7abb7b3
Update src/util.ts
OfficialSirH Feb 9, 2025
49d96b6
chore: revert version
OfficialSirH Feb 9, 2025
93c2500
chore: jiralite obligations
OfficialSirH Feb 9, 2025
12440a8
refactor: several adjustments for clarity
OfficialSirH Feb 13, 2025
6876207
fix: subscribe method types
OfficialSirH Feb 13, 2025
5d82bc6
chore: jiralite mentioned changes
OfficialSirH Feb 14, 2025
0572765
Merge pull request #2 from sdanialraza/refactor/update-examples
OfficialSirH Feb 17, 2025
afcc201
add: more types/adjustments
OfficialSirH Feb 24, 2025
c0b7549
remove: lobby stuff
OfficialSirH Feb 25, 2025
404cca6
feat: more methods for commands
OfficialSirH Feb 25, 2025
e4a012e
refactor(types): remove all types in place of discord-api-types
OfficialSirH Apr 10, 2025
89de9db
fix: properly handle activity changes
OfficialSirH May 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cliff-jumperrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "rpc",
"org": "discordjs",
"identifierBase": false
}
89 changes: 0 additions & 89 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: '15'
- run: "npm install"
- run: "npm run docs"
- run: 'npm install'
- run: 'npm run docs'
- uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
33 changes: 28 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
node_modules/**
package-lock.json
browser.js
test/auth.js
docs-out
# Packages
node_modules

# Log files
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Env
.env

# Dist
dist
dist-docs

# Docs
docs/**/*
!docs/README.md

# Miscellaneous
.turbo
.tmp
coverage
6 changes: 6 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/lintstagedrc.schema.json",
"*": "prettier --ignore-unknown --write",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --fix",
"src/**.ts": "vitest related --run --config ../../vitest.config.ts"
}
9 changes: 0 additions & 9 deletions .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.turbo
coverage
dist
dist-docs
docs/docs.api.json
CHANGELOG.md
tsup.config.bundled*
9 changes: 9 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/prettierrc.json",
"printWidth": 120,
"useTabs": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"endOfLine": "lf"
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

### [Rich Presence Example](https://github.com/discordjs/RPC/blob/master/example)

### __Browser__ Example
### Browser Example

```javascript
const clientId = '287406016902594560';
Expand All @@ -26,10 +26,10 @@ const scopes = ['rpc', 'rpc.api', 'messages.read'];
const client = new RPC.Client({ transport: 'websocket' });

client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);

client.selectVoiceChannel('81384788862181376');
client.selectVoiceChannel('81384788862181376');
});

// Log in to RPC with client id
Expand Down
79 changes: 79 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[changelog]
header = """
# Changelog

All notable changes to this project will be documented in this file.\n
"""
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% if version %}\
# [{{ version | trim_start_matches(pat="v") }}]\
{% if previous %}\
{% if previous.version %}\
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
{% else %}\
({{ self::remote_url() }}/tree/{{ version }})\
{% endif %}\
{% endif %} \
- ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
# [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
## {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}\
**{{commit.scope}}:** \
{% endif %}\
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
{% if commit.breaking %}\
{% for footer in commit.footers %}\
{% if footer.breaking %}\
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
{% endif %}\
{% endfor %}\
{% endif %}\
{% endfor %}
{% endfor %}\
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
\n### New Contributors\n
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
{% endfor %}\
{% endif %}\n
"""
trim = true
footer = ""

[git]
conventional_commits = true
filter_unconventional = true
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^docs", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^types", group = "Typings" },
{ message = ".*deprecated", body = ".*deprecated", group = "Deprecation" },
{ message = "^revert", skip = true },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore", skip = true },
{ message = "^ci", skip = true },
{ message = "^build", skip = true },
{ body = ".*security", group = "Security" },
]
filter_commits = true
protect_breaking_commits = true
tag_pattern = "^[0-9]+"
ignore_tags = ""
topo_order = false
sort_commits = "newest"

[remote.github]
owner = "discordjs"
repo = "discord.js"
12 changes: 0 additions & 12 deletions docgen.json

This file was deleted.

1 change: 0 additions & 1 deletion example/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions example/index.html

This file was deleted.

85 changes: 0 additions & 85 deletions example/main.js

This file was deleted.

Loading