De-lint test files and update test,build config

This commit is contained in:
gconsidine
2017-10-10 16:32:11 -04:00
parent 8b6cc0e323
commit 82f81752e4
61 changed files with 1335 additions and 991 deletions

View File

@@ -18,12 +18,13 @@ const LANGUAGES_PATH = path.join(CLIENT_PATH, 'languages');
const MODELS_PATH = path.join(LIB_PATH, 'models');
const NODE_MODULES_PATH = path.join(UI_PATH, 'node_modules');
const SERVICES_PATH = path.join(LIB_PATH, 'services');
const SOURCE_PATH = path.join(CLIENT_PATH, 'src');
const SRC_PATH = path.join(CLIENT_PATH, 'src');
const STATIC_PATH = path.join(UI_PATH, 'static');
const TEST_PATH = path.join(UI_PATH, 'test');
const THEME_PATH = path.join(LIB_PATH, 'theme');
const APP_ENTRY = path.join(SOURCE_PATH, 'app.js');
const VENDOR_ENTRY = path.join(SOURCE_PATH, 'vendor.js');
const APP_ENTRY = path.join(SRC_PATH, 'app.js');
const VENDOR_ENTRY = path.join(SRC_PATH, 'vendor.js');
const INDEX_ENTRY = path.join(CLIENT_PATH, 'index.template.ejs');
const INDEX_OUTPUT = path.join(UI_PATH, 'templates/ui/index.html');
const THEME_ENTRY = path.join(LIB_PATH, 'theme', 'index.less');
@@ -49,7 +50,7 @@ const base = {
chunks: false,
excludeAssets: name => {
const chunkNames = `(${CHUNKS.join('|')})`;
const outputPattern = new RegExp(`${chunkNames}\.[a-f0-9]+\.(js|css)(|\.map)$`, 'i');
const outputPattern = new RegExp(`${chunkNames}.[a-f0-9]+.(js|css)(|.map)$`, 'i');
return !outputPattern.test(name);
}
@@ -82,7 +83,7 @@ const base = {
})
},
{
test: /\lib\/theme\/index.less$/,
test: /lib\/theme\/index.less$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'less-loader']
})
@@ -92,7 +93,8 @@ const base = {
use: ['ngtemplate-loader', 'html-loader'],
include: [
/lib\/components\//,
/features\//
/features\//,
/src\//
]
},
{
@@ -149,17 +151,17 @@ const base = {
context: NODE_MODULES_PATH
},
{
from: path.join(SOURCE_PATH, '**/*.partial.html'),
from: path.join(SRC_PATH, '**/*.partial.html'),
to: path.join(STATIC_PATH, 'partials/'),
context: SOURCE_PATH
context: SRC_PATH
},
{
from: path.join(SOURCE_PATH, 'partials', '*.html'),
from: path.join(SRC_PATH, 'partials', '*.html'),
to: STATIC_PATH,
context: SOURCE_PATH
context: SRC_PATH
},
{
from: path.join(SOURCE_PATH, '*config.js'),
from: path.join(SRC_PATH, '*config.js'),
to: STATIC_PATH,
flatten: true
}
@@ -170,31 +172,34 @@ const base = {
filename: INDEX_OUTPUT,
inject: false,
chunks: CHUNKS,
chunksSortMode: chunk => chunk.names[0] === 'vendor' ? -1 : 1
chunksSortMode: chunk => (chunk.names[0] === 'vendor' ? -1 : 1)
})
],
resolve: {
alias: {
'~assets': ASSETS_PATH,
'~components': COMPONENTS_PATH,
'~features': FEATURES_PATH,
'~models': MODELS_PATH,
'~node_modules': NODE_MODULES_PATH,
'~services': SERVICES_PATH,
'~components': COMPONENTS_PATH,
'~src': SRC_PATH,
'~test': TEST_PATH,
'~theme': THEME_PATH,
'~modules': NODE_MODULES_PATH,
'~assets': ASSETS_PATH,
'd3$': '~modules/d3/d3.min.js',
'codemirror.jsonlint$': '~modules/codemirror/addon/lint/json-lint.js',
'jquery': '~modules/jquery/dist/jquery.js',
'jquery-resize$': '~modules/javascript-detect-element-resize/jquery.resize.js',
'select2$': '~modules/select2/dist/js/select2.full.min.js',
'js-yaml$': '~modules/js-yaml/dist/js-yaml.min.js',
'lr-infinite-scroll$': '~modules/lr-infinite-scroll/lrInfiniteScroll.js',
'angular-tz-extensions$': '~modules/angular-tz-extensions/lib/angular-tz-extensions.js',
'angular-ui-router$': '~modules/angular-ui-router/release/angular-ui-router.js',
'angular-ui-router-state-events$': '~modules/angular-ui-router/release/stateEvents.js',
'ng-toast-provider$': '~modules/ng-toast/src/scripts/provider.js',
'ng-toast-directives$': '~modules/ng-toast/src/scripts/directives.js',
'ng-toast$': '~modules/ng-toast/src/scripts/module.js'
'~ui': UI_PATH,
d3$: '~node_modules/d3/d3.min.js',
'codemirror.jsonlint$': '~node_modules/codemirror/addon/lint/json-lint.js',
jquery: '~node_modules/jquery/dist/jquery.js',
'jquery-resize$': '~node_modules/javascript-detect-element-resize/jquery.resize.js',
select2$: '~node_modules/select2/dist/js/select2.full.min.js',
'js-yaml$': '~node_modules/js-yaml/dist/js-yaml.min.js',
'lr-infinite-scroll$': '~node_modules/lr-infinite-scroll/lrInfiniteScroll.js',
'angular-tz-extensions$': '~node_modules/angular-tz-extensions/lib/angular-tz-extensions.js',
'angular-ui-router$': '~node_modules/angular-ui-router/release/angular-ui-router.js',
'angular-ui-router-state-events$': '~node_modules/angular-ui-router/release/stateEvents.js',
'ng-toast-provider$': '~node_modules/ng-toast/src/scripts/provider.js',
'ng-toast-directives$': '~node_modules/ng-toast/src/scripts/directives.js',
'ng-toast$': '~node_modules/ng-toast/src/scripts/module.js'
}
}
};

