diff --git a/composer.json b/composer.json index f4310c12c3..84879fbade 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,11 @@ "description": "Drupal is an open source content management platform powering millions of websites and applications.", "type": "project", "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/drupal", + "support": { + "docs": "https://www.drupal.org/docs/user_guide/en/index.html", + "chat": "https://www.drupal.org/node/314178" + }, "require": { "composer/installers": "^1.0.24", "drupal/core": "self.version", @@ -60,6 +65,7 @@ "themes/custom/{$name}": ["type:drupal-custom-theme"] }, "drupal-core-project-message": { + "include-keys": ["homepage", "support"], "post-install-cmd-message": [ "drupal/drupal: This package is meant for core development,", " and not intended to be used for production sites.", diff --git a/composer/Plugin/ProjectMessage/Config.php b/composer/Plugin/ProjectMessage/Config.php index 3e2bf50bbc..cdf7166636 100644 --- a/composer/Plugin/ProjectMessage/Config.php +++ b/composer/Plugin/ProjectMessage/Config.php @@ -47,9 +47,7 @@ public function getMessageText() { if ($this->messageText) { return $this->messageText; } - $package_config = $this->rootPackage->getExtra(); - $file = $this->eventName . '-message.txt'; if ($config_file = $package_config['drupal-core-project-message'][$this->eventName . '-file'] ?? FALSE) { $file = $config_file; @@ -64,6 +62,29 @@ public function getMessageText() { $this->messageText = $this->getMessageFromFile($file); } + // Include structured support info from composer.json. + // @todo Include more keys. + if ($config_keys = $package_config['drupal-core-project-message']['include-keys'] ?? FALSE) { + foreach ($config_keys as $config_key) { + switch ($config_key) { + case 'homepage': + if ($homepage = $this->rootPackage->getHomepage()) { + $this->messageText[] = ' * Homepage: ' . $homepage; + } + break; + + case 'support': + if ($support = $this->rootPackage->getSupport()) { + $this->messageText[] = ' * Support:'; + foreach ($support as $support_key => $support_value) { + $this->messageText[] = ' * ' . $support_key . ': ' . $support_value; + } + } + break; + } + } + } + return $this->messageText; } diff --git a/composer/Template/LegacyProject/composer.json b/composer/Template/LegacyProject/composer.json index 51aced4574..e8c69cb69e 100644 --- a/composer/Template/LegacyProject/composer.json +++ b/composer/Template/LegacyProject/composer.json @@ -3,6 +3,11 @@ "description": "Project template for Drupal 8 projects with composer following drupal/drupal layout", "type": "project", "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/drupal", + "support": { + "docs": "https://www.drupal.org/docs/user_guide/en/index.html", + "chat": "https://www.drupal.org/node/314178" + }, "repositories": [ { "type": "composer", @@ -11,8 +16,9 @@ ], "require": { "composer/installers": "^1.2", - "drupal/core-recommended": "^8.8", "drupal/core-composer-scaffold": "^8.8", + "drupal/core-project-message": "^8.8", + "drupal/core-recommended": "^8.8", "drupal/core-vendor-hardening": "^8.8" }, "require-dev": { @@ -41,6 +47,25 @@ "drush/Commands/contrib/{$name}": ["type:drupal-drush"], "modules/custom/{$name}": ["type:drupal-custom-module"], "themes/custom/{$name}": ["type:drupal-custom-theme"] + }, + "drupal-core-project-message": { + "include-keys": ["homepage", "support"], + "post-create-project-cmd-message": [ + " ", + " Congratulations, you’ve installed the Drupal codebase ", + " from the drupal/legacy-project template! ", + " ", + "", + "Next steps:", + + " * Install the site: https://www.drupal.org/docs/8/install", + " * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html", + " * Get support: https://www.drupal.org/support", + " * Get involved with the Drupal community:", + " https://www.drupal.org/getting-involved", + " * Remove the plugin that prints this message:", + " composer remove drupal/core-project-message" + ] } } } diff --git a/composer/Template/RecommendedProject/composer.json b/composer/Template/RecommendedProject/composer.json index 98189b3105..fe251787e2 100644 --- a/composer/Template/RecommendedProject/composer.json +++ b/composer/Template/RecommendedProject/composer.json @@ -3,6 +3,11 @@ "description": "Project template for Drupal 8 projects with a relocated document root", "type": "project", "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/drupal", + "support": { + "docs": "https://www.drupal.org/docs/user_guide/en/index.html", + "chat": "https://www.drupal.org/node/314178" + }, "repositories": [ { "type": "composer", @@ -11,8 +16,9 @@ ], "require": { "composer/installers": "^1.2", - "drupal/core-recommended": "^8.8", - "drupal/core-composer-scaffold": "^8.8" + "drupal/core-composer-scaffold": "^8.8", + "drupal/core-project-message": "^8.8", + "drupal/core-recommended": "^8.8" }, "require-dev": { "drupal/dev-dependencies": "^8.8" @@ -40,6 +46,25 @@ "drush/Commands/contrib/{$name}": ["type:drupal-drush"], "web/modules/custom/{$name}": ["type:drupal-custom-module"], "web/themes/custom/{$name}": ["type:drupal-custom-theme"] + }, + "drupal-core-project-message": { + "include-keys": ["homepage", "support"], + "post-create-project-cmd-message": [ + " ", + " Congratulations, you’ve installed the Drupal codebase ", + " from the drupal/recommended-project template! ", + " ", + "", + "Next steps:", + + " * Install the site: https://www.drupal.org/docs/8/install", + " * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html", + " * Get support: https://www.drupal.org/support", + " * Get involved with the Drupal community:", + " https://www.drupal.org/getting-involved", + " * Remove the plugin that prints this message:", + " composer remove drupal/core-project-message" + ] } } }