Skip to content

Commit ccd5b67

Browse files
committed
Add support for legacy
1 parent 1020303 commit ccd5b67

File tree

13 files changed

+97
-165
lines changed

13 files changed

+97
-165
lines changed

config-overrides.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const {
2+
override,
3+
addDecoratorsLegacy,
4+
disableEsLint,
5+
} = require('customize-cra')
6+
7+
module.exports = override(
8+
// enable legacy decorators babel plugin
9+
addDecoratorsLegacy(),
10+
11+
// disable eslint in webpack
12+
disableEsLint()
13+
)

package-lock.json

Lines changed: 38 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
"@testing-library/react": "^9.5.0",
1010
"@testing-library/user-event": "^7.2.1",
1111
"autoprefixer": "^9.7.5",
12-
"babel-plugin-macros": "^2.8.0",
13-
"mobx": "5.15.4",
14-
"mobx-react": "6.1.8",
12+
"mobx": "5.15.0",
13+
"mobx-react": "6.1.4",
1514
"postcss-cli": "^7.1.0",
1615
"react": "^16.13.0",
1716
"react-dom": "^16.13.0",
@@ -22,10 +21,10 @@
2221
"scripts": {
2322
"build:css": "postcss src/index.css -o src/styles/tailwind.css",
2423
"watch:css": "postcss src/index.css -o src/styles/tailwind.css",
25-
"start": "npm run watch:css & react-scripts start",
26-
"build": "npm run build:css react-scripts build",
27-
"test": "react-scripts test",
28-
"eject": "react-scripts eject",
24+
"start": "npm run watch:css & react-app-rewired start",
25+
"build": "npm run build:css react-app-rewired build",
26+
"test": "react-app-rewired test",
27+
"eject": "react-app-rewired eject",
2928
"deploy": "export PUBLIC_URL=/2019/$C9_USER/react && npm run build && ./deploy.sh"
3029
},
3130
"eslintConfig": {
@@ -48,6 +47,9 @@
4847
"@babel/plugin-proposal-decorators": "7.7.0",
4948
"@babel/plugin-syntax-jsx": "7.2.0",
5049
"@babel/preset-env": "7.7.1",
50+
"babel-eslint": "10.0.3",
51+
"customize-cra": "0.9.1",
52+
"react-app-rewired": "2.1.5",
5153
"tailwindcss": "^1.2.0"
5254
}
5355
}

src/components/Counter/Counter.test.jsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/Counter/index.jsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/components/CounterPage/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React, { Component } from 'react'
2+
import { observer, inject } from 'mobx-react'
3+
4+
import stores from '../../stores'
5+
const counterStore = stores.counterStore
6+
7+
@observer
8+
class CounterPage extends Component {
9+
handleIncrement = () => {
10+
counterStore.incrementCounter()
11+
}
12+
13+
handleDecrement = () => {
14+
if (counterStore.count !== 0) {
15+
counterStore.decrementCounter()
16+
}
17+
}
18+
19+
render() {
20+
return (
21+
<div>
22+
<h1>{counterStore.count}</h1>
23+
<button onClick={this.handleIncrement}>+</button>
24+
<button onClick={this.handleDecrement}>-</button>
25+
</div>
26+
)
27+
}
28+
}
29+
30+
export default CounterPage

src/components/Home/index.jsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
33

4-
import * as serviceWorker from "./serviceWorker";
5-
import App from "./routes/App";
6-
import "./styles/tailwind.css";
4+
import * as serviceWorker from './serviceWorker'
5+
import App from './App'
6+
import './styles/tailwind.css'
77

8-
ReactDOM.render(<App />, document.getElementById("root"));
8+
ReactDOM.render(<App />, document.getElementById('root'))
99

1010
// If you want your app to work offline and load faster, you can change
1111
// unregister() to register() below. Note this comes with some pitfalls.
1212
// Learn more about service workers: https://bit.ly/CRA-PWA
13-
serviceWorker.unregister();
13+
serviceWorker.unregister()

src/routes/App/App.test.jsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/routes/App/index.jsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)