View File

@@ -1,4 +1,4 @@
const _ = require('lodash');
const merge = require('webpack-merge');
const base = require('./webpack.base');
@@ -6,4 +6,4 @@ const development = {
devtool: 'source-map'
};
module.exports = _.merge(base, development);
module.exports = merge(base, development);

View File

@@ -1,6 +1,6 @@
const path = require('path');
const _ = require('lodash');
const merge = require('webpack-merge');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -25,16 +25,14 @@ const production = {
filename: INSTALL_RUNNING_OUTPUT,
inject: false,
chunks: CHUNKS,
chunksSortMode: chunk => chunk.names[0] === 'vendor' ? -1 : 1
chunksSortMode: chunk => (chunk.names[0] === 'vendor' ? -1 : 1)
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
]
};
production.plugins = base.plugins.concat(production.plugins);
module.exports = _.merge(base, production);
module.exports = merge(base, production);

View File

@@ -2,6 +2,8 @@ const path = require('path');
const _ = require('lodash');
const webpack = require('webpack');
const merge = require('webpack-merge');
const nodeObjectHash = require('node-object-hash');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
@@ -33,9 +35,7 @@ const watch = {
new HardSourceWebpackPlugin({
cacheDirectory: 'node_modules/.cache/hard-source/[confighash]',
recordsPath: 'node_modules/.cache/hard-source/[confighash]/records.json',
configHash: config => {
return require('node-object-hash')({ sort: false }).hash(config);
},
configHash: config => nodeObjectHash({ sort: false }).hash(config),
environmentHash: {
root: process.cwd(),
directories: ['node_modules'],
@@ -68,7 +68,4 @@ const watch = {
}
};
watch.module.rules = development.module.rules.concat(watch.module.rules);
watch.plugins = development.plugins.concat(watch.plugins);
module.exports = _.merge(development, watch);
module.exports = merge(development, watch);