Skip to content

Commit a37e5bb

Browse files
committed
JavaScript dev environment setup
1 parent 1199512 commit a37e5bb

File tree

13 files changed

+10740
-0
lines changed

13 files changed

+10740
-0
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"latest"
4+
]
5+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:import/errors",
6+
"plugin:import/warnings"
7+
],
8+
"parserOptions": {
9+
"ecmaVersion": 7,
10+
"sourceType": "module"
11+
},
12+
"env": {
13+
"browser": true,
14+
"node": true,
15+
"mocha": true
16+
},
17+
"rules": {
18+
"no-console": 1
19+
}
20+
}

buildScripts/srcServer.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import express from 'express';
2+
import path from 'path';
3+
import open from 'open';
4+
import webpack from 'webpack';
5+
import config from '../webpack.config.dev';
6+
7+
/*eslint-disable no-console */
8+
9+
const port = 3000;
10+
const app = express();
11+
const compiler = webpack(config);
12+
13+
app.use(require('webpack-dev-middleware') (compiler, {
14+
noInfo: true,
15+
publicPath: config.output.publicPath
16+
}));
17+
18+
app.get('/', function(req, res) {
19+
res.sendFile(path.join(__dirname, '../src/index.html'));
20+
});
21+
22+
app.listen(port, function(err) {
23+
if (err) {
24+
console.log(err);
25+
} else {
26+
open('http://localhost:' + port);
27+
}
28+
});

buildScripts/startMessage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import chalk from 'chalk';
2+
3+
console.log(chalk.green('Starting the application in dev mode...')); //eslint-disable-line no-console

buildScripts/testSetup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file isn't transpiled, so must use CommonJS and ES5
2+
3+
// Register babel to transpile before our tests run.
4+
require('babel-register')();
5+
6+
// Disable webpack features that Mocha doesn't understand.
7+
require.extensions['.css'] = function() {};

0 commit comments

Comments
 (0)