`@appium/schema` is a package which was extracted from `appium`. It _only_ contains the schema. The impetus here was to avoid cyclical dependencies, since `appium` depends on `@appium/types`, and `@appium/types` depends on the schema. This package breaks the cycle.
The `scripts/generate-schema-json.js` (which converts the compiled JS schema file into JSON) has moved into this package, and the generated JSON file is now under version control. This is because the `generate-schema-types.js` script (previously `generate-schema-declarations`) depends on it, and `@appium/types` depends on the generated types. The generated types are _also_ under version control. I do not expect the schema to change often, so I believe the tradeoff to be worth it.
## @appium/schema
`lib/appium-config-schema.js` is the "single source of truth" for the schema.
## appium
- Removed schema source
- Removed namespaces from internal types because they suck (see change to `types/index.d.ts`)
- Removed unused `continuation-local-storage`
- Add dep for `@appium/schema`
- Added a TS project dependency on `@appium/schema`
## @appium/types
- The "sources" have moved from `src` to `lib` for consistency.
- `lib/appium-config.ts` (the generated types) are now under version control.
- `lib/schema/` has been removed (it previously held the JSON schema artifact)
- `scripts/generate-schema-declarations.js` becomes `scripts/generate-schema-types.js`
- Updated scripts in `package.json`
- Added dep for `@appium/schema`
- Added a TS project dependency on `@appium/schema`
## Other
- Reorganize root `tsconfig.json`; add `schema` reference; remove unused `noEmit: true`
- Sort root `package.json`
- Remove schema JSON and schema declarations scripts, since those are now both handled in their respective packages
- Remove `lint-staged` config for schema file, since it didn't work right anyway (still need to do something about this, but probably doesn't need to be in a precommit hook)
- Remove stuff from `.gitignore`
Closes#16674
the problem here was the existence of the empty `package.json`. it should exist, because if it doesn't, then `npm` may end up using a `package.json` in a parent directory. but it can't be _empty_, because subsequent `npm install`s will essentially remove any package that it's currently not installing! `npm` likes to "fix" `node_modules`, which is undesirable here.
to avoid this, the behavior has changed to persisting the dependency version to `package.json`. behavior differs if we're using a local `APPIUM_HOME` or the default one. with the default, we have more control, and choose to use `--save-dev --save-exact --no-package-lock --global-style` which gives us what we need. if `APPIUM_HOME` is a local package, all we can do is `--save-dev` (since it's _likely_ that an extension will be a dev dependency). in the future, we may choose to actually determine _what kind_ of dependency `appium` is and tell `npm` to use the same one. not sure if that's needed, though.
further, in the case of a local appium dep (local `APPIUM_HOME`), updating `package.json` should cause the package hash (used by the thing that syncs `extensions.yaml` with installed packages) to update as well, so we're doing that.
modified the logic in `ExtensionCommand` to treat `--source=local` to pass the `installSpec` thru verbatim.
also fixed `BuildInfo` type to reflect reality and use `@types/teen_process`. fixed some other broken types in `test` (files in `test` are not checked by typescript yet; we'll need a separate `tsconfig.json` for this, since we do not want to emit declarations)
'npm link' is weird and we do not need to use it. `npm install /path/to/some/module` will create a symbolic link, but it _won't_ create a global link. it otherwise behaves similarly to `npm install`.
- also updated to use `@types/teen_process`
- fixed some weird types in `util.getLockFileGuard()`
This will be run before publish, and will copy the root `LICENSE` file to all packages, so that they appear in the published tarballs.
`packages/*/LICENSE` are ignored by Git, since they are redundant with the root `LICENSE` file.
* feat(appium): generate declaration files
Configure TS to generate declaration files for `appium` package.
Most of these changes are just types getting added or changed via docstrings; in other places, typechecking has caught problems and I had to refactor code to address them.
- Removed `// @ts-check` pragma from all files in `lib/`, since now `checkJs: true` is in `tsconfig.json`. It needs to stay in place elsewhere (I think) because only sources in `lib` have declarations generated.
- The `install`, `uninstall`, `update` and `run` functions in the base `ExtensionCommand` class were renamed and prefixed with a `_`; TS does not allow overridden functions with differing signatures. It no longer exports a default.
- Removed `type` prop of options for `DriverCommand` and `PluginCommand` constructors, respectively (this value is derived from the `ExtensionConfig` `config` parameter instead)
- `AppiumDriver` now extends `DriverCore` instead of `BaseDriver`, since some of its function signatures differ from `BaseDriver`'s.
- Small refactor of `deleteSession` to make typechecker happy.
- `executeCommand` now calls to `BaseDriver` directly if `isUmbrellaCmd` is truthy. This is one place where inheritance just kind of breaks, since `BaseDriver#executeCommand` returns something entirely different than `AppiumDriver#executeCommand` would otherwise.
- Removed `--delete-dir-on-start` from build command, since it may blast generated declarations.
- Reorganize declarations in `types/`; moved some of them out of `@typedef`s. `types.d.ts` becomes `index.d.ts`
- Note that this contains the declarations for `PluginClass` and `DriverClass`, which correspond to the types of extension "main" classes. This differs from the interfaces provided in `@appium/types` (e.g., `Driver`, `ExternalDriver`) in that these aren't just objects; they are classes with constructors and static members. I may end up moving some of this stuff into `@appium/types`, but I'm not sure how useful it will be. Will see when I add types to `@appium/fake-driver`.
* chore(appium): remove transpile directives
this was ostensibly for gulp-babel
* chore(appium): remove redundant type declaration
* fix(appium): avoid potential unhandled rejections
- make types more readable
* chore(appium): fix capabilities types
- move `scripts/generate*` elsewhere
- add reference to `@appium/types` in `tsconfig.json`
* chore(appium): review updates for legibility