-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kersten Lorenz
authored and
Kersten Lorenz
committed
Jul 17, 2017
0 parents
commit d58b0fb
Showing
48 changed files
with
1,354 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = crlf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false |
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,14 @@ | ||
node_modules/ | ||
/.idea | ||
webpack.userconfig.json | ||
generator.log | ||
test-results | ||
build/ | ||
coverage/ | ||
dist/ | ||
test-results/ | ||
dll/ | ||
wars/ | ||
target/ | ||
doc/ | ||
fallback-portal.config.ts |
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,37 @@ | ||
/** | ||
* @author: @AngularClass | ||
*/ | ||
|
||
const path = require('path'); | ||
|
||
const EVENT = process.env.npm_lifecycle_event || ''; | ||
|
||
// Helper functions | ||
const ROOT = path.resolve(__dirname, '..'); | ||
|
||
function hasProcessFlag(flag) { | ||
return process.argv.join('').indexOf(flag) > -1; | ||
} | ||
|
||
function hasNpmFlag(flag) { | ||
return EVENT.includes(flag); | ||
} | ||
|
||
function isWebpackDevServer() { | ||
return process.argv[1] && !!(/webpack-dev-server/.exec(process.argv[1])); | ||
} | ||
|
||
const root = path.join.bind(path, ROOT); | ||
|
||
const packageJson = require(path.join(ROOT, 'package.json')); | ||
const moduleName = packageJson.name; | ||
const appName = moduleName.split('.').pop(); | ||
const currentVersion = packageJson.version; | ||
|
||
exports.hasProcessFlag = hasProcessFlag; | ||
exports.hasNpmFlag = hasNpmFlag; | ||
exports.isWebpackDevServer = isWebpackDevServer; | ||
exports.moduleName = moduleName; | ||
exports.appName = appName; | ||
exports.currentVersion = currentVersion; | ||
exports.root = root; |
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,190 @@ | ||
const webpack = require('webpack'); | ||
const helpers = require('./helpers'); | ||
|
||
const AssetsPlugin = require('assets-webpack-plugin'); | ||
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin'); | ||
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin'); | ||
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin'); | ||
|
||
const METADATA = { | ||
baseUrl: '/aol/', | ||
port: '9080', | ||
isDevServer: helpers.isWebpackDevServer() | ||
}; | ||
|
||
module.exports = function () { | ||
return { | ||
|
||
devtool: 'source-map', | ||
|
||
resolve: { | ||
extensions: ['.ts', '.js', '.json'], | ||
modules: [helpers.root('src'), helpers.root('node_modules')], | ||
|
||
alias: { | ||
angular: helpers.root('node_modules/angular/angular.min.js'), | ||
'angular-animate': helpers.root('node_modules/angular-animate/angular-animate.min.js'), | ||
'angular-messages': helpers.root('node_modules/angular-messages/angular-messages.min.js'), | ||
'angular-route': helpers.root('node_modules/angular-route/angular-route.min.js'), | ||
'angular-sanitize': helpers.root('node_modules/angular-sanitize/angular-sanitize.min.js'), | ||
lodash: helpers.root('node_modules/lodash/lodash.min.js'), | ||
} | ||
}, | ||
|
||
module: { | ||
|
||
rules: [ | ||
{ | ||
enforce: 'pre', | ||
test: /\.js$/, | ||
loader: 'source-map-loader', | ||
exclude: [helpers.root('node_modules/@uirouter')] | ||
}, | ||
|
||
// Add "module.exports = angular" to the end of the file | ||
{ | ||
test: helpers.root('node_modules/angular/angular.min.js'), | ||
use: [ | ||
{ | ||
loader: 'exports-loader', | ||
options: 'angular' | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
test: /\.ts$/, | ||
use: [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
plugins: [ | ||
['angularjs-annotate', {'explicitOnly': true}] | ||
] | ||
} | ||
}, | ||
{ | ||
loader: 'ts-loader', | ||
options: { | ||
configFileName: 'tsconfig.webpack.json' | ||
} | ||
} | ||
], | ||
exclude: [/\.(spec|e2e)\.ts$/] | ||
}, | ||
|
||
|
||
// JSON | ||
{ | ||
test: /\.json$/, | ||
use: 'json-loader' | ||
}, | ||
|
||
// Angular templates | ||
{ | ||
test: /\.ngtpl\.html$/, | ||
use: [ | ||
{ | ||
loader: 'ngtemplate-loader', | ||
options: { | ||
relativeTo: helpers.root() | ||
} | ||
}, | ||
{ | ||
loader: 'html-loader', | ||
options: { | ||
minimize: true | ||
} | ||
} | ||
], | ||
exclude: [helpers.root('src/index.html'), helpers.root('src/iframe.html')] | ||
}, | ||
|
||
// HTML | ||
{ | ||
test: /\.html$/, | ||
use: [ | ||
{ | ||
loader: 'html-loader', | ||
options: { | ||
minimize: true | ||
} | ||
} | ||
], | ||
exclude: [helpers.root('src/index.html'), /\.ngtpl/, helpers.root('src/iframe.html')] | ||
}, | ||
|
||
// Images | ||
{ | ||
test: /\.(jpg|png|gif|svg)$/, | ||
use: 'file-loader?name=assets/[name].[ext]' | ||
}, | ||
|
||
// Fonts | ||
{ | ||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, | ||
use: 'url-loader?limit=10000&name=fonts/[name].[ext]&mimetype=application/font-woff' | ||
}, | ||
{ | ||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, | ||
use: 'url-loader?limit=10000&name=fonts/[name].[ext]&mimetype=application/font-woff' | ||
}, | ||
{ | ||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | ||
use: 'url-loader?limit=10000&name=fonts/[name].[ext]&mimetype=application/octet-stream' | ||
}, | ||
{ | ||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | ||
use: 'file-loader?name=fonts/[name].[ext]' | ||
}, | ||
{ | ||
test: /(ionicons|glyphicons)+.*\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
use: 'url-loader?limit=10000&name=fonts/[name].[ext]&mimetype=image/svg+xml' | ||
}, | ||
|
||
], | ||
|
||
}, | ||
|
||
plugins: [ | ||
|
||
new AssetsPlugin({ | ||
path: helpers.root('dist'), | ||
filename: 'webpack-assets.json', | ||
prettyPrint: true | ||
}), | ||
|
||
new CopyWebpackPlugin([ | ||
{from: 'src/assets', to: 'assets'}, | ||
], { | ||
ignore: [ | ||
'.gitkeep' | ||
], | ||
}), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: 'src/index.html', | ||
chunksSortMode: 'dependency', | ||
metadata: METADATA, | ||
inject: 'head' | ||
}), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: 'src/iframe.html', | ||
filename: 'iframe-content.html', | ||
chunksSortMode: 'dependency', | ||
metadata: METADATA, | ||
inject: 'head' | ||
}), | ||
|
||
new ScriptExtHtmlWebpackPlugin({ | ||
defaultAttribute: 'defer' | ||
}), | ||
|
||
], | ||
|
||
}; | ||
}; |
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,80 @@ | ||
const fs = require('fs'); | ||
const helpers = require('./helpers'); | ||
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 | ||
|
||
const DefinePlugin = require('webpack/lib/DefinePlugin'); | ||
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin'); | ||
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
|
||
const extractFrameworkCSS = new ExtractTextPlugin({ filename: 'framework.css', allChunks: true }); | ||
const extractAppSCSS = new ExtractTextPlugin('app.css'); | ||
|
||
module.exports = function (env) { | ||
return webpackMerge(commonConfig(), { | ||
|
||
entry: { | ||
'main': './src/main.ts', | ||
}, | ||
|
||
output: { | ||
path: helpers.root('dist'), | ||
filename: '[name].bundle.js', | ||
sourceMapFilename: '[file].map', | ||
chunkFilename: '[id].chunk.js', | ||
library: 'app_[name]', | ||
libraryTarget: 'var', | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: extractFrameworkCSS.extract({ | ||
fallback: 'style-loader', | ||
use: ['css-loader?sourceMap=true', 'source-map-loader'] | ||
}) | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
loader: extractAppSCSS.extract({ | ||
fallback: 'style-loader', | ||
use: ['css-loader', 'sass-loader'] | ||
}) | ||
}, | ||
] | ||
}, | ||
|
||
plugins: [ | ||
|
||
// extracts imported CSS files into external stylesheet | ||
extractFrameworkCSS, | ||
extractAppSCSS, | ||
|
||
new DefinePlugin({ | ||
'process.env': { | ||
'NODE_ENV': JSON.stringify(env.NODE_ENV), | ||
} | ||
}), | ||
|
||
], | ||
|
||
devServer: { | ||
port: '9080', | ||
contentBase: helpers.root('dist'), | ||
publicPath: '/aol/', | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Headers': 'accept, authorization, x-requested-with', | ||
}, | ||
proxy: { | ||
'/aol/**': { | ||
secure: false, | ||
target: 'https://apa279002.system-a.local', | ||
}, | ||
} | ||
}, | ||
|
||
}); | ||
}; |
Oops, something went wrong.