Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 59a6a12

Browse files
committed
Upgrade webpack, Babel, and React. Add TypeScript support.
1 parent 56144df commit 59a6a12

11 files changed

+9134
-6888
lines changed

.babelrc

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"presets": [
3-
"es2015",
4-
"react",
5-
"stage-0"
3+
"@babel/preset-typescript",
4+
["@babel/preset-env", { "modules": false }],
5+
["@babel/preset-react", { "runtime": "automatic" }]
66
],
77
"plugins": [
8-
"transform-flow-strip-types",
9-
"transform-decorators-legacy"
8+
"@babel/plugin-transform-flow-strip-types",
9+
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
10+
["@babel/plugin-proposal-class-properties"]
1011
]
1112
}

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false
4+
}

demo/game/character.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import Matter from 'matter-js';
55

66
import { AudioPlayer, Body, Sprite } from '../../src';
77

8-
@observer
9-
export default class Character extends Component {
8+
export default @observer class Character extends Component {
109
static propTypes = {
1110
keys: PropTypes.object,
1211
onEnterBuilding: PropTypes.func,

demo/index.js

+3-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import ReactDOM from 'react-dom/client';
33
import Presentation from './presentation';
4-
import { AppContainer } from 'react-hot-loader';
54

6-
ReactDOM.render(
7-
<AppContainer>
8-
<Presentation />
9-
</AppContainer>,
10-
document.getElementById('root')
11-
);
12-
13-
if (process.env.NODE_ENV !== 'production') {
14-
module.hot.accept('./presentation', () => {
15-
const NextPresentation = require('./presentation').default;
16-
ReactDOM.render(
17-
<AppContainer>
18-
<NextPresentation />
19-
</AppContainer>,
20-
document.getElementById('root')
21-
);
22-
});
23-
}
5+
const root = ReactDOM.createRoot(document.getElementById('root'));
6+
root.render(<Presentation />);

package.json

+32-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-game-kit",
3-
"version": "1.0.6",
3+
"version": "2.0.0-alpha.1",
44
"description": "Make games with react",
55
"main": "lib",
66
"files": [
@@ -9,8 +9,8 @@
99
"umd"
1010
],
1111
"scripts": {
12-
"start": "webpack-dev-server --hot --inline --port 3000 --config webpack.config.dev.js --content-base demo/",
13-
"build": "babel src -d lib --copy-files",
12+
"start": "webpack-dev-server --config webpack.config.dev.js",
13+
"build": "babel src -d lib --copy-files --extensions \".ts,.tsx,.js,.jsx\"",
1414
"clean": "rimraf dist",
1515
"clean-build": "rimraf lib",
1616
"clean-umd": "rimraf umd",
@@ -19,9 +19,8 @@
1919
"dist": "npm run clean && webpack && npm run copy-assets && npm run copy-html-css",
2020
"lint": "eslint src demo *.js",
2121
"lint-fix": "eslint src demo *.js --fix",
22-
"umd": "webpack --config webpack.config.umd.js",
2322
"preversion": "npm run lint",
24-
"version": "npm run clean-build && npm run build && npm run clean-umd && npm run umd"
23+
"version": "npm run clean-build && npm run build"
2524
},
2625
"author": "Ken Wheeler",
2726
"license": "MIT",
@@ -30,36 +29,41 @@
3029
"matter-js": "^0.14.0"
3130
},
3231
"devDependencies": {
33-
"babel-cli": "^6.10.1",
34-
"babel-core": "^6.10.4",
35-
"babel-eslint": "^8.0.1",
36-
"babel-loader": "^7.1.2",
37-
"babel-plugin-transform-decorators-legacy": "^1.3.4",
38-
"babel-plugin-transform-flow-strip-types": "^6.14.0",
39-
"babel-preset-es2015": "^6.9.0",
40-
"babel-preset-react": "^6.11.1",
41-
"babel-preset-stage-0": "^6.5.0",
42-
"css-loader": "^0.28.7",
43-
"eslint": "^4.8.0",
44-
"eslint-config-formidable": "^3.0.0",
45-
"eslint-plugin-filenames": "^1.1.0",
46-
"eslint-plugin-import": "^2.7.0",
47-
"eslint-plugin-jsx-a11y": "^6.0.2",
48-
"eslint-plugin-react": "^7.4.0",
49-
"json-loader": "^0.5.4",
32+
"@babel/cli": "^7.19.3",
33+
"@babel/core": "^7.19.6",
34+
"@babel/plugin-proposal-class-properties": "^7.18.6",
35+
"@babel/plugin-proposal-decorators": "^7.20.0",
36+
"@babel/plugin-transform-flow-strip-types": "^7.19.0",
37+
"@babel/preset-env": "^7.19.4",
38+
"@babel/preset-react": "^7.18.6",
39+
"@babel/preset-typescript": "^7.18.6",
40+
"babel-eslint": "^10.1.0",
41+
"babel-loader": "^9.0.1",
42+
"babel-plugin-transform-decorators-legacy": "^1.3.5",
43+
"babel-plugin-transform-flow-strip-types": "^6.22.0",
44+
"css-loader": "^6.7.1",
45+
"csstype": "^3.1.1",
46+
"eslint": "^8.26.0",
47+
"eslint-config-formidable": "^4.0.0",
48+
"eslint-plugin-filenames": "^1.3.2",
49+
"eslint-plugin-import": "^2.26.0",
50+
"eslint-plugin-jsx-a11y": "^6.6.1",
51+
"eslint-plugin-react": "^7.31.10",
52+
"json-loader": "^0.5.7",
5053
"mobx": "^3.3.0",
5154
"mobx-react": "^4.3.3",
5255
"postcss-loader": "^2.0.6",
5356
"prop-types": "^15.5.10",
54-
"raw-loader": "^0.5.1",
55-
"react": "16.0.0",
56-
"react-dom": "16.0.0",
57-
"react-hot-loader": "^3.1.3",
57+
"raw-loader": "^4.0.2",
58+
"react": "18.2.0",
59+
"react-dom": "18.2.0",
60+
"react-hot-loader": "^4.13.0",
5861
"react-native": "0.50.4",
5962
"rimraf": "^2.5.4",
6063
"style-loader": "^0.19.0",
61-
"webpack": "^3.6.0",
62-
"webpack-dev-server": "^2.9.1"
64+
"webpack": "^5.74.0",
65+
"webpack-cli": "^4.10.0",
66+
"webpack-dev-server": "^4.11.1"
6367
},
6468
"sideEffects": false
6569
}

0 commit comments

Comments
 (0)