This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert bin and config to es6, add lint coverage to them
- Loading branch information
Showing
13 changed files
with
220 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,3 @@ | ||
#!/usr/bin/env node | ||
var webpack = require('webpack'); | ||
var webpackConfig = require('./merge-configs'); | ||
var fs = require('fs'); | ||
var buildStats = false; | ||
|
||
console.log('\nBuilding webpack bundle...'); | ||
webpack(webpackConfig, function(err, stats) { | ||
if(err) { | ||
console.log('Webpack build had fatal error:', err); | ||
return; | ||
} | ||
|
||
var options = { | ||
hash: true, | ||
version: true, | ||
timings: true, | ||
assets: true, | ||
chunks: false, | ||
colors: true | ||
} | ||
|
||
console.log('Webpack compile was successful.'); | ||
|
||
var jsonStats = stats.toJson(); | ||
if(jsonStats.errors.length > 0) { | ||
console.log('Webpack had errors.'); | ||
options.errors = true; | ||
} | ||
if(jsonStats.warnings.length > 0) { | ||
console.log('Webpack had warnings.'); | ||
options.warnings = true; | ||
} | ||
|
||
console.log(stats.toString(options)); | ||
|
||
if(buildStats) { | ||
fs.writeFile('./webpack-stats.json', JSON.stringify(stats.toJson()), function(err) { | ||
if(err) { | ||
return console.log(err); | ||
} | ||
|
||
console.log('Webpack output stats were saved to', outputStatsPath); | ||
}); | ||
} | ||
}); | ||
require('./transpile'); // babel registration (runtime transpilation for node) | ||
require('./build_es6.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env node | ||
const webpack = require('webpack'); | ||
const webpackConfig = require('./merge-configs'); | ||
const fs = require('fs'); | ||
const buildStats = false; | ||
const outputStatsPath = './webpack-stats.json'; | ||
|
||
console.log('\nBuilding webpack bundle...'); | ||
webpack(webpackConfig, (err, stats) => { | ||
if (err) { | ||
console.log('Webpack build had fatal error:', err); | ||
return; | ||
} | ||
|
||
const options = { | ||
hash: true, | ||
version: true, | ||
timings: true, | ||
assets: true, | ||
chunks: false, | ||
colors: true | ||
}; | ||
|
||
console.log('Webpack compile was successful.'); | ||
|
||
const jsonStats = stats.toJson(); | ||
if (jsonStats.errors.length > 0) { | ||
console.log('Webpack had errors.'); | ||
options.errors = true; | ||
} | ||
if (jsonStats.warnings.length > 0) { | ||
console.log('Webpack had warnings.'); | ||
options.warnings = true; | ||
} | ||
|
||
console.log(stats.toString(options)); | ||
|
||
if (buildStats) { | ||
fs.writeFile(outputStatsPath, JSON.stringify(stats.toJson()), (writeError) => { | ||
if (writeError) { | ||
return console.log(writeError); | ||
} | ||
|
||
console.log('Webpack output stats were saved to', outputStatsPath); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,3 @@ | ||
#!/usr/bin/env node | ||
var path = require('path'); | ||
var Express = require('express'); | ||
var webpack = require('webpack'); | ||
var webpackConfig = require('./merge-configs'); | ||
var userConfig = require(path.resolve('config/universal-redux.config.js')); | ||
|
||
var compiler = webpack(webpackConfig); | ||
|
||
var host = userConfig.server.host || 'localhost'; | ||
var port = parseInt(userConfig.server.port) + 1 || 3001; | ||
var serverOptions = { | ||
contentBase: 'http://' + host + ':' + port, | ||
quiet: true, | ||
noInfo: true, | ||
hot: true, | ||
inline: true, | ||
lazy: false, | ||
publicPath: webpackConfig.output.publicPath, | ||
headers: {'Access-Control-Allow-Origin': '*'}, | ||
stats: {colors: true} | ||
}; | ||
|
||
var app = new Express(); | ||
|
||
app.use(require('webpack-dev-middleware')(compiler, serverOptions)); | ||
app.use(require('webpack-hot-middleware')(compiler)); | ||
|
||
app.listen(port, function onAppListening(err) { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
console.info('==> 🚧 Webpack development server listening on port %s', port); | ||
} | ||
}); | ||
require('./transpile'); // babel registration (runtime transpilation for node) | ||
require('./webpack-dev-server_es6.js'); |
Oops, something went wrong.