File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22// See LICENSE in the project root for license information.
33
4+ import * as os from 'os' ;
5+ import * as colors from 'colors' ;
6+
47import { CommandLineParser } from '@microsoft/ts-command-line' ;
58import { RunAction } from './RunAction' ;
69
@@ -16,6 +19,15 @@ export class ApiExtractorCommandLine extends CommandLineParser {
1619 protected onDefineParameters ( ) : void { // override
1720 }
1821
22+ protected onExecute ( ) : void { // override
23+ try {
24+ super . onExecute ( ) ;
25+ } catch ( error ) {
26+ console . error ( os . EOL + colors . red ( 'ERROR: ' + error . message . trim ( ) ) ) ;
27+ process . exitCode = 1 ;
28+ }
29+ }
30+
1931 private _populateActions ( ) : void {
2032 this . addAction ( new RunAction ( this ) ) ;
2133 }
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22// See LICENSE in the project root for license information.
33
4+ import * as colors from 'colors' ;
45import * as fsx from 'fs-extra' ;
56import * as os from 'os' ;
67import * as path from 'path' ;
@@ -84,7 +85,8 @@ export class RunAction extends CommandLineAction {
8485 } ) ;
8586
8687 if ( ! extractor . processProject ( ) ) {
87- throw new Error ( 'The build failed' ) ;
88+ console . log ( os . EOL + colors . yellow ( 'API Extractor completed with errors or warnings' ) ) ;
89+ process . exitCode = 1 ;
8890 }
8991 }
9092}
Original file line number Diff line number Diff line change @@ -97,8 +97,7 @@ export class Extractor {
9797 public constructor ( config : IExtractorConfig , options ?: IExtractorOptions ) {
9898 let mergedLogger : ILogger ;
9999 if ( options && options . customLogger ) {
100- mergedLogger = lodash . merge ( lodash . cloneDeep ( Extractor . _defaultLogger ) ,
101- options . customLogger ) ;
100+ mergedLogger = lodash . merge ( lodash . clone ( Extractor . _defaultLogger ) , options . customLogger ) ;
102101 } else {
103102 mergedLogger = Extractor . _defaultLogger ;
104103 }
You can’t perform that action at this time.
0 commit comments