Skip to content

Commit 33556b9

Browse files
Merge pull request #84 from opudalo/update-deps
update react, typescript and jest
2 parents 26a1dc8 + 047082b commit 33556b9

20 files changed

Lines changed: 3915 additions & 4515 deletions

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ state.subscribe(x => {
6464
})
6565

6666
// render the app
67-
ReactDOM.render(
68-
<App state={state} />,
69-
document.getElementById('app')
70-
)
67+
const root = createRoot(document.getElementById('app'))
68+
root.render(<App state={state} />)
7169
```
7270
7371
You can play with this example online [on CodeSandbox](https://codesandbox.io/s/black-bash-u6l9x).
@@ -193,10 +191,8 @@ const Counter = (props: { count: Atom<number> }) =>
193191
</F.div>
194192

195193
// mount the component onto DOM
196-
ReactDOM.render(
197-
<Counter count={count} />,
198-
document.getElementById('test')
199-
)
194+
const root = createRoot(document.getElementById('test'))
195+
root.render(<Counter count={count} />)
200196

201197
// => <div>Count: 0</div>
202198
```

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
"eslint": "^7.18.0",
2121
"eslint-plugin-jsdoc": "^31.0.8",
2222
"eslint-plugin-react": "^7.22.0",
23-
"typescript": "3.6.4"
23+
"typescript": "^4.7.4"
2424
},
2525
"workspaces": [
2626
"packages/focal",
2727
"packages/test",
2828
"packages/examples/*"
2929
],
3030
"resolutions": {
31-
"@types/react": "16.9.11"
31+
"@types/react": "^18.0.14",
32+
"@types/react-dom": "^18.0.0"
3233
}
3334
}

