chore(package): update angular to 2.1.0, webpack to 2.1.0-beta.25, other dependencies accordingly

This commit is contained in:
Dmitry Nehaychik 2016-10-21 12:57:02 +03:00
parent d56537af9f
commit 0b2ceded29
7 changed files with 165 additions and 155 deletions

View file

@ -1,17 +1,21 @@
const webpack = require('webpack');
const path = require('path');
const helpers = require('./helpers');
/*
* Webpack Plugins
*/
// problem with copy-webpack-plugin
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const HtmlElementsPlugin = require('./html-elements-plugin');
const AssetsPlugin = require('assets-webpack-plugin');
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const HtmlElementsPlugin = require('./html-elements-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
/*
* Webpack Constants
@ -33,13 +37,6 @@ module.exports = function (options) {
isProd = options.env === 'production';
return {
/*
* Static metadata for index.html
*
* See: (custom attribute)
*/
metadata: METADATA,
/*
* Cache generated modules and chunks to improve performance for multiple incremental builds.
* This is enabled by default in watch mode.
@ -75,7 +72,7 @@ module.exports = function (options) {
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['', '.ts', '.js', '.css', '.scss', '.json'],
extensions: ['.ts', '.js', '.css', '.scss', '.json'],
// An array of directory names to be resolved to the current directory
modules: [helpers.root('src'), 'node_modules'],
@ -89,35 +86,18 @@ module.exports = function (options) {
*/
module: {
/*
* An array of applied pre and post loaders.
*
* See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
*/
preLoaders: [
rules: [
{
test: /\.ts$/,
loader: 'string-replace-loader',
query: {
search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)',
flags: 'g'
search: /(System|SystemJS)(.*[\n\r]\s*\.|\.)import\((.+)\)/g,
replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)'
},
include: [helpers.root('src')]
include: [helpers.root('src')],
enforce: 'pre'
},
],
/*
* An array of automatically applied loaders.
*
* IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
* This means they are not resolved relative to the configuration file.
*
* See: http://webpack.github.io/docs/configuration.html#module-loaders
*/
loaders: [
/*
* Typescript loader support for .ts and Angular 2 async routes via .async.ts
* Replace templateUrl and stylesUrl with require()
@ -199,22 +179,9 @@ module.exports = function (options) {
test: /\.(jpg|png|gif)$/,
loader: 'file'
}
],
postLoaders: [
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
search: 'var sourceMappingUrl = extractSourceMappingUrl\\(cssText\\);',
replace: 'var sourceMappingUrl = "";',
flags: 'g'
}
}
]
},
/*
* Add additional plugins to the compiler.
*
@ -244,7 +211,7 @@ module.exports = function (options) {
* See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
* See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
*/
new webpack.optimize.CommonsChunkPlugin({
new CommonsChunkPlugin({
name: ['polyfills', 'vendor'].reverse()
}),
@ -271,9 +238,11 @@ module.exports = function (options) {
* See: https://www.npmjs.com/package/copy-webpack-plugin
*/
new CopyWebpackPlugin([{
from: 'src/assets',
to: 'assets'
}]),
from: 'src/assets',
to: 'assets'
}, {
from: 'src/meta'
} ]),
/*
* Plugin: HtmlWebpackPlugin
@ -285,13 +254,21 @@ module.exports = function (options) {
*/
new HtmlWebpackPlugin({
template: 'src/index.html',
chunksSortMode: 'dependency'
title: METADATA.title,
chunksSortMode: 'dependency',
metadata: METADATA,
inject: 'head'
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
'Tether': 'tether',
'window.Tether': 'tether'
/*
* Plugin: ScriptExtHtmlWebpackPlugin
* Description: Enhances html-webpack-plugin functionality
* with different deployment options for your scripts including:
*
* See: https://github.com/numical/script-ext-html-webpack-plugin
*/
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'defer'
}),
/*
@ -320,6 +297,13 @@ module.exports = function (options) {
headTags: require('./head-config.common')
}),
/**
* Plugin LoaderOptionsPlugin (experimental)
*
* See: https://gist.github.com/sokra/27b24881210b56bbaff7
*/
new LoaderOptionsPlugin({}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
@ -347,7 +331,7 @@ module.exports = function (options) {
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
global: true,
crypto: 'empty',
process: true,
module: false,

View file

@ -1,4 +1,5 @@
const helpers = require('./helpers');
const path = require('path');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
@ -7,6 +8,7 @@ const commonConfig = require('./webpack.common.js'); // the settings that are co
*/
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
/**
* Webpack Constants
@ -27,23 +29,9 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
module.exports = function(options) {
module.exports = function (options) {
return webpackMerge(commonConfig({env: ENV}), {
/**
* Merged metadata from webpack.common.js for index.html
*
* See: (custom attribute)
*/
metadata: METADATA,
/**
* Switch loaders to debug mode.
*
* See: http://webpack.github.io/docs/configuration.html#debug
*/
debug: true,
/**
* Developer tool to enhance debugging
*
@ -123,19 +111,33 @@ module.exports = function(options) {
*/
new NamedModulesPlugin(),
],
/**
* Plugin LoaderOptionsPlugin (experimental)
*
* See: https://gist.github.com/sokra/27b24881210b56bbaff7
*/
new LoaderOptionsPlugin({
debug: true,
options: {
context: helpers.root('src'),
output: {
path: helpers.root('dist')
},
/**
* Static analysis linter for TypeScript advanced options configuration
* Description: An extensible linter for the TypeScript language.
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'src'
},
/**
* Static analysis linter for TypeScript advanced options configuration
* Description: An extensible linter for the TypeScript language.
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'src'
}
}
})
],
/**
* Webpack Development Server configuration
@ -165,7 +167,7 @@ module.exports = function(options) {
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
global: true,
crypto: 'empty',
process: true,
module: false,

View file

@ -5,11 +5,12 @@ const commonConfig = require('./webpack.common.js'); // the settings that are co
/**
* Webpack Plugins
*/
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const WebpackMd5Hash = require('webpack-md5-hash');
@ -26,17 +27,8 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
HMR: false
});
module.exports = function(env) {
env = env || ENV;
return webpackMerge(commonConfig({env: env}), {
/**
* Switch loaders to debug mode.
*
* See: http://webpack.github.io/docs/configuration.html#debug
*/
debug: false,
module.exports = function (env) {
return webpackMerge(commonConfig({env: ENV}), {
/**
* Developer tool to enhance debugging
@ -196,38 +188,54 @@ module.exports = function(env) {
// threshold: 2 * 1024
// })
/**
* Plugin LoaderOptionsPlugin (experimental)
*
* See: https://gist.github.com/sokra/27b24881210b56bbaff7
*/
new LoaderOptionsPlugin({
debug: false,
options: {
context: helpers.root('src'),
output: {
path: helpers.root('dist')
},
/**
* Static analysis linter for TypeScript advanced options configuration
* Description: An extensible linter for the TypeScript language.
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
tslint: {
emitErrors: true,
failOnHint: true,
resourcePath: 'src'
},
/**
* Html loader advanced options
*
* See: https://github.com/webpack/html-loader#advanced-options
*/
// TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
htmlLoader: {
minimize: true,
removeAttributeQuotes: false,
caseSensitive: true,
customAttrSurround: [
[/#/, /(?:)/],
[/\*/, /(?:)/],
[/\[?\(?/, /(?:)/]
],
customAttrAssign: [/\)?\]?=/]
},
}
}),
],
/**
* Static analysis linter for TypeScript advanced options configuration
* Description: An extensible linter for the TypeScript language.
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
tslint: {
emitErrors: true,
failOnHint: true,
resourcePath: 'src'
},
/**
* Html loader advanced options
*
* See: https://github.com/webpack/html-loader#advanced-options
*/
// TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
htmlLoader: {
minimize: true,
removeAttributeQuotes: false,
caseSensitive: true,
customAttrSurround: [
[/#/, /(?:)/],
[/\*/, /(?:)/],
[/\[?\(?/, /(?:)/]
],
customAttrAssign: [/\)?\]?=/]
},
/*
* Include polyfills or mocks for various node stuff
* Description: Node configuration
@ -235,7 +243,7 @@ module.exports = function(env) {
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
global: true,
crypto: 'empty',
process: false,
module: false,
@ -244,4 +252,4 @@ module.exports = function(env) {
}
});
}
};

View file

@ -7,21 +7,19 @@
"license": "MIT",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "^2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0",
"@angular/router": "3.0.0",
"@angular/common": "2.1.0",
"@angular/compiler": "2.1.0",
"@angular/core": "2.1.0",
"@angular/forms": "^2.1.0",
"@angular/http": "2.1.0",
"@angular/platform-browser": "2.1.0",
"@angular/platform-browser-dynamic": "2.1.0",
"@angular/platform-server": "2.1.0",
"@angular/router": "3.1.0",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.0",
"@angularclass/hmr-loader": "~3.0.2",
"@angularclass/request-idle-callback": "^1.0.7",
"@angularclass/webpack-toolkit": "^1.3.3",
"amcharts3": "github:amcharts/amcharts3",
"ammap3": "github:amcharts/ammap3",
@ -48,7 +46,7 @@
"leaflet": "^0.7.7",
"leaflet-map": "^0.2.1",
"lodash": "^4.12.0",
"ng2-bootstrap": "1.1.5",
"ng2-bootstrap": "1.1.14",
"ng2-ckeditor": "1.0.7",
"ng2-smart-table": "^0.3.1",
"ng2-tree": "^0.0.2-7",
@ -70,13 +68,14 @@
"@types/webpack": "^1.12.34",
"@types/lodash": "0.0.28",
"gh-pages": "^0.11.0",
"parse5": "^1.3.2",
"parse5": "^2.2.2",
"rimraf": "^2.5.2",
"codelyzer": "~0.0.28",
"script-ext-html-webpack-plugin": "^1.3.2",
"codelyzer": "~1.0.0-beta.2",
"tslint": "3.15.1",
"ts-helpers": "1.1.1",
"ts-helpers": "1.1.2",
"ts-node": "^1.3.0",
"typedoc": "^0.4.5",
"typedoc": "^0.5.0",
"typescript": "2.0.3",
"awesome-typescript-loader": "^2.2.1",
"tslint-loader": "^2.1.3",
@ -97,12 +96,12 @@
"node-sass": "^3.5.3",
"html-webpack-plugin": "^2.21.0",
"copy-webpack-plugin": "^3.0.1",
"webpack": "2.1.0-beta.22",
"webpack": "2.1.0-beta.25",
"webpack-dashboard": "^0.1.8",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "^2.1.0-beta.2",
"webpack-dev-server": "^2.1.0-beta.9",
"webpack-md5-hash": "^0.0.5",
"webpack-merge": "^0.14.1",
"webpack-merge": "^0.15.0",
"compression-webpack-plugin": "^0.3.1",
"es6-promise": "^3.1.2",
"es6-shim": "^0.35.0",

View file

@ -5,9 +5,9 @@
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= webpackConfig.metadata.title %></title>
<title><%= htmlWebpackPlugin.options.title %></title>
<meta name="description" content="<%= webpackConfig.metadata.description %>">
<meta name="description" content="<%= htmlWebpackPlugin.options.metadata.description %>">
<% if (webpackConfig.htmlElements.headTags) { %>
<!-- Configured Head Tags -->
@ -15,7 +15,8 @@
<% } %>
<!-- base url -->
<base href="<%= webpackConfig.metadata.baseUrl %>">
<base href="<%= htmlWebpackPlugin.options.metadata.baseUrl %>">
</head>
@ -27,7 +28,7 @@
<div></div>
</div>
<% if (webpackConfig.metadata.isDevServer && webpackConfig.metadata.HMR !== true) { %>
<% if (htmlWebpackPlugin.options.metadata.isDevServer && htmlWebpackPlugin.options.metadata.HMR !== true) { %>
<!-- Webpack Dev Server reload -->
<script src="/webpack-dev-server.js"></script>
<% } %>

16
src/meta/humans.txt Normal file
View file

@ -0,0 +1,16 @@
# humanstxt.org/
# The humans responsible & technology colophon
# TEAM
akveo.com
# THANKS
<name>
Akveo Team
# TECHNOLOGY COLOPHON
HTML5, CSS3, Bootstrap
Angular2, TypeScript, Webpack