Skip to content

Commit 02cefcf

Browse files
committed
Simplify the ExtractorConfig method names
1 parent dfc5a9d commit 02cefcf

4 files changed

Lines changed: 23 additions & 24 deletions

File tree

apps/api-extractor/src/api/Extractor.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,16 @@ export class Extractor {
140140
/**
141141
* Load the api-extractor.json config file from the specified path, and then invoke API Extractor.
142142
*/
143-
public static invokeUsingConfigFromFile(configFilePath: string, options?: IExtractorInvokeOptions): ExtractorResult {
144-
const extractorConfig: ExtractorConfig = ExtractorConfig.loadAndParseConfig(configFilePath);
143+
public static loadConfigAndInvoke(configFilePath: string, options?: IExtractorInvokeOptions): ExtractorResult {
144+
const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(configFilePath);
145145

146-
return Extractor.invokeUsingConfig(extractorConfig, options);
146+
return Extractor.invoke(extractorConfig, options);
147147
}
148148

149149
/**
150150
* Invoke API Extractor using an already prepared `ExtractorConfig` object.
151151
*/
152-
public static invokeUsingConfig(extractorConfig: ExtractorConfig,
153-
options?: IExtractorInvokeOptions): ExtractorResult {
152+
public static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult {
154153

155154
if (!options) {
156155
options = { };

apps/api-extractor/src/api/ExtractorConfig.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ interface IExtractorConfigTokenContext {
4545
}
4646

4747
/**
48-
* Options for {@link ExtractorConfig.parseConfigObject}.
48+
* Options for {@link ExtractorConfig.prepare}.
4949
*
5050
* @public
5151
*/
52-
export interface IExtractorConfigParseConfigObjectOptions {
52+
export interface IExtractorConfigPrepareOptions {
5353
/**
54-
* An already prepared configuration object as returned by {@link ExtractorConfig.loadJsonFileWithInheritance}.
54+
* An already prepared configuration object as returned by {@link ExtractorConfig.loadFile}.
5555
*/
5656
configObject: IConfigFile;
5757

@@ -230,15 +230,15 @@ export class ExtractorConfig {
230230
* along with the API Extractor defaults.
231231
* The result is parsed and returned.
232232
*/
233-
public static loadAndParseConfig(configJsonFilePath: string): ExtractorConfig {
233+
public static loadFileAndPrepare(configJsonFilePath: string): ExtractorConfig {
234234
const configObjectFullPath: string = path.resolve(configJsonFilePath);
235-
const configObject: IConfigFile = ExtractorConfig.loadJsonFileWithInheritance(configObjectFullPath);
235+
const configObject: IConfigFile = ExtractorConfig.loadFile(configObjectFullPath);
236236

237237
const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();
238238
const packageJsonFullPath: string | undefined = packageJsonLookup.tryGetPackageJsonFilePathFor(
239239
configObjectFullPath);
240240

241-
const extractorConfig: ExtractorConfig = ExtractorConfig.parseConfigObject({
241+
const extractorConfig: ExtractorConfig = ExtractorConfig.prepare({
242242
configObject,
243243
configObjectFullPath,
244244
packageJsonFullPath
@@ -248,16 +248,16 @@ export class ExtractorConfig {
248248
}
249249

250250
/**
251-
* Performs only the first half of {@link ExtractorConfig.loadAndParseConfig}, providing an opportunity to
252-
* modify the object before it is pssed to {@link ExtractorConfig.parseConfigObject}.
251+
* Performs only the first half of {@link ExtractorConfig.loadFileAndPrepare}, providing an opportunity to
252+
* modify the object before it is pssed to {@link ExtractorConfig.prepare}.
253253
*
254254
* @remarks
255255
*
256256
* Loads the api-extractor.json config file from the specified file path.
257257
* If the "extends" field is present, the referenced file(s) will be merged,
258258
* along with the API Extractor defaults.
259259
*/
260-
public static loadJsonFileWithInheritance(jsonFilePath: string): IConfigFile {
260+
public static loadFile(jsonFilePath: string): IConfigFile {
261261
// Set to keep track of config files which have been processed.
262262
const visitedPaths: Set<string> = new Set<string>();
263263

@@ -320,7 +320,7 @@ export class ExtractorConfig {
320320
* Parses the api-extractor.json configuration provided as a runtime object, rather than reading it from disk.
321321
* This allows configurations to be customized or constructed programmatically.
322322
*/
323-
public static parseConfigObject(options: IExtractorConfigParseConfigObjectOptions): ExtractorConfig {
323+
public static prepare(options: IExtractorConfigPrepareOptions): ExtractorConfig {
324324
const filenameForErrors: string = options.configObjectFullPath || 'the configuration object';
325325
const configObject: Partial<IConfigFile> = options.configObject;
326326

apps/api-extractor/src/cli/RunAction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ export class RunAction extends CommandLineAction {
123123
}
124124

125125
const configFullPath: string = path.resolve(configFilename);
126-
const mergedConfig: IConfigFile = ExtractorConfig.loadJsonFileWithInheritance(configFullPath);
126+
const mergedConfig: IConfigFile = ExtractorConfig.loadFile(configFullPath);
127127

128-
const extractorConfig: ExtractorConfig = ExtractorConfig.parseConfigObject({
128+
const extractorConfig: ExtractorConfig = ExtractorConfig.prepare({
129129
configObject: mergedConfig,
130130
configObjectFullPath: configFullPath,
131131
packageJsonFullPath: lookup.tryGetPackageJsonFilePathFor(configFullPath)
132132
});
133133

134-
const extractorResult: ExtractorResult = Extractor.invokeUsingConfig(extractorConfig,
134+
const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig,
135135
{
136136
localBuild: this._localParameter.value,
137137
typescriptCompilerFolder: typescriptCompilerFolder

common/reviews/api/api-extractor.api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export class CompilerState {
1717

1818
// @public
1919
export class Extractor {
20-
static invokeUsingConfig(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult;
21-
static invokeUsingConfigFromFile(configFilePath: string, options?: IExtractorInvokeOptions): ExtractorResult;
20+
static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult;
21+
static loadConfigAndInvoke(configFilePath: string, options?: IExtractorInvokeOptions): ExtractorResult;
2222
static readonly packageName: string;
2323
static readonly version: string;
2424
}
@@ -34,14 +34,14 @@ export class ExtractorConfig {
3434
_getShortFilePath(absolutePath: string): string;
3535
static hasDtsFileExtension(filePath: string): boolean;
3636
static readonly jsonSchema: JsonSchema;
37-
static loadAndParseConfig(configJsonFilePath: string): ExtractorConfig;
38-
static loadJsonFileWithInheritance(jsonFilePath: string): IConfigFile;
37+
static loadFile(jsonFilePath: string): IConfigFile;
38+
static loadFileAndPrepare(configJsonFilePath: string): ExtractorConfig;
3939
readonly mainEntryPointFile: string;
4040
readonly messages: IExtractorMessagesConfig;
4141
readonly overrideTsconfig: {} | undefined;
4242
readonly packageJson: INodePackageJson | undefined;
4343
readonly packageJsonFullPath: string | undefined;
44-
static parseConfigObject(options: IExtractorConfigParseConfigObjectOptions): ExtractorConfig;
44+
static prepare(options: IExtractorConfigPrepareOptions): ExtractorConfig;
4545
readonly publicTrimmedFilePath: string;
4646
readonly reportFilePath: string;
4747
readonly rollupEnabled: boolean;
@@ -176,7 +176,7 @@ export interface IConfigTsdocMetadata {
176176
}
177177

178178
// @public
179-
export interface IExtractorConfigParseConfigObjectOptions {
179+
export interface IExtractorConfigPrepareOptions {
180180
configObject: IConfigFile;
181181
configObjectFullPath: string | undefined;
182182
packageJson?: INodePackageJson | undefined;

0 commit comments

Comments
 (0)