Skip to content

Commit

Permalink
update react
Browse files Browse the repository at this point in the history
  • Loading branch information
ahjyrkia committed Jan 31, 2024
1 parent 39dfd02 commit 82af63b
Show file tree
Hide file tree
Showing 12 changed files with 1,279 additions and 973 deletions.
18 changes: 15 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"presets": ["react", "env", "stage-0"],
"plugins": ["transform-runtime", "react-hot-loader/babel"]
}
"presets": [
"@babel/preset-react",
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-transform-runtime"
],
"env": {
"development": {
"plugins": [
"react-refresh/babel"
]
}
}
}
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
},
"homepage": "https://github.com/HSLdevcom/hsl-map-publisher#readme",
"engines": {
"node": ">=8.0.0"
"node": ">=14.0.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"@babel/core": "^7.23.9",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"babel-eslint": "^9.0.0",
"babel-loader": "^7.1.4",
"babel-loader": "^8.3.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"cross-env": "^5.1.1",
"css-loader": "^0.28.7",
"eslint": "^5.8.0",
Expand All @@ -67,21 +68,22 @@
"husky": "^8.0.0",
"lint-staged": "^13.0.2",
"prettier": "^1.14.3",
"react-refresh": "^0.14.0",
"webpack-cli": "^3.0.8",
"webpack-serve": "^1.0.4",
"worker-loader": "^2.0.0"
},
"dependencies": {
"@azure/storage-blob": "^10.4.0",
"@koa/cors": "^2.2.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@turf/turf": "^6.5.0",
"apollo-cache-inmemory": "^1.1.1",
"apollo-client": "^2.0.3",
"apollo-link": "^1.2.2",
"apollo-link-http": "^1.2.0",
"babel-plugin-transform-runtime": "^6.23.0",

"babel-polyfill": "^6.26.0",
"babel-preset-stage-0": "^6.24.1",
"bullmq": "^1.86.2",
"cheerio": "=1.0.0-rc.3",
"classnames": "^2.2.5",
Expand Down Expand Up @@ -112,10 +114,9 @@
"qrcode": "^1.0.0",
"qs": "^6.5.2",
"raw-loader": "^0.5.1",
"react": "^16.5.1",
"react": "18.2.0",
"react-apollo": "^2.0.1",
"react-dom": "^16.5.1",
"react-hot-loader": "^4.3.3",
"react-dom": "18.2.0",
"react-measure": "^2.5.2",
"recompose": "^0.30.0",
"segseg": "^0.2.2",
Expand Down
3 changes: 1 addition & 2 deletions src/components/a3Timetable/a3Timetable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { hot } from 'react-hot-loader';
import { chunk, last, groupBy, findIndex } from 'lodash';
import renderQueue from 'util/renderQueue';

Expand Down Expand Up @@ -454,4 +453,4 @@ Timetable.propTypes = {
updateHook: PropTypes.func.isRequired,
};

export default hot(module)(Timetable);
export default Timetable;
3 changes: 1 addition & 2 deletions src/components/a3stopPoster/a3stopPoster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { hot } from 'react-hot-loader';
import { JustifiedColumn } from 'components/util';
import renderQueue from 'util/renderQueue';
import { colorsByMode } from 'util/domain';
Expand Down Expand Up @@ -203,4 +202,4 @@ A3StopPoster.defaultProps = {
routeFilter: '',
};

export default hot(module)(A3StopPoster);
export default A3StopPoster;
3 changes: 1 addition & 2 deletions src/components/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
import { hot } from 'react-hot-loader';
import { ApolloClient } from 'apollo-client';
import { createHttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
Expand Down Expand Up @@ -118,4 +117,4 @@ class App extends Component {
}
}

export default hot(module)(App);
export default App;
3 changes: 1 addition & 2 deletions src/components/stopPoster/stopPoster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { hot } from 'react-hot-loader';
import { get, cloneDeep } from 'lodash';
import { JustifiedColumn, Spacer } from 'components/util';
import renderQueue from 'util/renderQueue';
Expand Down Expand Up @@ -526,4 +525,4 @@ StopPoster.defaultProps = {
legend: false,
};

export default hot(module)(StopPoster);
export default StopPoster;
3 changes: 1 addition & 2 deletions src/components/stopPoster/terminalPoster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { hot } from 'react-hot-loader';
import { get, cloneDeep } from 'lodash';
import { JustifiedColumn, Spacer } from 'components/util';
import renderQueue from 'util/renderQueue';
Expand Down Expand Up @@ -532,4 +531,4 @@ TerminalPoster.defaultProps = {
legend: false,
};

export default hot(module)(TerminalPoster);
export default TerminalPoster;
2 changes: 1 addition & 1 deletion src/components/timetable/timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Timetable extends Component {
? `${getWeekdayName(dayNames[0], 'en')} - ${getWeekdayName(dayNames[1], 'en')}`
: `${getWeekdayName(dayNames[0], 'en')}`;
return (
<div>
<div key={`tableheader_container_${fiTitle}`}>
<TableHeader
title={fiTitle}
subtitleSw={svTitle}
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';
import App from 'components/app';
import 'styles/base.css';
import './util/mockGetTemplate';
Expand All @@ -8,6 +8,7 @@ if (!window.serverLog) {
window.serverLog = console.log.bind(console);
}

const root = document.body.appendChild(document.createElement('div'));
const container = document.body.appendChild(document.createElement('div'));
const root = createRoot(container);

render(<App />, root);
root.render(<App />);
11 changes: 11 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const Dotenv = require('dotenv-webpack');

const isDevelopment = process.env.NODE_ENV !== 'production';

module.exports = {
entry: ['babel-polyfill', './src/index.js'],
plugins: [
Expand Down Expand Up @@ -59,6 +62,14 @@ module.exports = {
test: /\.svg$/,
loader: 'raw-loader',
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
plugins: [isDevelopment && require.resolve('react-refresh/babel')].filter(Boolean),
},
},
],
},
};
2 changes: 2 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const merge = require('webpack-merge');
const webpackCommon = require('./webpack.common');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');

const PORT = process.env.PORT || 5000;

Expand All @@ -12,4 +13,5 @@ module.exports = merge.smart(webpackCommon, {
hmr: true,
},
},
plugins: [new ReactRefreshWebpackPlugin()],
});
Loading

0 comments on commit 82af63b

Please sign in to comment.