readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
550 stars 186 forks source link

Strategy for Enabling/Disabling Plugins #658

Closed rkwright closed 6 years ago

rkwright commented 6 years ago

This issue is a Discussion

For quite a while Readium has supported a plugin framework centered on JavaScript. Although present, it has not been first-class citizen. One plugin, the Highlighter, was written early on, but there is no associated "bookmarking or annotation" plugin using it. There is some usage (we think) of the highlight plugin and the framework out in the wild, but we have little solid evidence of how or how much it used.
Meanwhile, EvidentPoint worked with hypothes.is to enable their bookmarking/annotation support within the CloudReader. It is based on a wholly different framework for highlighting, which is not compatible with the existing framework. So the question has arisen, how should Readium support Hypothes.is and/or the existing Highlighter plugin (which is disabled by default)?

At present, in the develop branch, in preparation for release 0.28 (which is intended to support Hypothes.is) the Hypothes.is plugin is enabled by default and the Readium Highlighter is disabled. At first, this seemed OK, we provide instructions on how to disable the Hypothes.is plugin so anyone deploying the CloudReader who has their own highlighter and/or doesn't want the Hypothes.is support can do so. Unfortunately, it is a little more complex than that. As it stands the Hypothes.is support, as part of readium-shared-js, will be built and integrated into not only the CloudReader but also the Chrome app and the native SDK apps (the Launchers). It won’t work in the Chrome app or the Launchers but the code is there and even the UI.

This is clearly unacceptable, but how should it work? After some discussion, it seems that the requirements should be:

The intent of this issue (discussion) is to elucidate how the above requirements can be met for the 0.28 release.

Related issue(s) and/or pull request(s)

657

Test file(s)

None

Product

All

Additional information

None?

danielweck commented 6 years ago

As per last week's conference call: 1) disable all plugins (or to be precise: "do not enable" any plugin) via the plugins/plugin.cson configuration file in readium-shared-js ( https://github.com/readium/readium-shared-js/blob/develop/plugins/plugins.cson ), so that the build-output folder (which is used as-is by the ReadiumSDK launcher apps) is as "vanilla" as possible ( https://github.com/readium/readium-shared-js/tree/develop/build-output ). 2) Enable the Hypothesis plugin (or any other desired plugin) in the develop branch via TravisCI during the Continuous Integration build that is automatically triggered at each code push. As a result, the automated cloud reader deployment at Firebase and Surge continues to provide the Hypothesis annotations tool ( http://readium.firebaseapp.com and https://readium.surge.sh ), as well as the cloud-reader[-lite].zip archives (ready-made prerelease builds) which are conveniently offered to downloaders who do not want / cannot compile the app themselves ( https://github.com/readium/readium-js-viewer/releases/tag/0.28.0-alpha ). 3) The manual builds created from the master branch (tagged releases) are not affected, they do not contain any plugins ( https://github.com/readium/readium-js-viewer/releases/latest ), and the "stable" cloud reader app deployed at Surge does not offer the Hypothesis plugin ( https://readium-master.surge.sh ).

We are currently testing this strategy live: https://travis-ci.org/readium/readium-js-viewer/builds/294962188 (waiting for the build to finish...)

danielweck commented 6 years ago

The TravisCI ad-hoc script to enable the Hypothesis plugin is super simple: https://github.com/readium/readium-js-viewer/commit/3ec7b42ec24713eb69ec3fed693b4a7dffc67b57#diff-354f30a63fb0907d4ad57269548329e3

danielweck commented 6 years ago

The Hypothesis plugin was deactivated in this commit: https://github.com/readium/readium-shared-js/commit/b73ba7a4912de68a9953f11e17b45e1c857b6c2c#diff-e8c5eaf889e895e2bc68aef5eb21a4ac

danielweck commented 6 years ago

This is working correctly. The Hypothesis plugin is enabled "dynamically" during the TravisCI build, as shown in the compiler logs: https://travis-ci.org/readium/readium-js-viewer/jobs/294962191#L786 https://travis-ci.org/readium/readium-js-viewer/jobs/294962191#L1450

...and the Hypothesis plugin is activated at runtime in the cloud reader app, as expected: https://readium.firebaseapp.com/?epub=epub_content%2Faccessible_epub_3&goto=%7B%22idref%22%3A%22id-id2611884%22%2C%22elementCfi%22%3A%22%2F4%2F2%5Bintroduction%5D%2F2%2F1%3A0%22%7D https://readium.surge.sh/?epub=https%3A%2F%2Freadium.firebaseapp.com%2Fepub_content%2Faccessible_epub_3&goto=%7B%22idref%22%3A%22id-id2611884%22%2C%22elementCfi%22%3A%22%2F4%2F2%5Bintroduction%5D%2F2%2F1%3A0%22%7D