MCPcopy Create free account
hub / github.com/appium/appium / resetAllExtensions

Function resetAllExtensions

packages/appium/lib/cli/setup-command.ts:107–136  ·  view source on GitHub ↗

* Resets all installed drivers and extensions

(driverConfig: DriverConfig, pluginConfig: PluginConfig)

Source from the content-addressed store, hash-verified

105 * Resets all installed drivers and extensions
106 */
107async function resetAllExtensions(driverConfig: DriverConfig, pluginConfig: PluginConfig): Promise<void> {
108 const commandConfigs: [CliExtensionCommand, DriverConfig | PluginConfig][] = [
109 ['driver', driverConfig],
110 ['plugin', pluginConfig],
111 ];
112 for (const [command, config] of commandConfigs) {
113 for (const extensionName of Object.keys(config.installedExtensions)) {
114 try {
115 await uninstallExtension(extensionName, extensionCommandArgs(command, extensionName, 'uninstall'), config);
116 } catch (e) {
117 log.warn(
118 `${extensionName} ${command} cannot be uninstalled. Will delete the manifest anyway. ` +
119 `Original error: ${e instanceof Error ? e.stack : String(e)}`,
120 );
121 }
122 }
123
124 const manifestPath = config.manifestPath;
125 if (!manifestPath || !(await fs.exists(manifestPath))) {
126 continue;
127 }
128
129 await fs.rimraf(manifestPath);
130 if (await fs.exists(manifestPath)) {
131 throw new Error(`${command} manifest at '${manifestPath}' cannot be deleted. Is it accessible?`);
132 } else {
133 log.info(`Successfully deleted ${command} manifest at '${manifestPath}'`);
134 }
135 }
136}
137
138/**
139 * Install drivers listed in DEFAULT_DRIVERS.

Callers 1

runSetupCommandFunction · 0.85

Calls 6

uninstallExtensionFunction · 0.85
extensionCommandArgsFunction · 0.85
existsMethod · 0.80
warnMethod · 0.65
rimrafMethod · 0.65
infoMethod · 0.65

Tested by

no test coverage detected