Skip to content
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

refactor: builders #10448

Merged
merged 1 commit into from
Oct 1, 2024
Merged

refactor: builders #10448

merged 1 commit into from
Oct 1, 2024

Conversation

didinele
Copy link
Member

@didinele didinele commented Aug 15, 2024

Please describe the changes this PR makes and why it should be merged:
Closes #8015

Change list/resolution points:

  • remove @discordjs/formatters re-export (deprecated currently)
  • remove SelectMenuBuilder and SelectMenuOptionBuilder aliases (deprecated currently, left-over from before we had different types of select menus)
  • all builders now store data inside of a data field
  • EmbedBuilder no longer takes in camalCase options
  • EmbedBuilder now has "nested builders" implemented for things like the author and footer
  • removed API-deprecated features such as .setDMPermission
  • ActionRowBuilder now has specialized [add/set]X methods as opposed to the current [add/set]Components
  • validation no longer occurs during the actual "build process", but only during conversion to API data (done strictly with toJSON())
  • all builders now use structuredClone
  • introduced explicit clearX() methods as opposed to taking previously inconsistent null or undefined to clear
  • removed inconsistent equals methods, if they're needed & desired, we can easily re-implement them (and this time on all classes too)
  • moved from shapeshift to zod, supersedes refactor: use zod in builders #10117

BREAKING CHANGE: formatters export removed (prev. deprecated)
BREAKING CHANGE: SelectMenuBuilder and SelectMenuOptionBuilder have been removed (prev. deprecated)
BREAKING CHANGE: EmbedBuilder no longer takes camalCase options
BREAKING CHANGE: ActionRowBuilder now has specialized [add/set]X methods as opposed to the current [add/set]Components
BREAKING CHANGE: Removed equals methods
BREAKING CHANGE: Sapphire -> zod for validation
BREAKING CHANGE: Removed the ability to pass null/undefined to clear fields, use clearX() instead
BREAKING CHANGE: Renamed all "slash command" symbols to instead use "chat input command"
BREAKING CHANGE: Removed ContextMenuCommandBuilder in favor of MessageCommandBuilder and UserCommandBuilder
BREAKING CHANGE: Removed support for passing the "string key"s of enums
BREAKING CHANGE: Removed Button class in favor for specialized classes depending on the style
BREAKING CHANGE: Removed nested addX styled-methods in favor of plural addXs

@didinele didinele added this to the builders 2.0.0 milestone Aug 15, 2024
Copy link

vercel bot commented Aug 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 4:08pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 4:08pm

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 86.41270% with 214 lines in your changes missing coverage. Please review.

Project coverage is 35.34%. Comparing base (b20346f) to head (72c28d9).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/builders/src/components/ActionRow.ts 51.61% 60 Missing ⚠️
packages/builders/src/messages/embed/EmbedField.ts 53.57% 13 Missing ⚠️
...ackages/builders/src/messages/embed/EmbedFooter.ts 53.57% 13 Missing ⚠️
...ers/src/components/selectMenu/ChannelSelectMenu.ts 14.28% 12 Missing ⚠️
...ilders/src/components/selectMenu/UserSelectMenu.ts 14.28% 12 Missing ⚠️
...src/components/selectMenu/MentionableSelectMenu.ts 15.38% 11 Missing ⚠️
...ilders/src/components/selectMenu/RoleSelectMenu.ts 15.38% 11 Missing ⚠️
packages/builders/src/components/Components.ts 61.53% 10 Missing ⚠️
...ackages/builders/src/messages/embed/EmbedAuthor.ts 75.00% 9 Missing ⚠️
packages/builders/src/messages/embed/Embed.ts 92.92% 8 Missing ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10448      +/-   ##
==========================================
- Coverage   35.48%   35.34%   -0.14%     
==========================================
  Files         228      240      +12     
  Lines       14308    14612     +304     
  Branches     1254     1219      -35     
==========================================
+ Hits         5077     5165      +88     
- Misses       9187     9400     +213     
- Partials       44       47       +3     
Flag Coverage Δ
builders 81.66% <86.41%> (-9.92%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@almeidx almeidx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there

packages/builders/src/components/ActionRow.ts Outdated Show resolved Hide resolved
packages/builders/src/components/button/SKUIdButton.ts Outdated Show resolved Hide resolved
packages/builders/src/components/button/URLButton.ts Outdated Show resolved Hide resolved
BREAKING CHANGE: formatters export removed (prev. deprecated)
BREAKING CHANGE: `SelectMenuBuilder` and `SelectMenuOptionBuilder` have been removed (prev. deprecated)
BREAKING CHANGE: `EmbedBuilder` no longer takes camalCase options
BREAKING CHANGE: `ActionRowBuilder` now has specialized `[add/set]X` methods as opposed to the current `[add/set]Components`
BREAKING CHANGE: Removed `equals` methods
BREAKING CHANGE: Sapphire -> zod for validation
BREAKING CHANGE: Removed the ability to pass `null`/`undefined` to clear fields, use `clearX()` instead
BREAKING CHANGE: Renamed all "slash command" symbols to instead use "chat input command"
BREAKING CHANGE: Removed `ContextMenuCommandBuilder` in favor of `MessageCommandBuilder` and `UserCommandBuilder`
BREAKING CHANGE: Removed support for passing the "string key"s of enums
BREAKING CHANGE: Removed `Button` class in favor for specialized classes depending on the style
BREAKING CHANGE: Removed nested `addX` styled-methods in favor of plural `addXs`

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Almeida <github@almeidx.dev>
@vladfrangu vladfrangu merged commit ab32f26 into main Oct 1, 2024
25 checks passed
@vladfrangu vladfrangu deleted the impl/builders-v2 branch October 1, 2024 16:11
@almeidx almeidx removed the blocked label Oct 2, 2024
@almeidx almeidx mentioned this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

RFC(builders): The interface, the validation, and the pains you have had with them so far
8 participants