@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
40 lines • 1.58 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const colors = require("colors");
const os = require("os");
const ts_command_line_1 = require("@microsoft/ts-command-line");
const RunAction_1 = require("./RunAction");
class ApiExtractorCommandLine extends ts_command_line_1.CommandLineParser {
constructor() {
super({
toolFilename: 'api-extractor',
toolDescription: 'This is an experimental command line interface for the API Extractor tool.'
});
this._populateActions();
}
onDefineParameters() {
this._debugParameter = this.defineFlagParameter({
parameterLongName: '--debug',
parameterShortName: '-d',
description: 'Show the full call stack if an error occurs while executing the tool'
});
}
onExecute() {
return super.onExecute().catch((error) => {
if (this._debugParameter.value) {
console.error(os.EOL + error.stack);
}
else {
console.error(os.EOL + colors.red('ERROR: ' + error.message.trim()));
}
process.exitCode = 1;
});
}
_populateActions() {
this.addAction(new RunAction_1.RunAction(this));
}
}
exports.ApiExtractorCommandLine = ApiExtractorCommandLine;
//# sourceMappingURL=ApiExtractorCommandLine.js.map