Skip to content

Commit

Permalink
feat(build): add --profile flag
Browse files Browse the repository at this point in the history
Currently builds always output profiling information by default.
This PR adds a flag to enable it, defaulting to false.
  • Loading branch information
filipesilva committed Oct 24, 2016
1 parent bc0ae68 commit fef3b15
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/angular-cli/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface BuildOptions {
supressSizes: boolean;
baseHref?: string;
aot?: boolean;
profile?: boolean;
}

const BuildCommand = Command.extend({
Expand All @@ -31,7 +32,8 @@ const BuildCommand = Command.extend({
{ name: 'watcher', type: String },
{ name: 'suppress-sizes', type: Boolean, default: false },
{ name: 'base-href', type: String, default: null, aliases: ['bh'] },
{ name: 'aot', type: Boolean, default: false }
{ name: 'aot', type: Boolean, default: false },
{ name: 'profile', type: Boolean, default: false }
],

run: function (commandOptions: BuildOptions) {
Expand Down
2 changes: 2 additions & 0 deletions packages/angular-cli/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ServeTaskOptions {
sslKey?: string;
sslCert?: string;
aot?: boolean;
profile?: boolean;
open?: boolean;
}

Expand Down Expand Up @@ -81,6 +82,7 @@ const ServeCommand = Command.extend({
{ name: 'ssl-key', type: String, default: 'ssl/server.key' },
{ name: 'ssl-cert', type: String, default: 'ssl/server.crt' },
{ name: 'aot', type: Boolean, default: false },
{ name: 'profile', type: Boolean, default: false },
{
name: 'open',
type: Boolean,
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/tasks/build-webpack-watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default Task.extend({
const webpackCompiler: any = webpack(config);

webpackCompiler.apply(new ProgressPlugin({
profile: true
profile: runTaskOptions.profile
}));

return new Promise((resolve, reject) => {
Expand Down
7 changes: 3 additions & 4 deletions packages/angular-cli/tasks/build-webpack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as rimraf from 'rimraf';
import * as path from 'path';
const Task = require('ember-cli/lib/models/task');
import * as webpack from 'webpack';
const Task = require('ember-cli/lib/models/task');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
import { BuildOptions } from '../commands/build';
import { NgCliWebpackConfig } from '../models/webpack-config';
import { webpackOutputOptions } from '../models/';
Expand Down Expand Up @@ -31,10 +32,8 @@ export default <any>Task.extend({

const webpackCompiler: any = webpack(config);

const ProgressPlugin = require('webpack/lib/ProgressPlugin');

webpackCompiler.apply(new ProgressPlugin({
profile: true
profile: runTaskOptions.profile
}));

return new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/tasks/serve-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default Task.extend({
webpackCompiler = webpack(config);

webpackCompiler.apply(new ProgressPlugin({
profile: true,
profile: commandOptions.profile,
colors: true
}));

Expand Down

0 comments on commit fef3b15

Please sign in to comment.