Skip to content

Commit 0159123

Browse files
committed
chore(testing) modified the awesome typescript loader config to output es5 modules and not es6, breaks istanbuls esprima dep. Should look into isparta.
1 parent 44234e6 commit 0159123

7 files changed

+50
-24
lines changed

addon/ng2/commands/serve.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const PortFinder = require('portfinder');
66
const win = require('ember-cli/lib/utilities/windows-admin');
77
const EOL = require('os').EOL;
88

9+
910
PortFinder.basePort = 49152;
1011

1112
const getPort = Promise.denodeify(PortFinder.getPort);
@@ -53,6 +54,8 @@ module.exports = Command.extend({
5354
],
5455

5556
run: function(commandOptions: ServeTaskOptions) {
57+
58+
5659
commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;
5760

5861
return this._checkExpressPort(commandOptions)

addon/ng2/models/webpack-build-common.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export const webpackCommonConfig = {
1313
extensions: ['', '.ts', '.js'],
1414
root: ngAppResolve('./src')
1515
},
16-
debug: true,
1716
context: path.resolve(__dirname, './'),
1817
entry: {
1918
main: [ngAppResolve('./src/main.ts')],

addon/ng2/models/webpack-build-production.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ export const webpackProdConfigPartial = {
2323
plugins: [
2424
new WebpackMd5Hash(),
2525
new webpack.optimize.DedupePlugin(),
26-
// new webpack.optimize.UglifyJsPlugin({
27-
// beautify: false, //prod
28-
// mangle: { screw_ie8 : true }, //prod
29-
// compress: { screw_ie8: true }, //prod
30-
// comments: false //prod
31-
// }),
32-
// new CompressionPlugin({
33-
// asset: "[path].gz[query]",
34-
// algorithm: "gzip",
35-
// test: /\.js$|\.html$/,
36-
// threshold: 10240,
37-
// minRatio: 0.8
38-
// }),
26+
new webpack.optimize.UglifyJsPlugin({
27+
beautify: false, //prod
28+
mangle: { screw_ie8 : true }, //prod
29+
compress: { screw_ie8: true }, //prod
30+
comments: false //prod
31+
}),
32+
new CompressionPlugin({
33+
asset: "[path].gz[query]",
34+
algorithm: "gzip",
35+
test: /\.js$|\.html$/,
36+
threshold: 10240,
37+
minRatio: 0.8
38+
}),
3939
new LoaderOptionsPlugin({
4040
test: /\.js/,
4141
minimize: true,

addon/ng2/models/webpack-build-test.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,18 @@ export const webpackTestConfig = {
4242
{
4343
loader: 'awesome-typescript-loader',
4444
query: {
45+
useWebpackText: true,
4546
tsconfig: ngAppResolve('./src/tsconfig.json'),
46-
resolveGlobs: false,
47+
// resolveGlobs: false,
4748
module: "commonjs",
4849
target: "es5",
49-
library: "es6",
50-
lib: ['es5', 'dom'],
51-
useForkChecker: false,
50+
lib: ['es6', 'dom'],
51+
useForkChecker: true,
5252
removeComments: true
5353
}
54+
},
55+
{
56+
loader: 'angular2-template-loader'
5457
}
5558
],
5659
exclude: [/\.e2e\.ts$/]

addon/ng2/models/webpack-build-utils.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22
const autoprefixer = require('autoprefixer');
33

4-
import {webpackDevConfig, webpackProdConfig, webpackVendorDLLConfig} from './';
4+
import {webpackDevConfig, webpackProdConfig} from './';
55

66
export const ngAppResolve = (resolvePath: string): string => {
77
return path.resolve(process.cwd(), resolvePath);
@@ -15,6 +15,16 @@ export const webpackOutputOptions: WebpackProgressPluginOutputOptions = {
1515
chunkModules: false
1616
}
1717

18+
export const webpackDevServerOutputOptions = {
19+
assets: true,
20+
colors: true,
21+
version: true,
22+
hash: true,
23+
timings: true,
24+
chunks: false,
25+
chunkModules: false
26+
}
27+
1828
export const postCssConfiguration = () => {
1929
return {
2030
defaults: [autoprefixer]
@@ -23,6 +33,5 @@ export const postCssConfiguration = () => {
2333

2434
export const envToConfigMap: any = {
2535
production: webpackProdConfig,
26-
development: webpackDevConfig,
27-
vendor: webpackVendorDLLConfig
36+
development: webpackDevConfig
2837
}

addon/ng2/tasks/serve-webpack.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import {webpackCommonConfig, webpackOutputOptions, webpackDevMaterialConfig, webpackProdMaterialConfig, webpackDevMaterialE2EConfig, webpackDevConfig} from '../models/';
1+
import {
2+
webpackDevServerOutputOptions,
3+
webpackOutputOptions,
4+
webpackCommonConfig,
5+
webpackDevMaterialConfig,
6+
webpackProdMaterialConfig,
7+
webpackDevMaterialE2EConfig,
8+
webpackDevConfig,
9+
} from '../models/';
210
import {ServeTaskOptions} from '../commands/serve';
311

412
const path = require('path');
@@ -16,6 +24,9 @@ let lastHash = null;
1624

1725
module.exports = Task.extend({
1826
run: (commandOptions: ServeTaskOptions) => {
27+
28+
29+
1930
let webpackCompiler: any;
2031
if (commandOptions.environment === 'material') {
2132
webpackDevMaterialConfig.entry.main.unshift(`webpack-dev-server/client?http://localhost:${commandOptions.port}/`);
@@ -39,14 +50,15 @@ module.exports = Task.extend({
3950
const webpackDevServerConfiguration: IWebpackDevServerConfigurationOptions = {
4051
contentBase: path.resolve(process.cwd(), './src'),
4152
historyApiFallback: true,
42-
stats: { colors: true },
53+
stats: webpackDevServerOutputOptions,
4354
inline: true
4455
};
4556

4657
const serveMessage:string = chalk.green(`\n*\n*\n NG Live Development Server is running on http://localhost:${commandOptions.port}.\n*\n*`);
4758
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
4859

4960
return new Promise((resolve, reject) => {
61+
process.stdout.write(chalk.red('\n\n' + chalk.underline.bgYellow('TODO#'), 'Implement ENV Flags for serve builds.\n\n'));
5062
server.listen(commandOptions.port, "localhost", function(err, stats) {
5163
if(err) {
5264
lastHash = null;

custom-typings.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface IWebpackDevServerConfigurationOptions {
1515
};
1616
publicPath?: string;
1717
headers?: { [key:string]: string };
18-
stats?: { colors: boolean; };
18+
stats?: { [key:string]: boolean };
1919
inline: boolean;
2020
}
2121

0 commit comments

Comments
 (0)