milesj / emojibase

🎮 A collection of lightweight, up-to-date, pre-generated, specification compliant, localized emoji JSON datasets, regex patterns, and more.
https://emojibase.dev
MIT License
465 stars 38 forks source link

new: Make CDN url configurable. #140

Closed npeterkamps closed 2 years ago

npeterkamps commented 2 years ago

Implementation for my feature request: #139

cdnUrl is a new property of the options object and can be a string or a function (path: string, version: string): string.

When cdnUrl is a string, it's appended with /${path}. Since the default URL uses emojibase-data@latest for version, I didn't feel comfortable making assumptions about the placement of the version string. So I opted for not inserting the version anywhere, instead relying on the version already being inside the configured cdnUrl.

When cdnUrl is a function, it receives both path and version, although I suspect the version parameter will generally be unused - might as well hard-code it within the function body, right?

Updated the docs to reflect the above and added tests to reflect these new capabilities.

milesj commented 2 years ago

@npeterkamps Looks good, just need to fix formatting. Running yarn format should probably do it.

npeterkamps commented 2 years ago

Ran yarn format and committed only the changes related to code that I touched.

npeterkamps commented 2 years ago

@milesj Do you have some time to give this another look and approve running the workflows?

milesj commented 2 years ago

@npeterkamps Thanks! Will publish shortly.