Skip to content

Commit 77cd5e5

Browse files
authored
Merge pull request #397 from carlosms/bump-react-scripts
[Update create-react-app to 2.x
2 parents ec3d11a + 2318bc3 commit 77cd5e5

15 files changed

+4488
-4272
lines changed

frontend/config-overrides.js

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

frontend/craco.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const CracoLessPlugin = require('craco-less');
2+
const { ESLINT_MODES } = require('@craco/craco');
3+
4+
module.exports = {
5+
plugins: [{ plugin: CracoLessPlugin }],
6+
eslint: {
7+
mode: ESLINT_MODES.file
8+
}
9+
};

frontend/package.json

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,29 @@
44
"version": "0.1.0",
55
"private": true,
66
"dependencies": {
7+
"@craco/craco": "^4.1.0",
78
"abortcontroller-polyfill": "^1.3.0",
89
"bootstrap": "3",
910
"codemirror": "^5.45.0",
11+
"craco-less": "^1.7.0",
12+
"http-proxy-middleware": "^0.19.1",
1013
"nanoid": "^2.0.1",
1114
"prop-types": "^15.7.2",
1215
"react": "^16.8.6",
1316
"react-bootstrap": "^0.32.1",
1417
"react-codemirror2": "^5.0.1",
1518
"react-dom": "^16.8.6",
1619
"react-helmet": "^5.2.0",
17-
"react-scripts": "1.1.5",
20+
"react-scripts": "2.1.8",
1821
"react-split-pane": "^0.1.87",
1922
"react-switch": "^4.1.0",
2023
"react-table": "^6.9.2",
2124
"uast-viewer": "^0.4.0"
2225
},
2326
"scripts": {
24-
"start": "react-app-rewired start",
25-
"build": "react-app-rewired build",
26-
"test": "react-app-rewired test --env=jsdom",
27+
"start": "craco start",
28+
"build": "craco build",
29+
"test": "craco test",
2730
"eject": "react-scripts eject",
2831
"lint": "eslint 'src/**/*.js'",
2932
"format": "eslint --fix 'src/**/*.js'"
@@ -32,7 +35,6 @@
3235
"@ungap/url-search-params": "^0.1.2",
3336
"enzyme": "^3.9.0",
3437
"enzyme-adapter-react-16": "^1.11.2",
35-
"eslint": "^5.16.0",
3638
"eslint-config-airbnb-base": "^13.1.0",
3739
"eslint-config-prettier": "^4.1.0",
3840
"eslint-plugin-import": "^2.16.0",
@@ -42,36 +44,13 @@
4244
"jest-fetch-mock": "^2.1.2",
4345
"node-localstorage": "^1.3.1",
4446
"prettier": "^1.16.4",
45-
"react-app-rewire-less": "^2.1.1",
46-
"react-app-rewire-svg-react-loader": "codebandits/react-app-rewire-svg-react-loader",
47-
"react-app-rewired": "^1.5.2",
4847
"react-test-renderer": "^16.8.6",
4948
"whatwg-url": "^7.0.0"
5049
},
51-
"proxy": {
52-
"/query": {
53-
"target": "http://localhost:8080"
54-
},
55-
"/export": {
56-
"target": "http://localhost:8080"
57-
},
58-
"/schema": {
59-
"target": "http://localhost:8080"
60-
},
61-
"/detect-lang": {
62-
"target": "http://localhost:8080"
63-
},
64-
"/parse": {
65-
"target": "http://localhost:8080"
66-
},
67-
"/get-languages": {
68-
"target": "http://localhost:8080"
69-
},
70-
"/filter": {
71-
"target": "http://localhost:8080"
72-
},
73-
"/version": {
74-
"target": "http://localhost:8080"
75-
}
76-
}
50+
"browserslist": [
51+
">0.2%",
52+
"not dead",
53+
"not ie <= 11",
54+
"not op_mini all"
55+
]
7756
}

frontend/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import UASTViewer from './components/UASTViewer';
1212
import api from './api';
1313
import { STATUS_LOADING, STATUS_ERROR, STATUS_SUCCESS } from './state/query';
1414
import './App.less';
15-
import CloseIcon from './icons/close-query-tab.svg';
15+
import { ReactComponent as CloseIcon } from './icons/close-query-tab.svg';
1616

1717
const INACTIVE_TIMEOUT = 3600000;
1818

frontend/src/components/CodeViewer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Switch from 'react-switch';
77
import UASTViewerPane from './UASTViewerPane';
88
import api from '../api';
99
import './CodeViewer.less';
10-
import CloseIcon from '../icons/close-query-tab.svg';
10+
import { ReactComponent as CloseIcon } from '../icons/close-query-tab.svg';
1111

