Allow "subrecipes" in the same git repo

Created on 2 July 2024, 2 months ago
Updated 21 August 2024, 18 days ago

Problem/Motivation

The intent for Starshot is to allow Drupal to compete in a very competitive CMS space. Some competing solutions, such as WordPress, offer plugins that provide very robust solutions. For example, to manage events, popular WP plugins provide a substantial set of features (including things like registration) and then offer a paid version, which offers additional features (such as paid registration, reminder notifications, and more). Drupal could, in theory, provide all of this in a recipe, but the challenge is that not every site will need every feature.

Proposed resolution

Allow recipes to include "subrecipes". For a developer experience (and to reduce noise for searching projects on drupal.org and in the Project Browser) these would be better if included in the same git repo.

It would be even better if the recipe creator could indicate which subrecipes are "suggested" (would be enabled to be applied by default) vs. "available" (site builders could enable them if need, and optionally install them later through Project Browser).

✨ Feature request
Status

Active

Version

11.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada mandclu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mandclu
  • πŸ‡ΊπŸ‡ΈUnited States drumm NY, US

    Part of a recipe is composer.json for dependencies and other metadata.

    Composer keeps it simple and supports only one composer.json per-project, at the root level of the repository.

    Drupal’s support for sub-modules & sub-themes, each with their own dependencies, was one of the main reasons we created packages.drupal.org as a shim for supporting Drupalisms in Composer. We do not plan on doing anything special for recipes. Their metadata is distributed directly via Packagist.org as regular PHP projects, no special Drupal handling.

  • πŸ‡¨πŸ‡¦Canada mandclu

    It's worth pointing out that there was a long discussion thread related to this in Drupal slack:
    https://drupal.slack.com/archives/C072BF486FN/p1719955373571009?thread_t...

  • πŸ‡¨πŸ‡¦Canada mandclu

    On the topic of "sub-things" being a Drupalism and therefore something we want to avoid repeating again, could git submodules be an approach that might be a better path forward here?

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I would be very in favor of some sort of Git trickery here (subtree split?) to facilitate developing recipe suites in a monorepo setup. That's what I'm hoping Starshot will do, and I think it would be useful in other situations too.

    Having recipes embedded in other recipes - similar to how modules can contain other modules - would be a hard no from me, as it contradicts the design of the recipe system and breaks the ability to disambiguate them. Let's not add more Drupalisms! :) But it sounds like we're on the same page about that, so I'm just repeating it here for the record.

    I'd love to see an example of a recipe suite developed with a subtree split to Packagist. If that's the path Starshot follows (and I'm advocating for that), then I think that could serve as a good example and blaze a trail for other recipe authors.

  • πŸ‡¨πŸ‡¦Canada mandclu

    I'm concerned that the discussion so far in this thread has largely been about the developer experience, which wasn't the main concern when I created this issue. I agree with the sentiment in #5 that if some git trickery could allow for a monorepo, as a recipe author myself I would consider that optimal.

    That said regardless of whether or not we can or should provide an optimized recipe author experience, I would argue that we will have lost the mission for Starshot itself if site builders have to search and scout to find a collection of recipes that will match the functionality they could get from installing a single, popular plugin on a competing platform.

  • πŸ‡¬πŸ‡§United Kingdom catch

    I would argue that we will have lost the mission for Starshot itself if site builders have to search and scour to find a collection of recipes that will match the functionality they could get from installing a single, popular plugin on a competing platform.

    I'm not sure this is necessarily the case, although bear in mind I haven't actually used the recipes API yet, just reviewed various of it.

    There seems like at least two possible ways to handle this:

    1. Subtree split as mentioned above.

    Let's say that recipe A provides the 'event' content type, and recipe B provides zoom API integration to add a meeting ID to events, then attach meeting recordings to a media video field on event content automatically when zoom makes them available.

    Recipe B requires API key configuration etc. and is completely pointless for someone using the event content type for their local music scene so you'd never want it installed unless you're explicitly creating zoom meetings all the time.

    If recipe A has a composer dependency on recipe B but otherwise no reference to it, then composer would install recipe B into the codebase, but that would just mean it's available on the filesystem. When you apply the event recipe A, nothing would happen, but project browser would identify recipe B and present it as available for installation - I think this is what's being suggested.

    The main drawback I can see here is that if recipe A depends on recipe B, and recipe B depends on zoom_api module, then when a major version comes around, the modules that recipes B, C, D, E, F, G, H, I, J, and K depend on could mean a whole chain of dependencies in order to get recipe A ready for that major release.

    2. A suggestions API based on applied recipes.

    Let's say a site has just applied recipe A, project browser could then, via the d.o API, provide a list of recipes that depend on recipe A. This would mean not just the original recipe project, but any recipe on d..o could potentially be suggested based on its dependencies.

    I have an (as yet mostly still in my head) idea about allowing projects on d.o to be subtree-split into different composer packages, with the eventual idea of deprecating submodule support in the extension system itself (to simplify extension discovery, autoloading etc.). e.g. a project with views/views.info and views_ui/views_ui.info could become two composer packages allowing the modules to be hosted separately and for us to discover modules in the vendor/ directory and autoload them from there. So if we added monorepo + subtree split support to d.o gitlab, that might be useful not only for recipes.

  • πŸ‡¨πŸ‡¦Canada mandclu

    As part of the slack discussion linked above @thejimbirch mentioned composer suggest as an existing technical element that is relevant, but in practice not really used by anyone. In theory, a solution like the Project Browser could have support for composer suggest, and interactively present them as options to download and apply after the main recipe is applied. This could be path for making it easier to find and apply available extras for a recipe, but on its own it wouldn't allow for any distinction between "recommended" and "available" elements.

    I haven't personally worked with git subtree splits, so I'm having trouble imagining how this would impact the process of managing all the recipes, particularly in what I believe is the intended future, where drupal.org projects are replaced by git.drupalcode.org projects. I would be concerned about any approach that adds more complexity to project maintainership.

    Re: the scenarios presented in #7:

    I agree with the point made in scenario 1, about the perils of composer requiring recipes and their associated modules if they weren't actually being used. Since composer has no concept of which modules are actually in use, this sounds like it will create unnecessary complications.

    In scenario 2, the suggestions API sounds to me like the ecosystem association currently built into drupal.org. I'm not sure if this is planned to carry over to Gitlab at some point, but if it is, maybe that could be the underpinning for having additional recommendations?

  • πŸ‡ΊπŸ‡ΈUnited States drumm NY, US

    That said regardless of whether or not we can or should provide an optimized recipe author experience, I would argue that we will have lost the mission for Starshot itself if site builders have to search and scour to find a collection of recipes that will match the functionality they could get from installing a single, popular plugin on a competing platform.

    We could also say adding many recipes to one repo is jumping to a developer-focussed solution ahead of figuring out the user experience. Being able to find recipes designed to work together is something to consider in #3447063: [Meta] Plan for recipe findability on Drupal.org and Project Browser β†’ .

    Where the repositories are should be irrelevant to end-users. A monorepo would be a developer convenience for tightly-coupled recipes. Subtree splitting each recipe from the monorepo to each individual project makes the recipes functionally the exact same as each recipe in one repository.

    In scenario 2, the suggestions API sounds to me like the ecosystem association currently built into drupal.org. I'm not sure if this is planned to carry over to Gitlab at some point, but if it is, maybe that could be the underpinning for having additional recommendations?

    Projects remain on Drupal.org indefinitely, they are not moving to GitLab. This means we always have a place for metadata, categorization, user-focussed descriptions, etc for project browsing. This parallels other systems for browsing extensions - app stores, Wordpress plugins, browser extensions, and other equivalents to project browsing all have additional metadata and centralization, and don’t rely on just Git repositories.

  • πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

    we will have lost the mission for Starshot itself if site builders have to search and scour to find a collection of recipes that will match the functionality they could get from installing a single, popular plugin on a competing platform.

    +1

    adding many recipes to one repo is jumping to a developer-focussed solution ahead of figuring out the user experience

    +1

    Being able to find recipes designed to work together is something to consider in #3447063: [Meta] Plan for recipe findability on Drupal.org and Project Browser β†’

    There's a very important distinction between child->parent and parent->child we shouldn't lose track of here.

    Recipes need to be able to specify parent recipes they depend on, obviously enough.

    But I think the essence of the proposal here is that a parent recipe should be able to define a curated set of child recipes, of both available and suggested types.

    Doing so has a significant sitebuilder impact that goes beyond discoverability: it encourages recipes to be lightweight and modular.

Production build 0.71.5 2024