ymcatwincities / openy

The Open Y platform. See README.md below
https://openy.org
GNU General Public License v3.0
49 stars 112 forks source link

Avoid using custom packages with drupal-library type #1512

Open ddrozdik opened 5 years ago

ddrozdik commented 5 years ago

During work on upgrading contributed libraries in the Open Y, we have faced an issue that we have to support changes in two repositories in the https://github.com/ymcatwincities/openy/blob/8.x-2.x/composer.json#L23 and in the https://github.com/ymcatwincities/openy-project/blob/8.2.x-development/composer.json#L28. Any library should be updated in both repositories always at the same time otherwise errors during Open Y installation will block installation.

First, we thought that we can resolve this by creating documentation on how to upgrade libraries and as a results created this issue - https://github.com/ymcatwincities/openy/issues/1447 But then we discovered that we can remove libraries from the https://github.com/ymcatwincities/openy-project and support them only in the https://github.com/ymcatwincities/openy repository.

The trick is related to using https://asset-packagist.org and add all libraries via packagist. We have made the first iteration https://github.com/ymcatwincities/openy-project/pull/50 and removed slick, blazy, jquery.easing, and dropzone. PR in the Open Y repository https://github.com/ymcatwincities/openy/pull/1510.

The next step:

But we still have libraries which are not replaced because we didn’t find them on packagist or asset-packagist:

We need to discuss what we can do with remaining libraries. All of them except panelbutton and colorbutton have MIT or GNU license, so maybe we can just upload them to packagist as a fork with drupal-library type and support in the future.

This question is open. Meanwhile, we have made good progress in simplifying the process of supporting Open Y.

P.S. Big thank you to @afi13 for the great idea.

YMCA-GTC commented 5 years ago

@Sanchiz @ddrozdik Hey guys - good topic to bring up! Ping me on slack please so we can get a quick call scheduled between you 2 and @podarok to have this discussion.

ddrozdik commented 5 years ago

UPD: As the next step to continue work on this we need to discuss the following topics:

Our initial estimate on this is about 20 hrs. We will need to organize a call with other developers to brainstorm the best approach.

cc @YMCA-GTC, @podarok, @Sanchiz

paige-kiecker commented 5 years ago

@ddrozdik do you have any further updates on this?

ddrozdik commented 5 years ago

@paige-kiecker no updates so far. This is not a small task and it requires a significant (about 20 hrs) amount of time to finish it. I guess we can continue work on it as a part of the upcoming refactoring phase.

sarah-halby commented 4 years ago

@ddrozdik we'd like you to investigate if these libraries have versions in composer and could be replaced by official maintainer versions (instead of the custom build). jquery_colorpicker has changed to colorapi and will be removed in Q2 2021. I will connect with Julia on this item for technical debt work in late 2020.

dchubar-fj commented 3 years ago

Jstree library is a requirement for the media_directories_ui module and is installed with a custom repository. We can replace custom repo in 2 ways:

  1. Use asset packagist and composer package bower-asset/jstree https://asset-packagist.org/package/bower-asset/jstree
  2. The library is available in CDNJS and a small patch can connect the library to the module without downloading any files. The way seems to be less problematic because we’ve faced issues with assets packagist already. We’ve created an issue for that: https://www.drupal.org/project/media_directories/issues/3179504

GRT Youtube Popup library is the requirement for the advanced_help_block module, not a popular project. It has only 3 stars on Github. And looks like the library is not supported anymore. I don’t familiar with the module and how the library is used there. I see 2 solutions here:

  1. The library is distributed under the GNU license(free to use and distribute), so we can try to publish the package to NPM under our own account.
  2. Maybe we can think about another solution or library here? For example, Colorbox does the same thing. Yes, it's not so lightweight, but this is a popular and actively maintained library that can be installed via asset packagist or connected via CDN.

The same situation with btbutton library. This is the requirement for the ckeditor_bootstrap_buttons contrib module. The library is not very popular and is not available by asset packagist. The library is distributed under the GNU license(free to use and distribute), so we can try to publish the package to NPM under our own account.

jquery_colorpicker is available on packagist, so maybe we can just define the correct installer path for the package and use the default packagist repo instead of the custom repo.

alphanum is used by the openy_repeat module. Currently installed from the custom fork of the http://www.davekoelle.com/alphanum.html. Possible solutions:

  1. The library is distributed under the MIT license(free to use and distribute), so I guess we can just publish the package to NPM.
  2. The second solution is just to use the library by a direct link in Open Y: http://www.davekoelle.com/files/alphanum.js (we can't guarantee it won't be removed in the future) or https://github.com/AndreyMaximov/alphanum/blob/master/alphanum.js

panelbutton, colorbutton, and font libraries are CKEditor official add-ons. Possible solutions:

  1. CKEditor can be installed with Package managers https://ckeditor.com/docs/ckeditor4/latest/guide/dev_package_managers.html with all official plugins. After installation plugins available here libraries/ckeditor4/plugins. The solution is not perfect because requires patching of contrib modules in order to use new libraries paths. Also, it downloads all plugins, but not only that we use.
  2. We can add needed plugins to the Open Y repository to the libraries directory (like Drupal is core is added ckeditor). The library.libraries_directory_file_finder service checks the libraries directory in installed profiles automatically. And this service is used in the latest version of panelbutton and colorbutton modules.

@podarok what do you think about the proposed solutions?

sarah-halby commented 3 years ago

@podarok please add to your list review for after the Feb 2021 release.

shelleygoetz commented 2 years ago

@sarah-halby Jira ticket created - https://openy.atlassian.net/browse/MAINTAIN-194