Skip to content

Commit e53f02a

Browse files
author
Pat Herlihy
committed
fix(options): Increase argument options reader discover event priority
Previously the arguments reader would run after both the tsconfig and typedoc readers. However, both of those readers rely on event data such as "-options" that is parsed by the arguments reader which leads to issues when trying to point to a given config using a CLI argument.
1 parent 800730f commit e53f02a

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/lib/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
115115
}
116116

117117
this.plugins.load();
118-
return this.options.read(options, OptionsReadMode.Fetch);
118+
return this.options.read(this.options.getRawValues(), OptionsReadMode.Fetch);
119119
}
120120

121121
/**

src/lib/utils/options/readers/arguments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class ArgumentsReader extends OptionsComponent {
5858
files.push(arg);
5959
}
6060
}
61-
if (files) {
61+
if (files && files.length > 0) {
6262
event.inputFiles = files;
6363
}
6464
}

src/lib/utils/options/readers/tsconfig.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as _ from 'lodash';
44
import * as ts from 'typescript';
55

66
import { Component, Option } from '../../component';
7-
import { OptionsComponent, DiscoverEvent } from '../options';
7+
import { OptionsComponent, OptionsReadMode, DiscoverEvent } from '../options';
88
import { ParameterType, ParameterHint } from '../declaration';
99
import { TypeScriptSource } from '../sources/typescript';
1010

@@ -35,6 +35,11 @@ export class TSConfigReader extends OptionsComponent {
3535
}
3636

3737
onDiscover(event: DiscoverEvent) {
38+
// Do nothing until were fetching options
39+
if (event.mode !== OptionsReadMode.Fetch) {
40+
return;
41+
}
42+
3843
if (TSConfigReader.OPTIONS_KEY in event.data) {
3944
this.load(event, Path.resolve(event.data[TSConfigReader.OPTIONS_KEY]));
4045
} else if (TSConfigReader.PROJECT_KEY in event.data) {

src/lib/utils/options/readers/typedoc.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as FS from 'fs';
33
import * as _ from 'lodash';
44

55
import { Component, Option } from '../../component';
6-
import { OptionsComponent, DiscoverEvent } from '../options';
6+
import { OptionsComponent, OptionsReadMode, DiscoverEvent } from '../options';
77
import { ParameterType, ParameterHint } from '../declaration';
88

99
@Component({name: 'options:typedoc'})
@@ -26,6 +26,11 @@ export class TypedocReader extends OptionsComponent {
2626
}
2727

2828
onDiscover(event: DiscoverEvent) {
29+
// Do nothing until were fetching options
30+
if (event.mode !== OptionsReadMode.Fetch) {
31+
return;
32+
}
33+
2934
if (TypedocReader.OPTIONS_KEY in event.data) {
3035
this.load(event, Path.resolve(event.data[TypedocReader.OPTIONS_KEY]));
3136
} else if (this.application.isCLI) {

0 commit comments

Comments
 (0)