A recipe should be able to suggest another recipe. One way would be to use composer suggest. Here is an example:

{
    "name": "drupal_recipe/article_content_type ",
    "description": "A recipe for an article content type",
    "type": "drupal-recipe",
    "require": {
      "drupal/core": "^10"
    },
    "suggest": {
      "drupal-recipe/article_comment": "Provides commenting on article content.",
      "drupal-recipe/article_tags": "Provides tags on article content."
    },
    "license": "GPL-2.0-or-later"
  }

@alexpott stated in Slack that "we could have a Recipe::suggests() method that reads from the composer.json if available."

Composer suggest is the currently planned approach per recipe.md:

The suggest key can be used to suggest other recipes a user might want to
apply.

However, it looks like this won't cover the need here. See this Slack comment and subsequent discussion in that thread. The basic problem is there's not a one-to-one relationship between recipes and Composer packages. For example, per #3301370: Model core's standard install profile as recipes we're planning to put a bunch of recipes in the core repo at core/recipes. Composer packages cannot be in the subdirectory of a Git repo, so those recipes can't be packages and so won't have a composer.json file.

Instead, we should plan to add this functionality to the recipe.json file format.

Per #328932: Modules and partial dependencies - enhances[] and enhancedby[] field in modules' .info.yml files, similar functionality has long been suggested for Drupal extensions, which similarly don't have a one-to-one relationship with Composer packages. So this requirement may bring #328932 into scope for the Distributions and Recipes initiative.

Comments

thejimbirch created an issue. See original summary.

thejimbirch’s picture

Issue summary: View changes
nedjo’s picture

Composer suggest is the currently planned approach per recipe.md:

The suggest key can be used to suggest other recipes a user might want to
apply.

However, it looks like this won't cover the need here. See this Slack comment and subsequent discussion in that thread. The basic problem is there's not a one-to-one relationship between recipes and Composer packages. For example, per #3301370: Model core's standard install profile as recipes we're planning to put a bunch of recipes in the core repo at core/recipes. Composer packages cannot be in the subdirectory of a Git repo, so those recipes can't be packages and so won't have a composer.json file.

Instead, we should plan to add this functionality to the recipe.json file format.

Per #328932: Modules and partial dependencies - enhances[] and enhancedby[] field in modules' .info.yml files, similar functionality has long been suggested for Drupal extensions, which similarly don't have a one-to-one relationship with Composer packages. So this requirement may bring #328932 into scope for the Distributions and Recipes initiative.

thejimbirch’s picture

Status: Active » Closed (won't fix)

The recipe.json file never came to fruition, and the suggest functionality will most likely come from Project browser. Closing this as Won't fix. We can re-open or revisit if this does come up in the future.