The proof of concept is a monorepo with Lerna, where the repo has scoped NPM packages that export drivers (@appium/xcuitest-driver
, @appium/espresso-driver
, etc...). The package appium
is a CLI that installs and manages these drivers.
- Appium 1.x imports and bundles together all drivers. The PoC breaks Appium into different packages.
- One package is
@appium/builder
, which does almost exactly whatappium/appium@1
does, except instead of running the Appium server, it exposes an API that is used to build and run an Appium server.
//example usage
new AppiumBuilder()
.withAutomation('appium-xcuitest-driver', XCUITestDriver)
.withAutomation('appium-espresso-driver', EspressoDriver)
.run()
- The package
appium
is a CLI that installs drivers, uninstalls drivers, etc... (all the things discussed in the proposal). It uses@appium/builder
to take the installed drivers and run them. The drivers are installed to a directory that is kept on the user's filesystem.
// appium/lib/index.js
#!/usr/bin/env node
// transpile:main
module.exports = require('@oclif/command');
import { asyncify } from 'asyncbox';
import path from 'path';
import AppiumBuilder from '@appium/builder';
import _ from 'lodash';
async function main (args = null) {
const drivers = require(path.resolve('appium-drivers', 'drivers.json'));
const builder = new AppiumBuilder();
for (let [name, packageInfo] of _.toPairs(drivers)) {
const packageName = packageInfo.package;
const driver = require(path.resolve('appium-drivers', 'node_modules', packageName)).default;
builder.withAutomation(name, driver);
}
return await builder.run(args);
}
if (require.main === module) {
asyncify(main);
}
export { main };
- The monorepo approach with Lerna allows one-stop versioning and publishing. The drivers can all be published with one command
lerna publish
which publishes the packages in the repo, and only publishes packages that have changed since the last time they were published. - We can keep doing Appium versioning via Git tags (2.0.0, 2.1.0, 2.1.1, ...) and use the semver-esque versioning schema that we're currently using
- The packages will be published to NPM and use strict semver versioning
appium
: The CLI that installs and manages the drivers. Uses@appium/builder
as a dependency to run the drivers.@appium/builder
: A package that is used to build Appium servers@appium/xcuitest
: A package that exportsappium-xcuitest-driver
@appium/uiautomator2
: A package that exportsappium-uiautomator2-driver