-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(typedoc-plugin-appium): better sorting, refactors
trying to make some things less opaque. maybe failed
- Loading branch information
Showing
9 changed files
with
132 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/typedoc-plugin-appium/lib/model/builtin-commands.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import _ from 'lodash'; | ||
import {ModuleCommands, ProjectCommands, RouteMap} from '.'; | ||
import {BaseDriverDeclarationReflection} from '../converter/types'; | ||
|
||
/** | ||
* This is essentially a {@linkcode ProjectCommands} object with zero or one entries. | ||
* | ||
* The entry is intended to be reflection for `@appium/base-driver and the associated | ||
* {@linkcode ModuleCommands} object. | ||
* | ||
* If no reflection is provided--even if the `RouteMap` is present--the result of | ||
* {@linkcode BuiltinCommands.toProjectCommands} will be empty (because there will be no key). | ||
*/ | ||
export class BuiltinCommands { | ||
moduleCmds: ModuleCommands; | ||
|
||
/** | ||
* Note that since `@appium/base-driver` contains no execute methods, the `ModuleCommands` object | ||
* won't either. If, in the future, `@appium/base-driver` contains execute methods, this constructor | ||
* will want to accept another argument _or_ just accept a `ModuleCommands` object in lieu of a | ||
* `RouteMap`/`ExecMethodDataSet`. | ||
* @param routeMap Builtin route map | ||
* @param refl `@appium/base-driver` `BaseDriverDeclarationReflection` | ||
*/ | ||
constructor( | ||
routeMap: RouteMap = new Map(), | ||
public readonly refl?: BaseDriverDeclarationReflection | ||
) { | ||
this.moduleCmds = new ModuleCommands(routeMap); | ||
} | ||
|
||
/** | ||
* Converts this object to a {@linkcode ProjectCommands} object. | ||
* | ||
* Since the fields in this class are read-only, the contents of the `ProjectCommands` instance | ||
* will be invariant; thus we only need to create it once. | ||
* @returns A {@linkcode ProjectCommands} object with zero or one entry | ||
*/ | ||
public toProjectCommands = _.once(() => { | ||
return new ProjectCommands(this.refl ? [[this.refl.name, this.moduleCmds]] : []); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.