Current situation
Wikipedia Preview is currently distributed as an npm package (and consequently hosted on unpkg.com). We encourage partners to download it using npm install to self host with their own website.
Issues
While downloading and serving the script is a relatively simple task, it adds friction for the partners wanting to try it out without being fully committed yet. It also introduces the concept of upgrade as a regular activity for partners and since they will do it at their own discretion, we will likely have several different versions in use at any given time.
Solution
Host Wikipedia Preview (script, images) from a central location and encourage all partners to load it from there. This would allow us to keep it up to date and control the versions being used.
Option 1: Host on WMF infrastructure
Example URL: https://www.wikipedia.org/static/wikipedia-preview/wikipedia-preview.js
Pros:
- Fast & reliable infrastructure
- High level of privacy for readers of partners' websites
Cons:
- Aggressive caching in the static directory may not work well for a script we update frequently
- Deployment through a config patch in a swat window is a bit more work than we would like
Notes:
- There's probably other places better suited for this than the static directory so the cons above may not hold.
Option 2: Host on Github Pages
Example URL: https://wikimedia.github.io/wikipedia-preview/wikipedia-preview.js
Pros:
- Fast and easy automated deployment from CI. Can be for every changes on main, based on version changes, based on tags being added, etc
- Self-contained in the repo. Keeping things closer together means easier onboarding and maintenance.
- Probably fast & reliable but outside of our control
Cons:
- Probably fast & reliable but outside of our control
- May not be up to our privacy standards for readers