Skip to content

Commit b6a8264

Browse files
authored
chore: Merge builders/1.x into v14 (#11260)
* chore: merge builders (and formatters) * chore: match cliff.toml * chore: update README.mds * build: discord-api-types 0.38.32
1 parent a7196dc commit b6a8264

Some content is hidden

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

53 files changed

+2697
-171
lines changed

packages/builders/CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,52 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
# [@discordjs/builders@1.13.0](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-10-24)
6+
7+
## Features
8+
9+
- V1 builders file uploads support (#11196) ([1417c49](https://github.com/discordjs/discord.js/commit/1417c498a40b843d772ecf88dfff5f87a1665042))
10+
11+
## Testing
12+
13+
- Fix type error ([f780c6a](https://github.com/discordjs/discord.js/commit/f780c6a5500f7ea5c7a1ea7cd6720f6159d9d36e))
14+
15+
# [@discordjs/builders@1.12.2](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-10-09)
16+
17+
## Bug Fixes
18+
19+
- **Assertions:** Literal default values ([43362c9](https://github.com/discordjs/discord.js/commit/43362c93525f98d72b894eb0fc6b358d30ec45b9))
20+
21+
# [@discordjs/builders@1.12.1](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-10-08)
22+
23+
## Bug Fixes
24+
25+
- **builders:** Text display component support for modals (#11155) ([99b8436](https://github.com/discordjs/discord.js/commit/99b8436117bc12654278337abc4a23f5bdf4ba46))
26+
27+
# [@discordjs/builders@1.12.0](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-10-08)
28+
29+
## Features
30+
31+
- **builders:** Modal select menus in builders v1 (#11138) ([ac683b9](https://github.com/discordjs/discord.js/commit/ac683b9d040635de8514c80a9d433d9c6d63701b))
32+
33+
# [@discordjs/builders@1.11.3](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-08-10)
34+
35+
## Bug Fixes
36+
37+
- **contextMenuCommands:** Remove regular expression validation (#10996) ([4906aae](https://github.com/discordjs/discord.js/commit/4906aaea4c0e6e868fa658d3359026eb662fbcb8))
38+
39+
# [@discordjs/builders@1.11.0](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-04-25)
40+
41+
## Features
42+
43+
- Components v2 in builders v1 (#10787) ([118e682](https://github.com/discordjs/discord.js/commit/118e6826821b3b90f5923e40f167747e0658cfd1))
44+
45+
# [@discordjs/builders@1.10.1](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2025-02-10)
46+
47+
## Bug Fixes
48+
49+
- **EmbedBuilder:** Allow empty `name` and `value` on fields (#10747) ([49ef3a8](https://github.com/discordjs/discord.js/commit/49ef3a833eab23d426d5c667e28aa493ddc9cb6c))
50+
551
# [@discordjs/builders@1.9.0](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected]) - (2024-09-01)
652

753
## Features

packages/builders/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
## Installation
2626

27-
**Node.js 18 or newer is required.**
27+
**Node.js 16.11.0 or newer is required.**
2828

2929
```sh
3030
npm install @discordjs/builders

packages/builders/__tests__/components/actionRow.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
ButtonStyle,
33
ComponentType,
44
type APIActionRowComponent,
5-
type APIMessageActionRowComponent,
5+
type APIComponentInMessageActionRow,
66
} from 'discord-api-types/v10';
77
import { describe, test, expect } from 'vitest';
88
import {
@@ -13,7 +13,7 @@ import {
1313
StringSelectMenuOptionBuilder,
1414
} from '../../src/index.js';
1515

16-
const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
16+
const rowWithButtonData: APIActionRowComponent<APIComponentInMessageActionRow> = {
1717
type: ComponentType.ActionRow,
1818
components: [
1919
{
@@ -25,7 +25,7 @@ const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
2525
],
2626
};
2727

28-
const rowWithSelectMenuData: APIActionRowComponent<APIMessageActionRowComponent> = {
28+
const rowWithSelectMenuData: APIActionRowComponent<APIComponentInMessageActionRow> = {
2929
type: ComponentType.ActionRow,
3030
components: [
3131
{
@@ -57,7 +57,7 @@ describe('Action Row Components', () => {
5757
});
5858

5959
test('GIVEN valid JSON input THEN valid JSON output is given', () => {
60-
const actionRowData: APIActionRowComponent<APIMessageActionRowComponent> = {
60+
const actionRowData: APIActionRowComponent<APIComponentInMessageActionRow> = {
6161
type: ComponentType.ActionRow,
6262
components: [
6363
{
@@ -92,7 +92,7 @@ describe('Action Row Components', () => {
9292
});
9393

9494
test('GIVEN valid builder options THEN valid JSON output is given', () => {
95-
const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
95+
const rowWithButtonData: APIActionRowComponent<APIComponentInMessageActionRow> = {
9696
type: ComponentType.ActionRow,
9797
components: [
9898
{
@@ -104,7 +104,7 @@ describe('Action Row Components', () => {
104104
],
105105
};
106106

107-
const rowWithSelectMenuData: APIActionRowComponent<APIMessageActionRowComponent> = {
107+
const rowWithSelectMenuData: APIActionRowComponent<APIComponentInMessageActionRow> = {
108108
type: ComponentType.ActionRow,
109109
components: [
110110
{

packages/builders/__tests__/components/components.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
ComponentType,
44
TextInputStyle,
55
type APIButtonComponent,
6-
type APIMessageActionRowComponent,
6+
type APIComponentInMessageActionRow,
77
type APISelectMenuComponent,
88
type APITextInputComponent,
99
type APIActionRowComponent,
@@ -27,7 +27,7 @@ describe('createComponentBuilder', () => {
2727
);
2828

2929
test('GIVEN an action row component THEN returns a ActionRowBuilder', () => {
30-
const actionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
30+
const actionRow: APIActionRowComponent<APIComponentInMessageActionRow> = {
3131
components: [],
3232
type: ComponentType.ActionRow,
3333
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import type { APIFileUploadComponent } from 'discord-api-types/v10';
2+
import { ComponentType } from 'discord-api-types/v10';
3+
import { describe, test, expect } from 'vitest';
4+
import { FileUploadBuilder } from '../../src/components/fileUpload/FileUpload.js';
5+
6+
describe('File Upload Components', () => {
7+
test('Valid builder does not throw.', () => {
8+
expect(() => new FileUploadBuilder().setCustomId('file_upload').toJSON()).not.toThrowError();
9+
expect(() => new FileUploadBuilder().setCustomId('file_upload').setId(5).toJSON()).not.toThrowError();
10+
11+
expect(() =>
12+
new FileUploadBuilder().setCustomId('file_upload').setMaxValues(5).setMinValues(2).toJSON(),
13+
).not.toThrowError();
14+
15+
expect(() => new FileUploadBuilder().setCustomId('file_upload').setRequired(false).toJSON()).not.toThrowError();
16+
});
17+
18+
test('Invalid builder does throw.', () => {
19+
expect(() => new FileUploadBuilder().toJSON()).toThrowError();
20+
expect(() => new FileUploadBuilder().setCustomId('file_upload').setId(-3).toJSON()).toThrowError();
21+
expect(() => new FileUploadBuilder().setMaxValues(5).setMinValues(2).setId(10).toJSON()).toThrowError();
22+
expect(() => new FileUploadBuilder().setCustomId('file_upload').setMaxValues(500).toJSON()).toThrowError();
23+
24+
expect(() =>
25+
new FileUploadBuilder().setCustomId('file_upload').setMinValues(500).setMaxValues(501).toJSON(),
26+
).toThrowError();
27+
28+
expect(() => new FileUploadBuilder().setRequired(false).toJSON()).toThrowError();
29+
});
30+
31+
test('API data equals toJSON().', () => {
32+
const fileUploadData = {
33+
type: ComponentType.FileUpload,
34+
custom_id: 'file_upload',
35+
min_values: 4,
36+
max_values: 9,
37+
required: false,
38+
} satisfies APIFileUploadComponent;
39+
40+
expect(new FileUploadBuilder(fileUploadData).toJSON()).toEqual(fileUploadData);
41+
42+
expect(
43+
new FileUploadBuilder().setCustomId('file_upload').setMinValues(4).setMaxValues(9).setRequired(false).toJSON(),
44+
).toEqual(fileUploadData);
45+
});
46+
});

packages/builders/__tests__/components/textInput.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ describe('Text Input Components', () => {
100100
.setPlaceholder('hello')
101101
.setStyle(TextInputStyle.Paragraph)
102102
.toJSON();
103-
}).toThrowError();
103+
}).not.toThrowError();
104104
});
105105

106106
test('GIVEN valid input THEN valid JSON outputs are given', () => {
107-
const textInputData: APITextInputComponent = {
107+
const textInputData = {
108108
type: ComponentType.TextInput,
109109
label: 'label',
110110
custom_id: 'custom id',
@@ -114,7 +114,7 @@ describe('Text Input Components', () => {
114114
value: 'value',
115115
required: false,
116116
style: TextInputStyle.Paragraph,
117-
};
117+
} satisfies APITextInputComponent;
118118

119119
expect(new TextInputBuilder(textInputData).toJSON()).toEqual(textInputData);
120120
expect(

0 commit comments

Comments
 (0)