Skip to content

Commit fef3b15

Browse files
committed
feat(build): add --profile flag
Currently builds always output profiling information by default. This PR adds a flag to enable it, defaulting to false.
1 parent bc0ae68 commit fef3b15

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

packages/angular-cli/commands/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface BuildOptions {
1111
supressSizes: boolean;
1212
baseHref?: string;
1313
aot?: boolean;
14+
profile?: boolean;
1415
}
1516

1617
const BuildCommand = Command.extend({
@@ -31,7 +32,8 @@ const BuildCommand = Command.extend({
3132
{ name: 'watcher', type: String },
3233
{ name: 'suppress-sizes', type: Boolean, default: false },
3334
{ name: 'base-href', type: String, default: null, aliases: ['bh'] },
34-
{ name: 'aot', type: Boolean, default: false }
35+
{ name: 'aot', type: Boolean, default: false },
36+
{ name: 'profile', type: Boolean, default: false }
3537
],
3638

3739
run: function (commandOptions: BuildOptions) {

packages/angular-cli/commands/serve.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface ServeTaskOptions {
2626
sslKey?: string;
2727
sslCert?: string;
2828
aot?: boolean;
29+
profile?: boolean;
2930
open?: boolean;
3031
}
3132

@@ -81,6 +82,7 @@ const ServeCommand = Command.extend({
8182
{ name: 'ssl-key', type: String, default: 'ssl/server.key' },
8283
{ name: 'ssl-cert', type: String, default: 'ssl/server.crt' },
8384
{ name: 'aot', type: Boolean, default: false },
85+
{ name: 'profile', type: Boolean, default: false },
8486
{
8587
name: 'open',
8688
type: Boolean,

packages/angular-cli/tasks/build-webpack-watch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default Task.extend({
2929
const webpackCompiler: any = webpack(config);
3030

3131
webpackCompiler.apply(new ProgressPlugin({
32-
profile: true
32+
profile: runTaskOptions.profile
3333
}));
3434

3535
return new Promise((resolve, reject) => {

packages/angular-cli/tasks/build-webpack.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as rimraf from 'rimraf';
22
import * as path from 'path';
3-
const Task = require('ember-cli/lib/models/task');
43
import * as webpack from 'webpack';
4+
const Task = require('ember-cli/lib/models/task');
5+
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
56
import { BuildOptions } from '../commands/build';
67
import { NgCliWebpackConfig } from '../models/webpack-config';
78
import { webpackOutputOptions } from '../models/';
@@ -31,10 +32,8 @@ export default <any>Task.extend({
3132

3233
const webpackCompiler: any = webpack(config);
3334

34-
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
35-
3635
webpackCompiler.apply(new ProgressPlugin({
37-
profile: true
36+
profile: runTaskOptions.profile
3837
}));
3938

4039
return new Promise((resolve, reject) => {

packages/angular-cli/tasks/serve-webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default Task.extend({
3737
webpackCompiler = webpack(config);
3838

3939
webpackCompiler.apply(new ProgressPlugin({
40-
profile: true,
40+
profile: commandOptions.profile,
4141
colors: true
4242
}));
4343

0 commit comments

Comments
 (0)