Skip to content

Commit 2bf8a4a

Browse files
committed
Rewrote in React.js
1 parent c165649 commit 2bf8a4a

538 files changed

Lines changed: 3771 additions & 7176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
{
2-
presets: ['es2015']
2+
"presets": [
3+
"es2015",
4+
"stage-3",
5+
"react"
6+
],
7+
"plugins": [
8+
"transform-decorators-legacy",
9+
[
10+
"transform-builtin-extend",
11+
{
12+
"globals": [
13+
"Error"
14+
]
15+
}
16+
]
17+
]
318
}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.idea
2-
.DS_Store
32
node_modules
4-
_*
53
npm-debug.log
6-
public/*.*
4+
.DS_Store
5+
built

CONTRIBUTORS.md

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

LICENSE

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

app/backend.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const proxy = require('http-proxy-middleware');
2+
const {
3+
__PROD__,
4+
__DEV__,
5+
proxyPort,
6+
backendBuiltPath,
7+
apiEndpoint,
8+
} = require('../environment');
9+
10+
if (__DEV__) {
11+
const webpack = require('webpack');
12+
13+
const webpackConfig = require('../webpack.backend.config.js');
14+
15+
const compiler = webpack(webpackConfig);
16+
17+
let lastHash = null;
18+
let httpServer = null;
19+
compiler.watch({}, (err, stats) => {
20+
if (err) {
21+
lastHash = null;
22+
compiler.purgeInputFileSystem();
23+
console.error(err);
24+
}
25+
if (stats.hash !== lastHash) {
26+
lastHash = stats.hash;
27+
console.info(stats.toString({
28+
cached: false,
29+
colors: true
30+
}));
31+
32+
try {
33+
if (httpServer) httpServer.close();
34+
delete require.cache[require.resolve(backendBuiltPath)];
35+
const app = require(backendBuiltPath).default;
36+
httpServer = app.listen(proxyPort);
37+
} catch (e) {
38+
console.error(e);
39+
}
40+
}
41+
});
42+
} else {
43+
const app = require(backendBuiltPath).default;
44+
app.listen(proxyPort);
45+
}
46+
47+
module.exports = proxy({
48+
target: `http://localhost:${proxyPort}/`,
49+
pathRewrite: { ['^' + apiEndpoint]: '' },
50+
ws: true,
51+
});

app/frontend.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const express = require('express');
2+
3+
const {
4+
__PROD__,
5+
__DEV__,
6+
frontendSrcPath,
7+
algorithmApiSrcPath,
8+
wikiApiSrcPath,
9+
frontendBuiltPath,
10+
apiEndpoint,
11+
} = require('../environment');
12+
13+
if (__DEV__) {
14+
const path = require('path');
15+
const webpack = require('webpack');
16+
const webpackDev = require('webpack-dev-middleware');
17+
const webpackHot = require('webpack-hot-middleware');
18+
19+
const webpackConfig = require('../webpack.frontend.config.js');
20+
21+
const compiler = webpack(webpackConfig);
22+
const app = express();
23+
24+
app.use(apiEndpoint + '/algorithm', express.static(algorithmApiSrcPath));
25+
app.use(apiEndpoint + '/wiki', express.static(wikiApiSrcPath));
26+
app.use(express.static(path.resolve(frontendSrcPath, 'static')));
27+
app.use(webpackDev(compiler, {
28+
stats: {
29+
cached: false,
30+
colors: true
31+
},
32+
}));
33+
app.use(webpackHot(compiler));
34+
35+
module.exports = app;
36+
} else {
37+
module.exports = express.static(frontendBuiltPath);
38+
}

app/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const compression = require('compression');
2+
const history = require('connect-history-api-fallback');
3+
const express = require('express');
4+
const app = express();
5+
6+
const {
7+
apiEndpoint
8+
} = require('../environment');
9+
10+
const frontend = require('./frontend');
11+
//const backend = require('./backend');
12+
//app.use(apiEndpoint, backend);
13+
app.use(history());
14+
app.use(compression());
15+
app.use(frontend);
16+
17+
module.exports = app;

bin/www

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env node
2+
3+
const http = require('http');
4+
5+
const app = require('../app');
6+
const {
7+
httpPort,
8+
} = require('../environment');
9+
10+
const httpServer = http.createServer(app);
11+
httpServer.listen(httpPort);
12+
console.info(`http: listening on port ${httpPort}`);

css/font-awesome.min.css

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

css/gh-fork-ribbon.css

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

0 commit comments

Comments
 (0)