fix(appium): create cjs wrapper
ADD
packages/appium/index.js
+#!/usr/bin/env node
+
+const {asyncify} = require('asyncbox');
+
+const appium = require('./build/lib/main.js');
+
+if (require.main === module) {
+ asyncify(appium.main);
+}
+
+module.exports = appium;

MODIFY
packages/appium/lib/main.js
packages/appium/lib/main.js
@@ -335,6 +335,9 @@ async function main (args) {
return server;
}
+// NOTE: this is here for backwards compat for any scripts referencing `main.js` directly
+// (more specifically, `build/lib/main.js`)
+// the executable is now `../index.js`, so that module will typically be `require.main`.
if (require.main === module) {
asyncify(main);
}

MODIFY
packages/appium/package.json
packages/appium/package.json
},
"license": "Apache-2.0",
"author": "https://github.com/appium",
- "main": "./build/lib/main.js",
"bin": {
- "appium": "./build/lib/main.js"
+ "appium": "index.js"
},
"directories": {
"lib": "./lib"
"files": [
"bin",
"lib",
- "build/lib",
+ "build",
+ "index.js",
"postinstall.js",
"types"
],
"zip-and-upload": "npm run zip && npm run upload"
},
"dependencies": {
- "@appium/base-driver": "^8.2.0",
+ "@appium/base-driver": "file:../base-driver",
"@appium/base-plugin": "1.8.0",
- "@appium/support": "^2.55.1",
+ "@appium/support": "file:../support",
"@babel/runtime": "7.16.3",
"@sidvind/better-ajv-errors": "0.9.2",
"ajv": "8.8.1",
"word-wrap": "1.2.3",
"yaml": "1.10.2"
},
- "devDependencies": {
- "@appium/fake-driver": "^3.2.0",
- "@appium/gulp-plugins": "^5.5.5"
- },
"engines": {
"node": ">=12",
"npm": ">=6"

fix(appium): create cjs wrapper