Problem/Motivation
With an increasing usage of Drupal 8/9 composer installation, configuration, and updates, composer support for CKEditor 4 plugins have been mediocre at best. With the deprecation of #2912387: Stop using wikimedia/composer-merge-plugin, we need a composer installation solution that eases the library burden for new installations.
CKEditor 4.x is epected to be replaced by CKEditor 5.x in Drupal 10: #2966864: Add optional support for CKEditor 5 in D9 so we can remove CKE 4 from Drupal 10
Proposed resolution
Based on the work in #3104018: Support library auto install via composer in asset dir, we would like to request the Drupl CKEditor contrib module community collaborate and centralize composer repos under an auto-install method, rather than requiring additional root directory composer.json configurations or modules such as drupal_libraries.
We have begun a drupal-ckeditor-libraries-group packagist repo to house these packages, and would like to have other CKEditor module contrib join this collection and make composer installs as easy as possible.
Big kudos to @voleger for the original request and partnerships to get the initial work done on this.
Remaining tasks
1. Confirm whether this would be appropriate for composer installs of this module.
2. Create a module owned Github repo to house a local copy of the required ckeditor plugin.
3. Create a packagist account.
4. Contact either @voleger and @Webbeh on adding a GitHub repo to the packagist account, and setting your local Github and packagist account to the repo.
5. After the repo is in place, create a patch (a la 3104018-31.patch) to update composer.json to point to the new repo.
6. Success!
User interface changes
TBD.
Issue fork ckeditor_youtube-3219372
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
WebbehWe're kickstarting this process with #3219009: 'youtube' plugin support.
Comment #3
WebbehAnd this plugin now shows on Packagist: https://packagist.org/packages/drupal-ckeditor-libraries-group/youtube
This needs a patch for an updated composer.json. I can do that.
Comment #5
WebbehComment #6
gnugetDoes this mean that now we will need to keep updated our own version of the CKEditor plugin and whenever a new release is done I will need update my fork?
I was thinking in doing something similar to what Webform is doing for this: https://git.drupalcode.org/project/webform/-/blob/6.x/composer.libraries...
I wonder if I can support both methods or if one has more advantages than the other.
Comment #7
WebbehNope and nope (unless you want to specify an explicit tag or release in the module composer.json to maximize control). We should probably rewrite that for module owners, because a lot of that is our duty from the library maintainers.
Our actions_runner ( https://github.com/drupal-ckeditor-libraries-group/actions_runner/blob/m... ) rewrites the git history and injects a composer.json that is compatible with Drupal (see `type`: https://github.com/drupal-ckeditor-libraries-group/youtube/blob/master/c... ). The runner runs on a pre-established cron so it should periodically grab and rewrite the commit/tags for the original source youtube plugin ( https://github.com/fonini/ckeditor-youtube-plugin ) to inject the Drupal goodness into our clone ( https://github.com/drupal-ckeditor-libraries-group/youtube ).
Packagist is then ingesting `drupal-ckeditor-libraries-group/youtube` and delivering it for Drupal modules.
The problem we saw with the Webform approach was the same as similar approaches of defining libraries in the root `composer.json`, which was that version bumps required non-automated code updates to point to the new release, including locating the URL of the new zip. This should automate that process and manage it more effectively within composer, as we're cloning directly from the git repo.
If you're curious about the technical process on how we deploy the cloned repo, see https://github.com/drupal-ckeditor-libraries-group/actions_runner/issues/16 .
Comment #8
mkolar commentedHi! looks like I can just require drupal-ckeditor-libraries-group/youtube and keep using drupal/ckeditor_youtube (without usage of forked module) + i had to configure youtube folder since its libraries/youtube/youtube.. in order to make library being downloaded via composer.
if you tell me how to review it properly i can do that and we can mark as reviewed. of this is enough?
Comment #9
chrisck@Webbeh thank you for taking the initiative for putting ckeditor youtube plugin in the drupal-ckeditor-libraries-group on packagist. I've tried deploying your MR #4 in a patch form to test and composer is not downloading the drupal-ckeditor-libraries-group/youtube package. Am I missing something? What other steps need to happen to move this forward?
@mkolar your method of requiring drupal-ckeditor-libraries-group/youtube may work, but then you lose the dependency and automatic download and removal of the plugin from ckeditor_youtube module.
Comment #10
WebbehI believe this is because composer isn't directly interfacing with the package; e.g. it's not reading `composer.json` after the patch is applied? This would be automatically applied with a new release once this MR is confirmed.
Comment #11
chrisck@gnuget Can we get MR #4 in to get YouTube plugin downloaded via composer?
Comment #12
cobenashHope this MR could be merged. +1
Thanks.
Comment #13
dinarcon commentedLooks good. Can we update the README file to clarify that you can install manually or via Composer? If I recall correctly, when installed via Composer the CKEditor plugin ends up in a different location. The
Reference folder structuresection can be updated to match what Composer does.It looks like we should also update the value
library_pathinconfig/install/ckeditor_youtube.settings.ymland the default path reference inDrupal\ckeditor_youtube\Form\YouTubePluginForm::buildForm.Can we test what happens when a site that used the manual installation method, installs/updates the module via Composer with the new dependency on
drupal-ckeditor-libraries-group/youtube?Comment #14
chrisck@dinarcon The MR submitted addresses your comments in #13:
config/install/ckeditor_youtube.settings.ymlDrupal\ckeditor_youtube\Form\YouTubePluginForm::buildForm/libraries/youtube/youtubeI've completed a manual test where sites that have installed the Youtube plugin manually at
libraries/youtubeand then update ckeditor_youtube with the patch containing thedrupal-ckeditor-libraries-group/youtubedependency, the plugin gets auto-installed atlibraries/youtube/youtubeand thelibrary_pathis subsequently updated to the new path after the update hook.Can you please review the changes?
Comment #16
dinarcon commentedThanks @chrisck for addressing my comments. I have manually tested the changes. I pushed a commit to account for the (unlikely) event that the module is updated, but it was never installed via Composer.
Thanks everyone for pushing for this improvement.
Comment #17
dinarcon commentedMarking as fixed. This was included in https://www.drupal.org/project/ckeditor_youtube/releases/8.x-1.5