Skip to content

Commit 78d643f

Browse files
myandrienkoarnautov-anton
authored andcommitted
chore: streamline build pipeline (#2325)
Our build pipeline contained some quirks and the remains of previous setups. It was time to clean it up :) The main changes are: **No rollup.** Previously our build pipeline was implemented in rollup. To simplify things up, we now just run a couple of processes in parallel: tsc to build our normal distribution and type declarations, esbuild to build bundles, and a shell script to include assets in the distribution. For development, just `tsc --watch` is enough. **No babel.** Previously our rollup config included babel transpilation with babel-preset-env. That means we included babel-runtime in our distribution, and transpiled async functions into generators with the notorious `regenerator-runtime`. Babel is now excluded from the build process (but still used as a parser for JS files in eslint). Targeting ES2020 in tsc and esbuild should be enough. And we finally have regular async functions in our distribution :) **Esbuild for bundles.** We now use esbuild instead of rollup for creating a CJS bundles. And we no longer create UDM browser bundles. **TS5.** I used this opportunity to bump TypeScript version as well :) Also, removed webpack and postcss dependencies - they were not used at all. 1. Bump prettier, eslint and eslint plugin versions. Will result in *a lot* of warnings, but good for future-proofing. 2. Review our eslintrc, it's currently a bit of a mess. 3. Remove babel completely, use typescript-eslint instead. 4. Switch to `"module": "NodeNext"` in tsconfig. This is the new recommended option for libraries, but will require us to add extensions to all of our import statements, to make them fully qualified. 5. (breaking change) With `"module": "NodeNext"` we will be ready to add `"type": "module"` in our package.json. We can't do that now, because fully specified import statements are expected from module packages. 6. (breaking change) Drop all bundles. CJS bundle is kinda weird anyway. Browser bundle can be replaced by `<script type="module">`. --------- Co-authored-by: Anton Arnautov <[email protected]>
1 parent fcaafb6 commit 78d643f

File tree

29 files changed

+8621
-10685
lines changed

29 files changed

+8621
-10685
lines changed

.eslintrc.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"babel",
55
"jest-dom",
66
"jest",
7-
"markdown",
87
"prettier",
98
"react-hooks",
109
"import",
@@ -17,6 +16,8 @@
1716
"plugin:jest/all",
1817
"plugin:jest-dom/recommended"
1918
],
19+
// Next.js example comes with its own ESLint setup
20+
"ignorePatterns": "examples/nextjs",
2021
"rules": {
2122
"array-callback-return": 2,
2223
"arrow-body-style": 2,
@@ -154,7 +155,6 @@
154155
"plugins": [
155156
"@typescript-eslint",
156157
"babel",
157-
"markdown",
158158
"prettier",
159159
"react",
160160
"typescript-sort-keys",
@@ -171,7 +171,8 @@
171171
"array-callback-return": 2,
172172
"arrow-body-style": 2,
173173
"comma-dangle": 0,
174-
"babel/no-invalid-this": 2,
174+
"babel/no-invalid-this": 0,
175+
"@typescript-eslint/no-invalid-this": 2,
175176
"default-case": 2,
176177
"eqeqeq": [2, "smart"],
177178
"linebreak-style": [2, "unix"],

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242
key: ${{ runner.os }}-${{ matrix.node }}-modules-${{ hashFiles('**/yarn.lock') }}
4343

4444
- name: 🔨 Install Dependencies & Build
45-
run: yarn install --frozen-lockfile --ignore-engines
45+
run: |
46+
yarn install --frozen-lockfile --ignore-engines
47+
yarn build
4648
4749
- name: 🧪 Lint and Test with ${{ matrix.node }}
4850
env:

.github/workflows/e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: E2E
22

3-
on: [push]
3+
on: [workflow_dispatch]
44

55
jobs:
66
e2e:

.github/workflows/release.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ jobs:
3636
uses: actions/setup-node@v3
3737
with:
3838
node-version: 'lts/*'
39-
- name: Install dependencies
40-
run: yarn install --frozen-lockfile
39+
- name: Install dependencies & Build
40+
run: |
41+
yarn install --frozen-lockfile
42+
yarn run build
4143
- name: Validate CommonJS bundle
4244
run: yarn validate-cjs
4345
- name: Release

.postcssrc

-5
This file was deleted.

babel.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-undef */
12
module.exports = {
23
env: {
34
production: {

e2e/add-message.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable jest/expect-expect */
22
/* eslint-disable jest/no-done-callback */
33
/* eslint-disable jest/require-top-level-describe */
4+
/* eslint-disable jest/no-commented-out-tests */
45
import selectors from './user/selectors';
56
import { test } from './user/test';
67

e2e/navigate-long-message-lists.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable jest/expect-expect */
2-
import { expect, Page } from '@playwright/test';
2+
import { Page } from '@playwright/test';
33
import * as dotenv from 'dotenv';
44

55
import selectors from './user/selectors';
@@ -12,7 +12,6 @@ import MessageList from './user/components/MessageList/MessageList';
1212
import MessageNotification, {
1313
getMessageNotificationSelector,
1414
} from './user/components/MessageList/MessageNotification';
15-
import QuotedMessage from './user/components/Message/QuotedMessage';
1615
import Thread, { composeThreadSelector } from './user/components/Thread/Thread';
1716

1817
import type { TestingUser } from './user/User';
@@ -29,8 +28,6 @@ const USER1_CHAT_VIEW_CLASSNAME = `.${user1Id}`;
2928
const NEW_MESSAGE_NOTIFICATION_TEXT = 'New Messages!' as const;
3029
const LAST_REPLY_TEXT = 'Message 299';
3130
const MESSAGES_WITH_REPLIES = ['Message 149', 'Message 137', 'Message 124', 'Message 99'];
32-
const FIRST_MESSAGE_FIRST_PAGE = 'Message 125';
33-
const QUOTED_MESSAGES = ['Message 99', 'Message 137'];
3431

3532
const scrollInSteps = async (user: TestingUser, msgNumbers = ['142', '135', '128'], cycles = 3) => {
3633
for (let i = 0; i < cycles; i++) {

examples/capacitor/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
"@capacitor/ios": "^3.2.2",
1010
"react": "link:../../node_modules/react",
1111
"react-dom": "link:../../node_modules/react-dom",
12-
"react-scripts": "3.4.1",
12+
"react-scripts": "5.0.1",
1313
"stream-chat": "link:../../node_modules/stream-chat",
1414
"stream-chat-react": "link:../../",
15-
"typescript": "4.3.5"
15+
"typescript": "5.4.2"
1616
},
1717
"devDependencies": {
1818
"@testing-library/jest-dom": "^4.2.4",
1919
"@testing-library/react": "^9.3.2",
2020
"@testing-library/user-event": "^7.1.2",
2121
"@types/jest": "^24.0.0",
2222
"@types/node": "^12.0.0",
23-
"@types/react": "^16.9.0",
24-
"@types/react-dom": "^16.9.0"
23+
"@types/react": "^18.2.67",
24+
"@types/react-dom": "^18.2.22"
2525
},
2626
"scripts": {
2727
"start": "react-scripts start",

0 commit comments

Comments
 (0)