Skip to content

Commit 5085bc2

Browse files
committed
update project and deploy
1 parent 9735b8b commit 5085bc2

18 files changed

+3403
-27
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"presets": [
3-
"latest"
3+
"env"
44
]
55
}

buildScripts/build.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// More info on Webpack's Node API here: https://webpack.github.io/docs/node.js-api.html
2+
// Allowing console calls below since this is a build file.
3+
/*eslint-disable no-console */
4+
import webpack from 'webpack';
5+
import webpackConfig from '../webpack.config.prod';
6+
import chalk from 'chalk';
7+
8+
process.env.NODE_ENV = 'production'; // this assures the Babel dev config doesn't apply.
9+
10+
console.log(chalk.blue('Generating minified bundle for production. This will take a moment...'));
11+
12+
webpack(webpackConfig).run((err, stats) => {
13+
if (err) { // so a fatal error occurred. Stop here.
14+
console.log(chalk.red(err));
15+
return 1;
16+
}
17+
18+
const jsonStats = stats.toJson();
19+
20+
if (jsonStats.hasErrors) {
21+
return jsonStats.errors.map(error => console.log(chalk.red(error)));
22+
}
23+
24+
if (jsonStats.hasWarnings) {
25+
console.log(chalk.yellow('Webpack generated the following warnings: '));
26+
jsonStats.warnings.map(warning => console.log(chalk.yellow(warning)));
27+
}
28+
29+
console.log(`Webpack stats: ${stats}`);
30+
31+
// if we got this far, the build succeeded.
32+
console.log(chalk.green('Your app has been built for production and written to /dist!'));
33+
34+
return 0;
35+
});

buildScripts/distServer.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import express from 'express';
2+
import path from 'path';
3+
import open from 'open';
4+
import compression from 'compression';
5+
6+
/*eslint-disable no-console */
7+
8+
const port = 3000;
9+
const app = express();
10+
11+
app.use(express.static('dist'));
12+
app.use(compression());
13+
14+
app.get('/', function(req, res) {
15+
res.sendFile(path.join(__dirname, '../dist/index.html'));
16+
});
17+
18+
app.listen(port, function(err) {
19+
if (err) {
20+
console.log(err);
21+
} else {
22+
open(`http://localhost:${port}`, 'google chrome');
23+
}
24+
});

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html lang="en"><head><script type="text/javascript">window._trackJs={token:"89d6af600dba433793b306596177df25"}</script><script type="text/javascript" src="https://cdn.trackjs.com/releases/current/tracker.js"></script><meta charset="UTF-8"><title>Title</title><link href="/main.c4b42eef12adba9d7df2098ed7e6b613.css" rel="stylesheet"></head><body><h1>Users</h1><table><thead><tr><th>&nbsp;</th><th>Id</th><th>First Name</th><th>Last Name</th><th>Email</th></tr></thead><tbody id="users"></tbody></table></body></html><script type="text/javascript" src="/vendor.b82a72e00cc5d4b81ab8.js"></script><script type="text/javascript" src="/main.e76b0971762ebbd04b85.js"></script>

dist/main.c4b42eef12adba9d7df2098ed7e6b613.css

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

dist/main.c4b42eef12adba9d7df2098ed7e6b613.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.e76b0971762ebbd04b85.js

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

dist/main.e76b0971762ebbd04b85.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)