-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DX] Standardize on a place for shared libraries to be used by multiple modules. #159
Comments
I agree we need some kind of library management. Libraries API is a bit bloated (all I ever use is the library_get_path() and maybe the version checking), but I think it's important that we standardize on a place for shared libraries that are used by multiple modules. Even core would benefit from having a better place than |
Yes, I don't care about the module itself or the implementation. All I'm interested in is a single place to put 3rd party libraries and the ability to upgrade/downgrade them at will without having to wait for a new core version to be released and include them (eliminate the need for modules like jQuery Update for example). |
...auto-discovery and enabling/disabling them or even switching between multiple available versions in a "Libraries" admin page (like the modules page) would be perfect. |
Is this for core libraries, contrib libraries, or both? @klonos' comment about eliminating the need for jQuery Update seems to suggest being able to replace/upgrade jQuery in core, presumably without 'hacking' core... |
I guess we can have We can start by giving the I know that we can go without having a |
Ooh, I like it! |
I really like where this discussion is going, but since we need to get 1.0.0 out soon, how about we split this issue into two?
|
Noted that this says need change notice. Was that an error? I don't see the API change. |
Yeah looks like a mistake. We haven't even implemented anything yet, so I don't see how it could need a change notice. I removed the tag. |
whoops, sorry about that :) |
I don't think we'll implement this in the next week (and I'm not sure we should even if we could). However, there's nothing keeping this from being in a minor release. So moving to the 1.x-future milestone until we get a timeline for this. |
I think the first three remaining tasks (see main issue) we could definitely do before the 1.0.0 release if someone wanted to do it. It's a minor task to move the files and add some documentation. The 4th part we should postpone, and could be moved to a separate issue if 1 - 3 get done here. If not, 1.x-future it is :) |
I'm going to hold off on the Libraries API port (https://www.drupal.org/node/2417985) until this issue gets sorted out, as that may save me a bit of work. :) I have other things to keep me busy in the mean time. |
@oadaeh We'd love to see a port of Libraries API for Backdrop. As far as what's left of this issue, it's just a little core cleanup and some documentation, so nothing that should block the port of that module, at least not for the 1.x cycle of Backdrop. |
Yes please! I can't remember any of my D7 sites not using it. |
Another thing is to move jQuery & jQuery UI (and other 3rd party libraries perhaps?) under |
welcome back @klonos, the place has been way too quiet recently. |
Thanx @docwilmot, I've been working crazy hours and still have another 3 weeks to go. So, I won't be around much. Especially during weekdays. Just managed to find some spare time throughout the weekend. So much to catch up and unfortunately us humans need sleep 😄 |
Its been a while and after @jenlampton's post about contrib libraries recently, I finally recalled this conversation here. @quicksketch @jenlampton a few queries please:
I note also the conversation at #1123, which may influence this one. Would be nice to get this PR'd already. It been a while. |
I don't think the hook would be invoked prior to creating the entry in the system table, because modules may actually use
Maybe the |
Modules and themes and layouts have a standard naming structure: we search for that, find them, put them in the database. For libraries we need a way to search through the expected places, build a list of libraries there and put them in the database so that
By "if found" you mean declared in the library_info file? I have 5 libraries on my install right now, all of which are a bit different, and none have |
I don't know whether this is at all relevant but the Libraries API module ported from Drupal (backdrop-contrib/libraries) contains a great deal of code to deal with different library locations, variants and versions, and I confess I understand very little of this. In Drupal it provided for multisite situations by using conf_path() but I found this to be a problem in Backdrop because with function find_conf_path we have " If not using multisite, the path returned will be a single period (indicating the current directory)." It also provides for looking for libraries in a profiles directory - will we have this in Backdrop? The results of Libraries API search for libraries would seem to be stored in a datatable 'cache_libraries'. |
Hi guys! I would love to push it up. @Graham-72 I se that one year ago you ported libraries module but there is still some undecided situation where we are going with it, right? I had a question why we don't use composer for libraries dependencies and etc. Since we have project installer that install module from admin part, we do need to make sure that all libraries for project get installed as well. Anyway, could anybody give me some status links to understand if I could be helpful here. |
Hi Gor,
so we used the libraries D7 port from Graham with the manual dependency On Tue, Jun 21, 2016 at 9:03 AM, Gor Martsen [email protected]
|
@biolithic thanks! @laryn noticed issue with https://backdropcms.org/project/libraries It is access denied page. |
@Gor @laryn I believe that node was unpublished since there was a time when we didn't want laypeople using the libraries module for Backdrop. I just re-read this issue and it looks like that is not the case anymore (at least temporarily, until we get this functionality into core, woot!) so I have re-published it. I also copied the current non-API-breaking plan from @quicksketch's comment into the main issue so everyone can see the tasks ahead of us. |
Tnx @jenlampton |
@jenlampton I notice
I ask because I would think that the last point you made
would be a prerequisite for doing the |
Well technically we can, but I don't think we should. Those old todos were fairly vague and not all that helpful, so replaced them with the more detailed non-API-breaking plan from @quicksketch's comment. |
@quicksketch I was thinking about implementing type=library . It does make sence due libraries are separated entities and modules can be depend on it. From another side, it is going to be bottle neck. we don't have human power to implement so much new extensions like type library and keep them up to date. There is a lazy path I think. Composer is very popular right now and many libraries get supported by it. Also it handle versions as well. So how about to have one module, that will respond on hook_requirements check and if module require library NAME, version VERSION - it will check composer and if it is available - download and register as library. |
@Gormartsen see @quicksketch's note about |
Should is what I meant yes.
That sounds like it would be magic. Would simplify things for the nontechnical persons significantly, and also make Installer more useful in those cases. |
Magic yes, because this step requires that wherever it is that people are working would be able to use composer in the first place. If not, that would be a HUGE increase in complexity for nontechnical persons... Not something we want to burden our target user with, I don't think. But a developer tool for building new modules? sure! Maybe even work it into devel? Anyway, we're getting a bit off-topic and into contrib-land here :) |
I propose we go with
/core/libraries/
for core libraries and/libraries/
for contrib.We should also adapt
backdrop_get_path()
to work for libraries as well as modules, themes, and layouts. This is the most useful part of the Libraries API project, and it would be good to get that into core. Here are the usage stats (more than half a mil!!!) on that module.Proposed solution:
backdrop_get_path()
. So you could usebackdrop_get_path('library', 'fontawesome')
to locate a directory calledfontawesome
in any of the following locations.core/libraries
libraries
sites/[site_name]/libraries
backdrop_get_path()
for libraries would follow the same selection rules as for modules/themes/layouts. They could be overridden by using more-specific directories (/libraries
overrides/core/libraries
, etc.)backdrop_get_path()
to locate a library. In any case, they would still need to implement the currenthook_library_info()
hook. But this hook may (or may not) use the generic library path, the bundled, path, or conditionally the generic path if it exists or the bundled path otherwise.hook_library_info()
to match Libraries API's ability to determine version numbers and verify that library paths are correct.library_read_composer_version()
,library_read_bower_version()
, andlibrary_read_package_version()
. These could be reused by contrib for handling libraries that support Composer, Bower, NPM, or whatever package manager comes out next month.system
table to save processing. We'd need to add a new function similar tosystem_rebuild_module_data()
that rebuilt library data on cache clears.This change will need a change record created on api.backdropcms.org
The text was updated successfully, but these errors were encountered: