I had intended to allow extensions to define a schema via `package.json` instead of a path to a file, and apparently forgot to implement this. So, now it is implemented.
Logging was happening here before the logger was properly initialized, which looked weird. Just remove logs for now until we find a better solution.
In addition, fixed some typing problems:
- we need `@types/node` for node globals (like errors that have a `code` property)
- set various typings as globals: `node`, `mocha`, `chai` & its ilk
- we want to reference this file from the documentation, and the easiest way to do so is just to add it to vcs. we can change where it lives later, if necessary.
- modify gulpfile to handle this
- revert changes to default boolean values
- fix types w/r/t the object returned by `parseArgs()`
- `.d.ts` files _and_ `.js` files can now be checked via `tsc` (given typescript Version 4.6.0-dev.20211102 or newer); remove `jsconfig.json` in lieu of `tsconfig.json`. js files will only be checked if `// @ts-check` pragma is present
- add more comments explaining various types
- fix some types in `lib/main.js`
- rename `args` to `parsedArgs` to be more obvious about what's what
- `parsedArgs` is now correctly typed! I think.
- fix `NormalizedAppiumConfiguration` (and rename to `NormalizedAppiumConfig`) which was essentially incorrect, since it did not respect `appiumCliDest` (e.g., `tmp` would be `tmpDir` in the config normalized by the code, but the type would not reflect this)
- add type for `driverConfig` prop to `AppiumDriver`
- remove a bunch of `default: false` nonsense from schema
- fix `tmp`, which is now stored in `tmpDir` as it should be
Note that any source file with a `// @ts-check` in it which operates on the parsed arguments object will have type support available. we're not linting the types (yet), but when we do, it will save us some potential headaches like incorrect usage or unknown arguments
When combining extension schemas with the base schema, the keywords weren't quite right (the extension name was not being recognized in any config files).
refactored a few things to support this, but the nut of it is in `AppiumSchema#finalize`, where we no longer use `anyOf`. I added a couple more functions to `ArgSpec` which generate various IDs and references in order to avoid having mysterious calls to `_.kebabCase()` everywhere.
in addition:
- no longer breaks if the exact same extension tries to register itself twice. this can happen if one happens to, say, instantiate multiple `DriverConfig`s. this happens in the tests. it _should_ not happen, since it's really unnecessary, so instead of this, we have a `DriverConfig.getInstance()` (and for `PluginConfig`) which keeps track of singletons linked to `APPIUM_HOME` dirs. at runtime, we're unlikely to ever need to instantiate multiple instances of these classes _anyway_, so it's on a per-appium-home basis mainly for testing purposes. the constructors are still usable directly, but discouraged (now marked `@private`).
- updated tests to reflect this change. in at least one place in the tests, we're trying to get at the actual extension class constructor, and were instantiating an extra `DriverConfig` to do that--but now we do not need to, as `DriverConfig.getInstance()` just grabs the one already created when we called `runExtensionCommand()`.
- removed unused `AppiumSchema#getAllSchemas`
- renamed "ID" to "ref" to be more clear about which identifier we're talking about--a schema reference, as one would put in a `$ref` field
- renamed arg `<extension-type>s` to `use-<extension-type>s` wherever necessary, since that arg was renamed; fix a bunch of fixtures
- restore default value of `[]` to `use-plugins`, since the code expects it to be defined