fix: minify mainlib docs json (#9963)

* fix: minify mainlib docs json

* fix: minify them all
This commit is contained in:
Qjuh
2023-11-14 09:13:28 +01:00
committed by GitHub
parent f9177be61b
commit 4b88306dcb
15 changed files with 41 additions and 14 deletions

View File

@@ -41,6 +41,11 @@ export interface IExtractorInvokeOptions {
*/
compilerState?: CompilerState;
/**
* Whether to minify the resulting doc model JSON, i.e. without any indentation or newlines.
*/
docModelMinify?: boolean;
/**
* Indicates that API Extractor is running as part of a local build, e.g. on developer's
* machine.
@@ -270,7 +275,7 @@ export class Extractor {
apiPackage.saveToJsonFile(extractorConfig.apiJsonFilePath, {
toolPackage: Extractor.packageName,
toolVersion: Extractor.version,
minify: options?.docModelMinify ?? false,
newlineConversion: extractorConfig.newlineKind,
ensureFolderExists: true,
testMode: extractorConfig.testMode,

View File

@@ -27,6 +27,8 @@ export class RunAction extends CommandLineAction {
private readonly _typescriptCompilerFolder: CommandLineStringParameter;
private readonly _minify: CommandLineFlagParameter;
public constructor(_parser: ApiExtractorCommandLine) {
super({
actionName: 'run',
@@ -57,6 +59,12 @@ export class RunAction extends CommandLineAction {
description: 'Show additional informational messages in the output.',
});
this._minify = this.defineFlagParameter({
parameterLongName: '--minify',
parameterShortName: '-m',
description: 'Minify the resulting doc model JSON, i.e. without any indentation or newlines.',
});
this._diagnosticsParameter = this.defineFlagParameter({
parameterLongName: '--diagnostics',
description:
@@ -136,6 +144,7 @@ export class RunAction extends CommandLineAction {
const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {
localBuild: this._localParameter.value,
docModelMinify: this._minify.value,
showVerboseMessages: this._verboseParameter.value,
showDiagnostics: this._diagnosticsParameter.value,
typescriptCompilerFolder,