1212
function EditorPane({ languages, language, handleLangChange, editorProps }) {
1313
return (
@@ -132,6 +132,7 @@ class CodeViewer extends Component {
132132
.catch(err => {
133133
// we don't have UI for this error and actually it's not very important
134134
// user can select language manualy
135+
// eslint-disable-next-line no-console
135136
console.error(`can't detect language: ${err}`);
136137
})
137138
.then(() => this.setState({ loading: false }));

frontend/src/components/HelpModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import { Modal } from 'react-bootstrap';
33
import PropTypes from 'prop-types';
4-
import CloseIcon from '../icons/close-query-tab.svg';
4+
import { ReactComponent as CloseIcon } from '../icons/close-query-tab.svg';
55
import './HelpModal.less';
66

77
class HelpModal extends Component {

frontend/src/components/QueryBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'codemirror/addon/hint/sql-hint';
1313

1414
import HelpModal from './HelpModal';
1515
import './QueryBox.less';
16-
import HelpIcon from '../icons/help.svg';
16+
import { ReactComponent as HelpIcon } from '../icons/help.svg';
1717

1818
class QueryBox extends Component {
1919
constructor(props) {

frontend/src/components/SampleQueries.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import './SampleQueries.less';
4-
import ExampleIcon from '../icons/example-query.svg';
4+
import { ReactComponent as ExampleIcon } from '../icons/example-query.svg';
55

66
function SampleQueries({ onExampleClick, exampleQueries }) {
77
return (

frontend/src/components/Schema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import './Schema.less';
4-
import OpenIcon from '../icons/open-tree.svg';
5-
import CloseIcon from '../icons/close-tree.svg';
6-
import ColumnIcon from '../icons/tree-column.svg';
4+
import { ReactComponent as OpenIcon } from '../icons/open-tree.svg';
5+
import { ReactComponent as CloseIcon } from '../icons/close-tree.svg';
6+
import { ReactComponent as ColumnIcon } from '../icons/tree-column.svg';
77

88
class SchemaTable extends Component {
99
constructor(props) {

frontend/src/components/Sidebar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import SplitPane from 'react-split-pane';
44
import Schema from './Schema';
55
import SampleQueries from './SampleQueries';
66
import './Sidebar.less';
7-
import CollapseIcon from '../icons/collapse-left-column.svg';
8-
import LinkIcon from '../icons/links.svg';
7+
import { ReactComponent as CollapseIcon } from '../icons/collapse-left-column.svg';
8+
import { ReactComponent as LinkIcon } from '../icons/links.svg';
99

1010
class Sidebar extends Component {
1111
constructor(props) {

frontend/src/components/TabbedResults.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import ResultsTable from './ResultsTable';
1313
import HistoryTable from './HistoryTable';
1414
import CodeViewer from './CodeViewer';
1515
import './TabbedResults.less';
16-
import PencilIcon from '../icons/edit-query-tab-name.svg';
17-
import CloseIcon from '../icons/close-query-tab.svg';
18-
import TimerIcon from '../icons/history-tab.svg';
16+
import { ReactComponent as PencilIcon } from '../icons/edit-query-tab-name.svg';
17+
import { ReactComponent as CloseIcon } from '../icons/close-query-tab.svg';
18+
import { ReactComponent as TimerIcon } from '../icons/history-tab.svg';
1919
import LoadingImg from '../icons/alex-loading-results.gif';
2020
import SuspendedImg from '../icons/alex-suspended-tab.gif';
2121
import ErrorImg from '../icons/broken-alex.gif';
22-
import SuccessIcon from '../icons/success-query.svg';
23-
import ErrorIcon from '../icons/error-query.svg';
22+
import { ReactComponent as SuccessIcon } from '../icons/success-query.svg';
23+
import { ReactComponent as ErrorIcon } from '../icons/error-query.svg';
2424

2525
class TabTitle extends Component {
2626
constructor(props) {

frontend/src/components/UASTViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33
import { expandRootIds, uastV2 } from 'uast-viewer';
44
import UASTViewerPane from './UASTViewerPane';
55
import api from '../api';
6-
import CloseIcon from '../icons/close-query-tab.svg';
6+
import { ReactComponent as CloseIcon } from '../icons/close-query-tab.svg';
77

88
// Same values as the ones applied by withUASTEditor in CodeViewer.js
99
// https://github.com/bblfsh/uast-viewer/blob/v0.2.0/src/withUASTEditor.js#L208

frontend/src/components/__snapshots__/ResultsTable.test.js.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ exports[`ResultsTable text with new lines should be shown as code 1`] = `
88
<div
99
className="rt-table"
1010
role="grid"
11-
style={undefined}
1211
>
1312
<div
1413
className="rt-thead -header"
@@ -21,7 +20,6 @@ exports[`ResultsTable text with new lines should be shown as code 1`] = `
2120
<div
2221
className="rt-tr"
2322
role="row"
24-
style={undefined}
2523
>
2624
<div
2725
className="rt-th rt-resizable-header -cursor-pointer"
@@ -88,7 +86,6 @@ exports[`ResultsTable text with new lines should be shown as code 1`] = `
8886
<div
8987
className="rt-tr -odd"
9088
role="row"
91-
style={undefined}
9289
>
9390
<div
9491
className="rt-td"
@@ -134,7 +131,6 @@ exports[`ResultsTable text with new lines should be shown as code 1`] = `
134131
>
135132
<div
136133
className="-pagination"
137-
style={undefined}
138134
>
139135
<div
140136
className="-previous"

frontend/src/setupProxy.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const proxy = require('http-proxy-middleware');
2+
3+
module.exports = function(app) {
4+
[
5+
'/query',
6+
'/export',
7+
'/schema',
8+
'/detect-lang',
9+
'/parse',
10+
'/get-languages',
11+
'/filter',
12+
'/version'
13+
].forEach(path => app.use(proxy(path, { target: 'http://localhost:8080' })));
14+
};

0 commit comments

Comments
 (0)