appium
appium copied to clipboard
v2: npm-managed extension behavior questions
Currently in Appium 2 (and #16443), appium <driver|plugin> install <extension>
does not write a new dependency to any package.json
.
It may make sense to actually write the dependency, if the closest package.json
contains appium
as a dependency. I cannot decide if this would violate the element of least surprise (assuming we give notice to the end-user).
A potential issue is that when appium
installs an extension, it will do so with --global-style
(in #16443), which prevents deduping. If a user deletes node_modules
, then does an npm install
again, the resulting node_modules
will be deduped, and thus will not be identical to the directory hierarchy after appium
was used.
Perhaps makes sense to just not use --global-style
in the case that we have an appium
dep in package.json
, and let npm
do whatever it's going to do. Once extensions start getting installed via other means than appium
, we will be losing control; we cannot feasibly rectify the situation at runtime without detection of a deduped module tree and re-installation via --global-style
.
This does not imply that we shouldn't be using --global-style
if APPIUM_HOME
is, say, ~/.appium
; I think that's the right choice.
Yeah, I'm kind of thinking the whole "use NPM to manage dependencies" is an "I'm using Node and I know what I'm doing" category. So it would make sense to not use --global-style
in that case. We should probably make clear that you should only use NPM yourself or use the Appium CLI, but not both.