Enable use outside of node.js environments #186
Closed
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.
Here's the reason for this change 🚀
I'm experimenting with running parts of the stack in different environments (ex: WebAssembly components) where filesystem access via the node.js APIs is either not possible or undesirable.
If this isn't in line with Pelias' goals, that's probably fine and I'll just maintain a fork, but it seems like a reasonable change that'd be useful to others, so here's a PR with the changes :)
Here's what actually got changed 👏
fs
andpath
imports..txt
for now to get the key. I can clean up / change this. It's just in a pragmatically working with minimal changes sort of state for now.Here's how others can test the changes 👀
NOTE: I have not tested for any other second order effects like memory usage due to node
require
caching. (And I'm not 100% sure what I'd look for here to be honest; open to any feedback as you guys are much more into the node ecosystem than I.)