Support XDG_CACHE_HOME and make npm_config_tmp work #232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref #72.
For npm_config_tmp to work as (optional) override for the default
temporary directory, it has to be checked first, not last
in the chain of default-operator checks.
Add support for XDG_CACHE_HOME which some XDG-compliant environments
will set to a directory that is persisted between CI runs and such.
The XDG Cache home concept is ideal for this purpose because
node-chromedriver takes care to clean up after itself and uses a
deterministic filename. As such, it won't grow out of control and can
be safely cached and persisted when XDG is provided.
This way, downstream users of node-chromedriver are not required to
set npm_config_tmp to a persisted directory, which can be undesirable
due to the inherit nature and expectation of a temp directory.
E.g. software tends to place files with random files name here, or
leave behind large files, a directory with files that would grow
rapidly if persisted between subsequent CI runs.
Remove the redundant manual handling of TMPDIR, TMP and "/tmp".
These predate the addition of os.tmpdir() by 60c4706, which
handles all these already. This code appears to be inspired by
https://github.com/Medium/phantomjs/blob/v2.1.8/install.js#L107,
which also does not have these additional checks.