add eslint config and format build folder

This commit is contained in:
Clark Du 2017-03-27 11:47:57 +08:00
parent 39e7e56cf1
commit 1f9fbacfb8
6 changed files with 30 additions and 23 deletions

8
build/.eslintrc.json Normal file
View file

@ -0,0 +1,8 @@
{
"extends": [
"../.eslintrc.json"
],
"env": {
"node": true
}
}

View file

@ -1,10 +1,9 @@
/**
* 公共配置
*/
var webpack = require('webpack');
var path = require('path');
function resolve (dir) {
return path.join(__dirname, '..', dir)
return path.join(__dirname, '..', dir)
}
module.exports = {
@ -61,8 +60,8 @@ module.exports = {
resolve: {
extensions: ['.js', '.vue'],
alias: {
'vue': 'vue/dist/vue.esm.js',
'@': resolve('src')
'vue': 'vue/dist/vue.esm.js',
'@': resolve('src')
}
}
};

View file

@ -6,9 +6,9 @@ var path = require('path');
var webpack = require('webpack');
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var merge = require('webpack-merge')
var merge = require('webpack-merge');
var webpackBaseConfig = require('./webpack.base.config.js');
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
module.exports = merge(webpackBaseConfig, {

View file

@ -1,9 +1,9 @@
var path = require('path');
var webpack = require('webpack');
var merge = require('webpack-merge')
var merge = require('webpack-merge');
var webpackBaseConfig = require('./webpack.base.config.js');
process.env.NODE_ENV = 'production'
process.env.NODE_ENV = 'production';
module.exports = merge(webpackBaseConfig, {
entry: {

View file

@ -1,6 +1,6 @@
var path = require('path');
var webpack = require('webpack');
var merge = require('webpack-merge')
var merge = require('webpack-merge');
var webpackBaseConfig = require('./webpack.base.config.js');
process.env.NODE_ENV = 'production';
@ -28,7 +28,7 @@ module.exports = merge(webpackBaseConfig, {
plugins: [
// @todo
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {

View file

@ -2,24 +2,24 @@
* 用于单元测试
*/
var webpack = require('webpack')
var merge = require('webpack-merge')
var webpack = require('webpack');
var merge = require('webpack-merge');
var webpackBaseConfig = require('./webpack.base.config.js');
var webpackConfig = merge(webpackBaseConfig, {
// use inline sourcemap for karma-sourcemap-loader
devtool: '#inline-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"testing"'
}
})
]
})
devtool: '#inline-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"testing"'
}
})
]
});
// no need for app entry during tests
delete webpackConfig.entry
delete webpackConfig.entry;
module.exports = webpackConfig
module.exports = webpackConfig;