Load config as a JS file only. Allow dynamic logic/options
- Dominant language
- JavaScript
- Stars
- 11
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Fully switch over to using the config as a loaded js module. Add some dynamic option support, the two main features are listed below.
## `cache.hashFunction(request, defaultHashFunction) -> Promise`
Let the user define a custom hash function. Very useful for certain type of requests. The resulting `hash` is used throughout for identifying the cached record (like filenames, ids). A user could for example always return the same hash value if desired for certain type of requests which maintain dynamic parameters but don't influence the response. A custom `hash` value can also make artifacts easily identifiable.
The hash function will always be preferred over `defaultHashFunction`.
## `stub: (request) -> Promise`
Let the user define custom stubs via a function. The glob matching might be too difficult.
Contributor guide
Research direction
Start by tracing the current config loading, cache hashing, and glob-based stubbing; the issue names cache.hashFunction and stub as the required entry points. Done means the config is loaded as a JavaScript module, custom hash functions take precedence, and users can provide function-based stubs returning responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100