Closed dbjorge closed 4 years ago
@codebytere / @jkleinsc are you the right folks to request a code review from? I'm afraid I'm not familiar with this repo's contribution process.
Thanks!
any news on this one?
Version 9.0.0 of chromedriver now allows setting of a custom version by setting the environment variable ELECTRON_CUSTOM_VERSION
to the version desired, so this PR is no longer necessary.
Summary
This PR adds support and documentation for a
ELECTRON_CHROMEDRIVER_CUSTOM_VERSION
environment variable/.npmrc
variable. If set, it will override the library's existing default behavior of using the library version.Motivation
My team publishes an Electron app that is built against internally-built Electron binaries, and we wanted to be able to test against correspondingly built chromedriver binaries. We wanted to avoid the use of
ELECTRON_CUSTOM_FILENAME
for this, since the filenames encode platform information and we'd rather keep as much of our build config as possible platform-agnostic. However, the default filename also encodes version information from this library, which mismatches the version produced by the custom build we set inELECTRON_CUSTOM_DIR
. The example included in theREADME.md
update here is an anonymized version of our team's desired use case.Implementation notes
49 would address this for us, but I wasn't sure how to reasonably address the comments there (it didn't seem thrilling to add a
peerDependency
on electron to be able to read itspackage.json
version sanely, nor did it seem thrilling to try reading the various types of lockfiles that might exist), so I went with this more manual option instead.For the specific name of the new config value and the precedence order for checking the assorted env var options, I tried to follow the example of what electron-download does for the similar custom mirror/dir/filename variables (https://github.com/electron/get/blob/master/src/artifact-utils.ts#L27).
The custom version logic intentionally avoids the existing fallback mechanism to x.y.0 used with the default version logic; my expectation is that if someone is setting a custom version, they presumably care to be using exactly the version they say they want to use. It leaves the fallback logic as-is when using the old default-version behavior.