fix(appium): fix problematic ExtManifestWithSchema type
This type was having trouble due to a potential bug in `type-fest`
Also fixed an issue with an unused variable
MODIFY
packages/appium/lib/cli/extension-command.js
packages/appium/lib/cli/extension-command.js
@@ -262,7 +262,6 @@ class ExtensionCommand {
installSpec,
installType,
pkgName: /** @type {string} */ (packageName),
- installType,
};
probableExtName = installSpec;
} else {
@@ -651,7 +650,7 @@ class ExtensionCommand {
const {pkgName, installType} = this.config.installedExtensions[installSpec];
const extData = await this.installViaNpm({
installSpec,
- installType: 'npm',
+ installType,
pkgName,
pkgVer: version,
});

MODIFY
packages/appium/lib/extension/extension-config.js
packages/appium/lib/extension/extension-config.js
@@ -634,36 +634,39 @@ export {INSTALL_TYPE_NPM, INSTALL_TYPE_GIT, INSTALL_TYPE_LOCAL, INSTALL_TYPE_GIT
/**
* @typedef {import('@appium/types').ExtensionType} ExtensionType
* @typedef {import('./manifest').Manifest} Manifest
+ * @typedef {import('../cli/extension-command').ExtensionListData} ExtensionListData
+ * @typedef {import('../cli/extension-command').InstalledExtensionListData} InstalledExtensionListData
+ * @typedef {import('appium/types').InstallType} InstallType
*/
/**
- * @template T
- * @typedef {import('appium/types').ExtManifest<T>} ExtManifest
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtManifest<ExtType>} ExtManifest
*/
/**
- * @template T
- * @typedef {import('appium/types').ExtManifestWithSchema<T>} ExtManifestWithSchema
+ * @template {ExtensionType} ExtType
+ * @typedef {ExtManifest<ExtType> & {schema: NonNullable<ExtManifest<ExtType>['schema']>}} ExtManifestWithSchema
*/
/**
- * @template T
- * @typedef {import('appium/types').ExtName<T>} ExtName
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtName<ExtType>} ExtName
*/
/**
- * @template T
- * @typedef {import('appium/types').ExtClass<T>} ExtClass
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtClass<ExtType>} ExtClass
*/
/**
- * @template T
- * @typedef {import('appium/types').ExtRecord<T>} ExtRecord
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtRecord<ExtType>} ExtRecord
*/
/**
- * @template T
- * @typedef {import('../cli/extension').ExtCommand<T>} ExtCommand
+ * @template {ExtensionType} ExtType
+ * @typedef {import('../cli/extension').ExtCommand<ExtType>} ExtCommand
*/
/**
@@ -671,13 +674,3 @@ export {INSTALL_TYPE_NPM, INSTALL_TYPE_GIT, INSTALL_TYPE_LOCAL, INSTALL_TYPE_GIT
* @typedef ExtensionConfigMutationOpts
* @property {boolean} [write=true] Whether or not to write the manifest to disk after a mutation operation
*/
-
-/**
- * A valid install type
- * @typedef {typeof INSTALL_TYPE_NPM | typeof INSTALL_TYPE_GIT | typeof INSTALL_TYPE_LOCAL | typeof INSTALL_TYPE_GITHUB} InstallType
- */
-
-/**
- * @typedef {import('../cli/extension-command').ExtensionListData} ExtensionListData
- * @typedef {import('../cli/extension-command').InstalledExtensionListData} InstalledExtensionListData
- */

MODIFY
packages/appium/test/unit/extension/driver-config.spec.js
packages/appium/test/unit/extension/driver-config.spec.js
@@ -348,14 +348,15 @@ describe('DriverConfig', function () {
/**
* @typedef {import('@appium/types').DriverType} DriverType
* @typedef {import('appium/lib/extension/driver-config').DriverConfig} DriverConfig
+ * @typedef {import('@appium/types').ExtensionType} ExtensionType
*/
/**
- * @template {import('@appium/types').ExtensionType} ExtType
- * @typedef {import('appium/types').ExtManifestWithSchema<ExtType>} ExtManifestWithSchema
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtManifest<ExtType>} ExtManifest
*/
/**
- * @template {import('@appium/types').ExtensionType} ExtType
- * @typedef {import('appium/types').ExtManifest<ExtType>} ExtManifest
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtManifest<ExtType> & {schema: NonNullable<import('appium/types').ExtManifest<ExtType>['schema']>}} ExtManifestWithSchema
*/

MODIFY
packages/appium/test/unit/extension/plugin-config.spec.js
packages/appium/test/unit/extension/plugin-config.spec.js
@@ -347,9 +347,10 @@ describe('PluginConfig', function () {
/**
* @typedef {import('@appium/types').PluginType} PluginType
* @typedef {import('appium/lib/extension/plugin-config').PluginConfig} PluginConfig
+ * @typedef {import('@appium/types').ExtensionType} ExtensionType
*/
/**
- * @template {import('@appium/types').ExtensionType} ExtType
- * @typedef {import('appium/types').ExtManifestWithSchema<ExtType>} ExtManifestWithSchema
+ * @template {ExtensionType} ExtType
+ * @typedef {import('appium/types').ExtManifest<ExtType> & {schema: NonNullable<import('appium/types').ExtManifest<ExtType>['schema']>}} ExtManifestWithSchema
*/

MODIFY
packages/appium/types/cli.ts
packages/appium/types/cli.ts
import {DriverType, PluginType, ServerArgs} from '@appium/types';
import {SetOptional} from 'type-fest';
-import {InstallType} from './appium-manifest';
+import {InstallType} from './manifest';
export type ServerCommand = 'server';
export type DriverCommand = DriverType;
export type PluginCommand = PluginType;

MODIFY
packages/appium/types/manifest/base.ts
packages/appium/types/manifest/base.ts
@@ -129,14 +129,6 @@ export interface ManifestData {
schemaRev?: number;
}
-/**
- * Like {@linkcode ExtManifest} but for-sure has a `schema` prop.
- */
-export type ExtManifestWithSchema<ExtType extends ExtensionType> = SetRequired<
- ExtManifest<ExtType>,
- 'schema'
->;
-
/**
* The name of an installed extension, as it appears in `extensions.yaml`
* (as a property name under `drivers` or `plugins`)

MODIFY
packages/appium/types/manifest/v3.ts
packages/appium/types/manifest/v3.ts
@@ -132,14 +132,6 @@ export interface ManifestData {
schemaRev: number;
}
-/**
- * Like {@linkcode ExtManifest} but for-sure has a `schema` prop.
- */
-export type ExtManifestWithSchema<ExtType extends ExtensionType> = SetRequired<
- ExtManifest<ExtType>,
- 'schema'
->;
-
/**
* The name of an installed extension, as it appears in `extensions.yaml`
* (as a property name under `drivers` or `plugins`)

fix(appium): fix problematic ExtManifestWithSchema type

This type was having trouble due to a potential bug in `type-fest`

Also fixed an issue with an unused variable