packages/examples/all/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@
2222
"license": "Apache-2.0",
2323
"devDependencies": {
2424
"@grammarly/focal": "0.8.5",
25-
"@grammarly/tslint-config": "0.5.1",
26-
"@types/react": "16.9.11",
27-
"@types/react-dom": "16.9.3",
25+
"@types/react": "^18.0.14",
26+
"@types/react-dom": "^18.0.0",
2827
"css-loader": "^3.2.0",
2928
"eslint": "^7.18.0",
3029
"eslint-webpack-plugin": "^2.5.3",
3130
"express": "^4.14.0",
32-
"react": "16.11.0",
33-
"react-dom": "16.11.0",
31+
"react": "^18.0.0",
32+
"react-dom": "^18.0.0",
3433
"react-transform-catch-errors": "^1.0.2",
3534
"react-transform-hmr": "^1.0.4",
3635
"redbox-react": "^1.3.0",
3736
"rxjs": "6.3.3",
3837
"style-loader": "^1.0.0",
3938
"todomvc-app-css": "^2.0.6",
40-
"ts-loader": "^6.2.1",
39+
"ts-loader": "8.2.0",
4140
"tslint": "5.20.0",
42-
"typescript": "3.6.4",
41+
"typescript": "^4.7.4",
4342
"webpack": "^4.41.2",
4443
"webpack-bundle-analyzer": "^3.6.0",
4544
"webpack-cli": "^3.3.9",

packages/examples/all/src/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from 'react'
21
import { Atom, Lens } from '@grammarly/focal'
2+
import * as React from 'react'
33

44
interface ExampleComponent<S> {
5-
Component: React.StatelessComponent<{ state: Atom<S> }>
5+
Component: React.FunctionComponent<{ state: Atom<S> }>
66
defaultState: S
77
}
88

packages/examples/all/src/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from 'react'
2-
import * as ReactDOM from 'react-dom'
31
import { Atom } from '@grammarly/focal'
2+
import * as React from 'react'
3+
import { createRoot } from 'react-dom/client'
44
import * as App from './app'
55

66
// hot reload support
@@ -23,7 +23,8 @@ function startApp(C: typeof App.AppComponent) {
2323
if (targetEl == null)
2424
throw new Error('React app target element not found. Wrong HTML file?')
2525

26-
ReactDOM.render(<C state={appState} />, targetEl)
26+
const root = createRoot(targetEl)
27+
root.render(<C state={appState} />)
2728
}
2829

2930
if (module.hot) {

packages/examples/todomvc/package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,24 @@
2222
"license": "Apache-2.0",
2323
"devDependencies": {
2424
"@grammarly/focal": "0.8.5",
25-
"@grammarly/tslint-config": "0.5.1",
26-
"@types/react": "16.9.11",
27-
"@types/react-dom": "16.9.3",
28-
"express": "^4.14.0",
25+
"@types/react": "^18.0.14",
26+
"@types/react-dom": "^18.0.0",
2927
"eslint": "^7.18.0",
3028
"eslint-webpack-plugin": "^2.5.3",
31-
"react": "16.11.0",
32-
"react-dom": "16.11.0",
29+
"express": "^4.14.0",
30+
"react": "^18.0.0",
31+
"react-dom": "^18.0.0",
3332
"react-transform-catch-errors": "^1.0.2",
3433
"react-transform-hmr": "^1.0.4",
3534
"redbox-react": "^1.3.0",
3635
"rxjs": "6.3.3",
3736
"todomvc-app-css": "^2.0.6",
38-
"ts-loader": "^6.2.1",
39-
"typescript": "3.6.4",
37+
"ts-loader": "8.2.0",
38+
"typescript": "^4.7.4",
4039
"webpack": "^4.41.2",
40+
"webpack-bundle-analyzer": "^3.6.0",
4141
"webpack-cli": "^3.3.9",
4242
"webpack-dev-middleware": "^3.7.2",
43-
"webpack-hot-middleware": "^2.25.0",
44-
"webpack-bundle-analyzer": "^3.6.0"
43+
"webpack-hot-middleware": "^2.25.0"
4544
}
4645
}

packages/examples/todomvc/src/app.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { Atom, bind, classes, F, Lens, reactiveList } from '@grammarly/focal'
12
import * as React from 'react'
2-
import * as ReactDOM from 'react-dom'
3-
import { fromEvent, defer } from 'rxjs'
3+
import { createRoot } from 'react-dom/client'
4+
import { defer, fromEvent } from 'rxjs'
45
import { combineLatest, map, startWith } from 'rxjs/operators'
5-
import { F, Atom, Lens, bind, reactiveList, classes } from '@grammarly/focal'
6-
import { TodoItem, AppModel } from './model'
6+
import { AppModel, TodoItem } from './model'
77

88
const locationHash = defer(() =>
99
fromEvent(window, 'hashchange').pipe(
@@ -208,9 +208,9 @@ export class App {
208208
) {}
209209

210210
start() {
211-
ReactDOM.render(
212-
<AppComponent model={this._model}/>,
213-
this._targetElement
211+
const root = createRoot(this._targetElement)
212+
root.render(
213+
<AppComponent model={this._model}/>
214214
)
215215
}
216216
}

packages/focal/jest-shim.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
global.TextEncoder = require ('util').TextEncoder
2+
global.TextDecoder = require ('util').TextDecoder

packages/focal/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
'ts',
66
'tsx',
77
],
8+
setupFiles: [`<rootDir>/jest-shim.js`],
89
testEnvironment: 'jest-environment-jsdom',
910
testMatch: [
1011
'**/*.test.ts?(x)',

packages/focal/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,24 @@
9393
"type": "git",
9494
"url": "https://github.com/grammarly/focal.git"
9595
},
96-
"dependencies": {},
9796
"devDependencies": {
9897
"@types/jest": "24.0.20",
99-
"@types/node": "^6.0.34",
100-
"@types/react": "16.9.11",
101-
"@types/react-dom": "16.9.3",
102-
"jest": "^24.1.0",
103-
"react": "16.11.0",
104-
"react-dom": "16.11.0",
98+
"@types/node": "^18.0.0",
99+
"@types/react": "^18.0.14",
100+
"@types/react-dom": "^18.0.0",
101+
"jest": "^28.1.1",
102+
"jest-environment-jsdom": "^28.1.1",
103+
"react": "^18.0.0",
104+
"react-dom": "^18.0.0",
105105
"rxjs": "6.3.3",
106-
"ts-jest": "^23.10.5",
107-
"typescript": "3.6.4"
106+
"ts-jest": "^28.0.5",
107+
"typescript": "^4.7.4"
108108
},
109109
"peerDependencies": {
110-
"@types/react": ">= 16.9.11 < 17.0.0-0",
111-
"@types/react-dom": ">= 16.9.3 < 17.0.0-0",
112-
"react": ">= 16.11.0 < 17.0.0-0",
113-
"react-dom": ">= 16.11.0 < 17.0.0-0",
110+
"@types/react": ">= 18.0.0 < 19.0.0-0",
111+
"@types/react-dom": ">= 18.0.0 < 19.0.0-0",
112+
"react": ">= 18.0.0 < 19.0.0-0",
113+
"react-dom": ">= 18.0.0 < 19.0.0-0",
114114
"rxjs": ">= 6.3.3 < 7.0.0-0"
115115
}
116116
}

0 commit comments

Comments
 (0)