feat(fake-plugin): use peer deps
BREAKING CHANGE:
This now requires a peer dependency on `appium`
MODIFY
packages/fake-plugin/lib/logger.js
packages/fake-plugin/lib/logger.js
-import {logger} from '@appium/support';
+import {logger} from 'appium/support';
const log = logger.getLogger('FakePlugin');

MODIFY
packages/fake-plugin/lib/plugin.js
packages/fake-plugin/lib/plugin.js
+// @ts-check
/* eslint-disable no-case-declarations */
-import BasePlugin from '@appium/base-plugin';
+import {BasePlugin} from 'appium/plugin';
import B from 'bluebird';
-export default class FakePlugin extends BasePlugin {
+class FakePlugin extends BasePlugin {
async getFakePluginArgs() {
await B.delay(1);
return this.cliArgs;
}
+ /**
+ * @type {import('@appium/types').MethodMap<FakePlugin>}
+ */
static newMethodMap = {
'/session/:sessionId/fake_data': {
GET: {command: 'getFakeSessionData', neverProxy: true},
@@ -23,6 +27,7 @@ export default class FakePlugin extends BasePlugin {
},
};
+ /** @type {string?} */
static _unexpectedData = null;
static fakeRoute(req, res) {
@@ -33,8 +38,9 @@ export default class FakePlugin extends BasePlugin {
res.send(JSON.stringify(FakePlugin._unexpectedData));
FakePlugin._unexpectedData = null;
}
- // eslint-disable-next-line require-await
- static async updateServer(expressApp /*, httpServer*/) {
+
+ // eslint-disable-next-line no-unused-vars,require-await
+ static async updateServer(expressApp, httpServer) {
expressApp.all('/fake', FakePlugin.fakeRoute);
expressApp.all('/unexpected', FakePlugin.unexpectedData);
}
@@ -68,9 +74,11 @@ export default class FakePlugin extends BasePlugin {
return `<<${handle}>>`;
}
- onUnexpectedShutdown(driver, cause) {
+ // eslint-disable-next-line require-await
+ async onUnexpectedShutdown(driver, cause) {
FakePlugin._unexpectedData = `Session ended because ${cause}`;
}
}
export {FakePlugin};
+export default FakePlugin;

MODIFY
packages/fake-plugin/package.json
packages/fake-plugin/package.json
"bluebird": "3.7.2",
"lodash": "4.17.21"
},
+ "peerDependencies": {
+ "appium": "file:../appium"
+ },
"engines": {
"node": ">=12",
"npm": ">=6"

MODIFY
packages/fake-plugin/tsconfig.json
packages/fake-plugin/tsconfig.json
{
"compilerOptions": {
- "outDir": "./build",
- "paths": {
- "@appium/base-plugin": ["../base-plugin"],
- "@appium/support": ["../support"]
- }
- },
- "extends": "../../config/tsconfig.base.json",
- "include": ["lib"],
- "references": [
- {
- "path": "../base-plugin"
+ "outDir": "build"
},
- {
- "path": "../support"
- }
- ]
+ "extends": "../../config/tsconfig.plugin.json",
+ "include": ["lib"]
}
\ No newline at end of file

feat(fake-plugin): use peer deps

BREAKING CHANGE:

This now requires a peer dependency on `appium`