Commit fbf443d
authored
feat: new build settings (#820)
Changelogs:
- Changes have been made to export modules using the [sub-path
exports](https://nodejs.org/api/packages.html#subpath-exports) in the
package.json.
If you were using the package in a Native CJS environment, this might
have an impact.
You can migrate the path as follows:
```diff
- const ChannelList = require('@sendbird/uikit-react/cjs/ChannelList');
+ const ChannelList = require('@sendbird/uikit-react/ChannelList');
```
- TypeScript support has been improved.
Now, precise types based on the source code are used.
---
- Fix type errors in source.
- Exports auto generated .d.ts files instead of manual `index.d.ts` file
### Before
1. run rollup
1. read inputs (module entries)
2. generate css and js files to
- css: `/dist/dist/index.css`, `/dist/dist/cjs/dist/index.css`
- js: `/dist` and `/dist/cjs`
3. copy `README.md`, `LICESNSE`, `CHANGELOG.md`, `index.d.ts`
2. run `scripts/post_build.js`
1. append version to `index.d.ts`
2. package.json: add dependencies and copy to `dist/package.json`
### After
1. run rollup
1. read inputs (module entries)
2. generate css and js files to
- css: `/dist/dist/index.css`, `/dist/dist/cjs/dist/index.css`
- js: `/dist` and `/dist/cjs`
3. copy `README.md`, `LICESNSE`, `CHANGELOG.md`
2. run `scripts/post_build.js`
1. package.json: add dependencies, exports, typesVersions and copy to
`dist/package.json`
2. remove unused css files in `/dist/dist/cjs/dist`
3. build `.d.ts` files
---
The biggest difference is that now we use the exports supported in
package.json.
You can find more information here:
https://nodejs.org/api/packages.html#subpath-exports
This may result in breaking changes because you can only use modules
that are specified in exports.
For example, the `@sendbird/chat/cjs/index.js` file actually exists, but
it is not exported in package.json, so you cannot use it in a strict
environment.
The advantages of this approach are as follows:
For paths that we directly specify in exports, files are assigned
accordingly in the esm/cjs environment.
Previously, for individually exported entries (modules) other than the
main entry, we had to specify the path directly depending on the module
environment.
For example:
> #### Before
>esm: @sendbird/chat (package.json > module: "index.js")
cjs: @sendbird/chat (package.json > main: "cjs/index.js")
>
>esm: @sendbird/chat/ChannelList (nothing in package.json)
cjs: @sendbird/chat/cjs/ChannelList (nothing in package.json)
>
> #### After
>esm: @sendbird/chat (package.json > exports: { ".": "index.js" } )
cjs: @sendbird/chat (package.json > exports: { ".": "cjs/index.js" } )
>
>esm: @sendbird/chat/ChannelList (package.json > exports: {
"./ChannelList": "ChannelList/index.js" } )
cjs: @sendbird/chat/ChannelList (package.json > exports: {
"./ChannelList": "cjs/ChannelList/index.js" } )
---
package.json example
```json
{
"exports": {
"./package.json": "./package.json",
"./dist/index.css": "./dist/index.css",
".": {
"types": "./types/index.d.ts",
"require": "./cjs/index.js",
"import": "./index.js",
"default": "./index.js"
},
"./App": {
"types": "./types/modules/App/index.d.ts",
"require": "./cjs/App.js",
"import": "./App.js",
"default": "./App.js"
},
"./SendbirdProvider": {
"types": "./types/lib/Sendbird.d.ts",
"require": "./cjs/SendbirdProvider.js",
"import": "./SendbirdProvider.js",
"default": "./SendbirdProvider.js"
},
"./sendbirdSelectors": {
"types": "./types/lib/selectors.d.ts",
"require": "./cjs/sendbirdSelectors.js",
"import": "./sendbirdSelectors.js",
"default": "./sendbirdSelectors.js"
},
"./VoiceRecorder/context": {
"types": "./types/hooks/VoiceRecorder/index.d.ts",
"require": "./cjs/VoiceRecorder/context.js",
"import": "./VoiceRecorder/context.js",
"default": "./VoiceRecorder/context.js"
},
"./VoiceRecorder/useVoiceRecorder": {
"types": "./types/hooks/VoiceRecorder/useVoiceRecorder.d.ts",
"require": "./cjs/VoiceRecorder/useVoiceRecorder.js",
"import": "./VoiceRecorder/useVoiceRecorder.js",
"default": "./VoiceRecorder/useVoiceRecorder.js"
}
}
}
```
```sh
git rebase --onto main HEAD~13
```1 parent 575be99 commit fbf443d
File tree
86 files changed
+2968
-4076
lines changed- .circleci
- scripts
- src
- lib
- dux/sdk
- hooks/useConnect
- modules
- App
- ChannelList/context/hooks
- ChannelSettings
- components/ModerationPanel
- context
- Channel
- components
- SuggestedMentionList
- context
- hooks
- CreateChannel
- components
- InviteUsers
- context
- CreateOpenChannel/context
- MessageSearch/context/hooks
- Message/components/TextFragment
- OpenChannelApp/components
- OpenChannelList/context/hooks
- OpenChannelSettings/context
- OpenChannel
- components/OpenChannelMessage
- context
- hooks
- Thread
- components/ParentMessageInfo
- context
- __test__
- hooks
- ui
- Avatar
- Badge
- FileViewer
- ImageRenderer
- MessageItemReactionMenu
- MessageSearchFileItem
- MessageSearchItem
- MobileMenu
- Modal
- OpenchannelFileMessage
- OpenchannelUserMessage
- PlaybackTime
- VoiceMessageInput/stories
- utils
- exports
- types
- jest-extended
- svg
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
86 files changed
+2968
-4076
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
122 | 120 | | |
123 | 121 | | |
124 | 122 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 123 | | |
133 | 124 | | |
134 | 125 | | |
| |||
161 | 152 | | |
162 | 153 | | |
163 | 154 | | |
164 | | - | |
165 | 155 | | |
166 | 156 | | |
167 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
| 100 | + | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| |||
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
135 | | - | |
| 133 | + | |
136 | 134 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
145 | 143 | | |
146 | 144 | | |
147 | | - | |
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
File renamed without changes.
0 commit comments