Skip to content

Commit 35c29d4

Browse files
authored
feat: match supported browsers with the @dittolive/ditto package. see [Ditto's documentation](https://docs.ditto.live/compatibility/js-web) for details.
- Upgrades dependencies to latest compatible versions, - removes pinning of `react` and `react-dom` dev-dependencies (were pinned to v18.0.0), - updates @dittolive/ditto usage following update to latest version, - adds `karma.conf.js` to `.eslintignore` as the project is using a Typescript linter, - configures `karma-typescript` to handle ES2020 syntax used by `cbor` library (fixes #48), - updates targeted browsers to match https://docs.ditto.live/compatibility/js-web, - and applies all the updated linter / code style rules to the existing code. Example project - Upgrades dependencies, - fixes test code, - and adds a `TextEncoder` polyfill required for JSDom to support @dittolive/ditto. CI - Upgrades Github Actions versions and Node.js version used.
1 parent da7216d commit 35c29d4

21 files changed

+9508
-10069
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
33
!.mocharc.js
4+
karma.conf.js

.github/workflows/ci.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ jobs:
55
name: Continuous Deployment
66
runs-on: ubuntu-latest
77
steps:
8-
# - name: 'Updating Upun'
9-
# run: sudo apt-get update && sudo apt-get install -y libgbm-dev
108
- name: 'Checkout Repository'
11-
uses: actions/checkout@v2
12-
9+
uses: actions/checkout@v4
10+
1311
- name: 'Setup Node'
14-
uses: actions/setup-node@v2
12+
uses: actions/setup-node@v4
1513
with:
16-
node-version: '14'
17-
14+
node-version: '20'
15+
1816
- name: 'Setup Chrome'
1917
uses: browser-actions/setup-chrome@latest
20-
18+
2119
- name: 'Install and Build'
2220
run: |
2321
yarn
@@ -27,13 +25,13 @@ jobs:
2725
yarn types
2826
yarn lint
2927
yarn build
30-
28+
3129
- name: 'Run Tests'
3230
run: CHROMIUM_BIN=$(which chrome) yarn test
33-
31+
3432
- name: 'Generate Documentation Website'
3533
run: yarn docs:generate
36-
34+
3735
- name: Deploy Documentation Website 🚀
3836
if: github.ref == 'refs/heads/master'
3937
uses: JamesIves/[email protected]

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ All notable changes to this project will be documented in this file. See [standa
44

55
## [0.11.0](https://github.com/getditto/react-ditto/compare/v0.11.0-alpha.0...v0.11.0) (2023-03-22)
66

7-
87
### ⚠ BREAKING CHANGES
98

109
* upgrade `@dittolive/ditto` peer dependency to ^4.0.0

examples/create-react-app-typescript-example/package.json

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
"dependencies": {
66
"@dittolive/ditto": "link:../../node_modules/@dittolive/ditto",
77
"@dittolive/react-ditto": "link:../..",
8-
"@testing-library/jest-dom": "^5.11.4",
9-
"@testing-library/react": "^11.1.0",
10-
"@testing-library/user-event": "^12.1.10",
11-
"@types/jest": "^26.0.15",
12-
"@types/node": "^12.0.0",
13-
"@types/react": "^18.0.5",
14-
"@types/react-dom": "^18.0.0",
8+
"@testing-library/jest-dom": "^6.4.2",
9+
"@testing-library/react": "^15.0.2",
10+
"@testing-library/user-event": "^14.5.2",
11+
"@types/jest": "^29.5.12",
12+
"@types/node": "^20.12.7",
13+
"@types/react": "^18.2.79",
14+
"@types/react-dom": "^18.2.25",
1515
"react": "link:../../node_modules/react",
1616
"react-dom": "link:../../node_modules/react-dom",
17-
"react-scripts": "4.0.3",
18-
"react-select": "^5.3.0",
19-
"typescript": "^4.1.2",
20-
"uuid": "^8.3.2",
21-
"web-vitals": "^1.0.1"
17+
"react-scripts": "5.0.1",
18+
"react-select": "^5.8.0",
19+
"typescript": "^4.9",
20+
"uuid": "^9.0.1",
21+
"web-vitals": "^3.5.2"
2222
},
2323
"scripts": {
2424
"start": "react-scripts start",
@@ -45,14 +45,17 @@
4545
]
4646
},
4747
"devDependencies": {
48-
"@types/uuid": "^8.3.1",
49-
"eslint": "^7.32.0",
50-
"eslint-config-prettier": "8.3.0",
51-
"eslint-plugin-prettier": "^4.0.0",
52-
"eslint-plugin-react": "^7.26.0",
53-
"eslint-plugin-react-hooks": "^4.2.0",
54-
"eslint-plugin-simple-import-sort": "^7.0.0",
55-
"prettier": "2.4.1",
56-
"prettier-eslint": "^13.0.0"
48+
"@types/uuid": "^9.0.8",
49+
"eslint": "^8.0.0",
50+
"eslint-config-prettier": "9.1.0",
51+
"eslint-plugin-prettier": "^5.1.3",
52+
"eslint-plugin-react": "^7.34.1",
53+
"eslint-plugin-react-hooks": "^4.6.0",
54+
"eslint-plugin-simple-import-sort": "^12.1.0",
55+
"prettier": "3.2.5",
56+
"prettier-eslint": "^16.3.0"
57+
},
58+
"engines": {
59+
"node": ">=18"
5760
}
5861
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { render, screen } from '@testing-library/react'
2-
import React from 'react'
32

43
import App from './App'
54

65
test('renders learn react link', () => {
7-
render(<App />)
8-
const linkElement = screen.getByText(/learn react/i)
6+
render(<App path="tasks" />)
7+
const linkElement = screen.getByText(/Using Ditto with path/i)
98
expect(linkElement).toBeInTheDocument()
109
})

examples/create-react-app-typescript-example/src/setupTests.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
// expect(element).toHaveTextContent(/react/i)
44
// learn more: https://github.com/testing-library/jest-dom
55
import '@testing-library/jest-dom'
6+
7+
// JSDom, which is used by @testing-library/react, doesn't support TextEncoder and TextDecoder,
8+
// even though they have broad support in modern browsers. This polyfill adds them to the global
9+
// object so that they can be used by @dittolive/ditto.
10+
// cf. https://github.com/jsdom/jsdom/issues/2524
11+
import { TextEncoder, TextDecoder } from 'util'
12+
global.TextEncoder = TextEncoder
13+
// @ts-ignore
14+
global.TextDecoder = TextDecoder

0 commit comments

Comments
 (0)