Skip to content

Commit 8fd1040

Browse files
committed
fix(@angular-devkit/build-angular): use process TTY as progress default
Fix #11195
1 parent b465930 commit 8fd1040

File tree

9 files changed

+29
-10
lines changed

9 files changed

+29
-10
lines changed

packages/angular_devkit/build_angular/src/browser/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
statsToString,
3535
statsWarningsToString,
3636
} from '../angular-cli-files/utilities/stats';
37-
import { normalizeAssetPatterns, normalizeFileReplacements } from '../utils';
37+
import { defaultProgress, normalizeAssetPatterns, normalizeFileReplacements } from '../utils';
3838
import { AssetPatternObject, BrowserBuilderSchema, CurrentFileReplacement } from './schema';
3939
const webpackMerge = require('webpack-merge');
4040

@@ -138,6 +138,8 @@ export class BrowserBuilder implements Builder<BrowserBuilderSchema> {
138138
supportES2015,
139139
};
140140

141+
wco.buildOptions.progress = defaultProgress(wco.buildOptions.progress);
142+
141143
const webpackConfigs: {}[] = [
142144
getCommonConfig(wco),
143145
getBrowserConfig(wco),

packages/angular_devkit/build_angular/src/browser/schema.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export interface BrowserBuilderSchema {
104104
/**
105105
* Log progress to the console while building.
106106
*/
107-
progress: boolean;
107+
progress?: boolean;
108108

109109
/**
110110
* Localization file to use for i18n.

packages/angular_devkit/build_angular/src/browser/schema.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@
115115
},
116116
"progress": {
117117
"type": "boolean",
118-
"description": "Log progress to the console while building.",
119-
"default": true
118+
"description": "Log progress to the console while building."
120119
},
121120
"i18nFile": {
122121
"type": "string",

packages/angular_devkit/build_angular/src/karma/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
import { readTsconfig } from '../angular-cli-files/utilities/read-tsconfig';
2828
import { requireProjectModule } from '../angular-cli-files/utilities/require-project-module';
2929
import { AssetPatternObject, CurrentFileReplacement } from '../browser/schema';
30-
import { normalizeAssetPatterns, normalizeFileReplacements } from '../utils';
30+
import { defaultProgress, normalizeAssetPatterns, normalizeFileReplacements } from '../utils';
3131
import { KarmaBuilderSchema } from './schema';
3232
const webpackMerge = require('webpack-merge');
3333

@@ -137,6 +137,8 @@ export class KarmaBuilder implements Builder<KarmaBuilderSchema> {
137137
supportES2015,
138138
};
139139

140+
wco.buildOptions.progress = defaultProgress(wco.buildOptions.progress);
141+
140142
const webpackConfigs: {}[] = [
141143
getCommonConfig(wco),
142144
getStylesConfig(wco),

packages/angular_devkit/build_angular/src/karma/schema.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@
7777
},
7878
"progress": {
7979
"type": "boolean",
80-
"description": "Log progress to the console while building.",
81-
"default": true
80+
"description": "Log progress to the console while building."
8281
},
8382
"watch": {
8483
"type": "boolean",

packages/angular_devkit/build_angular/src/server/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
import { readTsconfig } from '../angular-cli-files/utilities/read-tsconfig';
3131
import { requireProjectModule } from '../angular-cli-files/utilities/require-project-module';
3232
import { getBrowserLoggingCb } from '../browser';
33-
import { normalizeFileReplacements } from '../utils';
33+
import { defaultProgress, normalizeFileReplacements } from '../utils';
3434
import { BuildWebpackServerSchema } from './schema';
3535
const webpackMerge = require('webpack-merge');
3636

@@ -98,6 +98,8 @@ export class ServerBuilder implements Builder<BuildWebpackServerSchema> {
9898
supportES2015,
9999
};
100100

101+
wco.buildOptions.progress = defaultProgress(wco.buildOptions.progress);
102+
101103
const webpackConfigs: {}[] = [
102104
getCommonConfig(wco),
103105
getServerConfig(wco),

packages/angular_devkit/build_angular/src/server/schema.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@
8080
},
8181
"progress": {
8282
"type": "boolean",
83-
"description": "Log progress to the console while building.",
84-
"default": true
83+
"description": "Log progress to the console while building."
8584
},
8685
"i18nFile": {
8786
"type": "string",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export function defaultProgress(progress: boolean | undefined): boolean {
10+
if (progress === undefined) {
11+
return process.stdout.isTTY === true;
12+
}
13+
14+
return progress;
15+
}

packages/angular_devkit/build_angular/src/utils/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
export * from './default-progress';
910
export * from './run-module-as-observable-fork';
1011
export * from './normalize-file-replacements';
1112
export * from './normalize-asset-patterns';

0 commit comments

Comments
 (0)