diff --git a/.gitignore b/.gitignore index 2b290fecb1..e02e81705b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,9 @@ web/sites/simpletest # Composer installs contrib recipes into 'recipes/', next to custom recipes, # so recipes stay an allow list: un-ignore custom recipes explicitly. recipes/* +#;< CONTENT_MODEL !recipes/page +#;> CONTENT_MODEL #;< AI_CODE_INSTRUCTIONS # Ignore all Claude files by default. Custom files should be added explicitly. diff --git a/.vortex/installer/CLAUDE.md b/.vortex/installer/CLAUDE.md index 06d6e0bebf..7a8a595b65 100644 --- a/.vortex/installer/CLAUDE.md +++ b/.vortex/installer/CLAUDE.md @@ -117,6 +117,7 @@ Content removed if feature not selected | Category | Tokens | |----------|------------------------------------------------------------------------------------| | Theme | `DRUPAL_THEME` | +| Content | `CONTENT_MODEL` - the starter 'page' content model, kept while the demo or the search custom module is selected | | Services | `SERVICE_ANTIVIRUS`, `SERVICE_SEARCH`, `SERVICE_CACHE` | | CI | `CI_PROVIDER_GHA`, `CI_PROVIDER_CIRCLECI` | | Hosting | `HOSTING_LAGOON`, `HOSTING_ACQUIA` | diff --git a/.vortex/installer/src/Prompts/Handlers/CustomModules.php b/.vortex/installer/src/Prompts/Handlers/CustomModules.php index ed6feec559..21229e4469 100644 --- a/.vortex/installer/src/Prompts/Handlers/CustomModules.php +++ b/.vortex/installer/src/Prompts/Handlers/CustomModules.php @@ -116,7 +116,6 @@ public function discover(): null|string|bool|array { public function process(): void { $selected = $this->getResponseAsArray(); $t = $this->tmpDir; - $w = $this->webroot; // Safety net: if search was selected but Solr service was not, force-remove // search module since it cannot function without Solr. @@ -130,16 +129,7 @@ public function process(): void { if (!in_array(self::BASE, $selected)) { File::removeTokenAsync('CUSTOM_MODULE_BASE'); - $locations = [ - $t . sprintf('/%s/modules/custom/*_base', $w), - $t . sprintf('/%s/sites/all/modules/custom/*_base', $w), - $t . sprintf('/%s/profiles/*/modules/*_base', $w), - $t . sprintf('/%s/profiles/*/modules/custom/*_base', $w), - $t . sprintf('/%s/profiles/custom/*/modules/*_base', $w), - $t . sprintf('/%s/profiles/custom/*/modules/custom/*_base', $w), - ]; - - $path = File::findMatchingPath($locations); + $path = File::findMatchingPath($this->moduleLocations('base')); if ($path) { File::remove($path); } @@ -148,16 +138,7 @@ public function process(): void { if (!in_array(self::DEMO, $selected)) { File::removeTokenAsync('CUSTOM_MODULE_DEMO'); - $locations = [ - $t . sprintf('/%s/modules/custom/*_demo', $w), - $t . sprintf('/%s/sites/all/modules/custom/*_demo', $w), - $t . sprintf('/%s/profiles/*/modules/*_demo', $w), - $t . sprintf('/%s/profiles/*/modules/custom/*_demo', $w), - $t . sprintf('/%s/profiles/custom/*/modules/*_demo', $w), - $t . sprintf('/%s/profiles/custom/*/modules/custom/*_demo', $w), - ]; - - $path = File::findMatchingPath($locations); + $path = File::findMatchingPath($this->moduleLocations('demo')); if ($path) { File::remove($path); } @@ -168,20 +149,50 @@ public function process(): void { if (!in_array(self::SEARCH, $selected)) { File::removeTokenAsync('CUSTOM_MODULE_SEARCH'); - $locations = [ - $t . sprintf('/%s/modules/custom/*_search', $w), - $t . sprintf('/%s/sites/all/modules/custom/*_search', $w), - $t . sprintf('/%s/profiles/*/modules/*_search', $w), - $t . sprintf('/%s/profiles/*/modules/custom/*_search', $w), - $t . sprintf('/%s/profiles/custom/*/modules/*_search', $w), - $t . sprintf('/%s/profiles/custom/*/modules/custom/*_search', $w), - ]; - - $path = File::findMatchingPath($locations); + $path = File::findMatchingPath($this->moduleLocations('search')); if ($path) { File::remove($path); } } + + // The 'page' content model is the bundle that both the demo content and the + // search example content are built on, so it only becomes dead weight once + // neither of those modules is selected. Runs after the base module removal + // above so the deploy step is already gone with its module when base was + // deselected. + if (!in_array(self::DEMO, $selected) && !in_array(self::SEARCH, $selected)) { + File::removeTokenAsync('CONTENT_MODEL'); + + File::remove($t . '/recipes/page'); + + $path = File::findMatchingPath($this->moduleLocations('base')); + if ($path) { + File::remove($path . '/src/Plugin/DeployStep/CreateContentModelDeployStep.php'); + } + } + } + + /** + * Get the locations a custom module with the given suffix can live in. + * + * @param string $suffix + * The module name suffix, without the leading underscore. + * + * @return array + * Array of glob patterns, ordered from the most to the least common. + */ + protected function moduleLocations(string $suffix): array { + $t = $this->tmpDir; + $w = $this->webroot; + + return [ + $t . sprintf('/%s/modules/custom/*_%s', $w, $suffix), + $t . sprintf('/%s/sites/all/modules/custom/*_%s', $w, $suffix), + $t . sprintf('/%s/profiles/*/modules/*_%s', $w, $suffix), + $t . sprintf('/%s/profiles/*/modules/custom/*_%s', $w, $suffix), + $t . sprintf('/%s/profiles/custom/*/modules/*_%s', $w, $suffix), + $t . sprintf('/%s/profiles/custom/*/modules/custom/*_%s', $w, $suffix), + ]; } /** diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/_baseline/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php index b057d4e988..05b6d283a8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php +++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php @@ -14,13 +14,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Creates the demo content model on non-production deploys. + * Creates the starter content model on non-production deploys. * * Applies the project 'page' recipe so the Basic page content type, its body - * field and displays exist before the demo modules that attach behaviour to - * that type are installed. Runs ahead of EnableDevelopmentModulesDeployStep in - * the PRE phase (lower weight) for that reason. Idempotent - the step skips - * once the content type exists - so it is safe on every deploy. + * field and displays exist before any module that attaches behaviour to that + * type is installed - hence the lowest weight in the PRE phase. Idempotent - + * the step skips once the content type exists - so it is safe on every deploy. * * @codeCoverageIgnore */ diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/.gitignore b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/.gitignore new file mode 100644 index 0000000000..4c478b1b22 --- /dev/null +++ b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/.gitignore @@ -0,0 +1,8 @@ +@@ -32,7 +32,6 @@ + # Composer installs contrib recipes into 'recipes/', next to custom recipes, + # so recipes stay an allow list: un-ignore custom recipes explicitly. + recipes/* +-!recipes/page + + # Ignore all Claude files by default. Custom files should be added explicitly. + .claude/* diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/-recipe.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/-recipe.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_form_display.node.page.default.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_form_display.node.page.default.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.default.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.default.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.teaser.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.teaser.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.field.node.page.body.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.field.node.page.body.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.storage.node.body.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.storage.node.body.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-node.type.page.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-node.type.page.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-counter.feature b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-counter.feature new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-pages.feature b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-pages.feature new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/-CreateContentModelDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/-CreateContentModelDeployStep.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/EnableDevelopmentModulesDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/EnableDevelopmentModulesDeployStep.php new file mode 100644 index 0000000000..da64a4364e --- /dev/null +++ b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/EnableDevelopmentModulesDeployStep.php @@ -0,0 +1,10 @@ +@@ -104,9 +104,6 @@ + + $this->moduleInstaller->install(['devel']); + +- $this->moduleInstaller->install(['sw_search']); +- +- $this->moduleInstaller->install(['sw_demo']); + } + + } diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.deploy.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.deploy.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.info.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.info.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.libraries.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.libraries.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.module b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.module new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/config/install/-views.view.sw_demo_pages.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/config/install/-views.view.sw_demo_pages.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/css/-sw_demo.css b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/css/-sw_demo.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/-sw_demo.js b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/-sw_demo.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/tests/-sw_demo.test.js b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/tests/-sw_demo.test.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/Block/-CounterBlock.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/Block/-CounterBlock.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/GeneratedContent/Node/-Page.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/GeneratedContent/Node/-Page.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/templates/-sw-demo-counter-block.html.twig b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/templates/-sw-demo-counter-block.html.twig new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/FunctionalJavascript/-CounterBlockTest.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/FunctionalJavascript/-CounterBlockTest.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Kernel/-CounterBlockTest.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Kernel/-CounterBlockTest.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Unit/-CounterBlockTest.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Unit/-CounterBlockTest.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.deploy.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.deploy.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.info.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.info.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.install b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.install new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.index.content.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.index.content.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.server.solr.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.server.solr.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-views.view.search.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-views.view.search.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/src/Plugin/DeployStep/-RebuildSearchIndex.php b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/src/Plugin/DeployStep/-RebuildSearchIndex.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/.gitignore b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/.gitignore new file mode 100644 index 0000000000..4c478b1b22 --- /dev/null +++ b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/.gitignore @@ -0,0 +1,8 @@ +@@ -32,7 +32,6 @@ + # Composer installs contrib recipes into 'recipes/', next to custom recipes, + # so recipes stay an allow list: un-ignore custom recipes explicitly. + recipes/* +-!recipes/page + + # Ignore all Claude files by default. Custom files should be added explicitly. + .claude/* diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/-recipe.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/-recipe.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_form_display.node.page.default.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_form_display.node.page.default.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.default.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.default.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.teaser.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.teaser.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.field.node.page.body.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.field.node.page.body.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.storage.node.body.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.storage.node.body.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-node.type.page.yml b/.vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-node.type.page.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php index b057d4e988..05b6d283a8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php @@ -14,13 +14,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Creates the demo content model on non-production deploys. + * Creates the starter content model on non-production deploys. * * Applies the project 'page' recipe so the Basic page content type, its body - * field and displays exist before the demo modules that attach behaviour to - * that type are installed. Runs ahead of EnableDevelopmentModulesDeployStep in - * the PRE phase (lower weight) for that reason. Idempotent - the step skips - * once the content type exists - so it is safe on every deploy. + * field and displays exist before any module that attaches behaviour to that + * type is installed - hence the lowest weight in the PRE phase. Idempotent - + * the step skips once the content type exists - so it is safe on every deploy. * * @codeCoverageIgnore */ diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php index b057d4e988..05b6d283a8 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php @@ -14,13 +14,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Creates the demo content model on non-production deploys. + * Creates the starter content model on non-production deploys. * * Applies the project 'page' recipe so the Basic page content type, its body - * field and displays exist before the demo modules that attach behaviour to - * that type are installed. Runs ahead of EnableDevelopmentModulesDeployStep in - * the PRE phase (lower weight) for that reason. Idempotent - the step skips - * once the content type exists - so it is safe on every deploy. + * field and displays exist before any module that attaches behaviour to that + * type is installed - hence the lowest weight in the PRE phase. Idempotent - + * the step skips once the content type exists - so it is safe on every deploy. * * @codeCoverageIgnore */ diff --git a/.vortex/installer/tests/Fixtures/handler_process/names/web/modules/custom/the_force_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php b/.vortex/installer/tests/Fixtures/handler_process/names/web/modules/custom/the_force_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php index 7faa2838be..1abc3a0452 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/names/web/modules/custom/the_force_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php +++ b/.vortex/installer/tests/Fixtures/handler_process/names/web/modules/custom/the_force_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php @@ -14,13 +14,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Creates the demo content model on non-production deploys. + * Creates the starter content model on non-production deploys. * * Applies the project 'page' recipe so the Basic page content type, its body - * field and displays exist before the demo modules that attach behaviour to - * that type are installed. Runs ahead of EnableDevelopmentModulesDeployStep in - * the PRE phase (lower weight) for that reason. Idempotent - the step skips - * once the content type exists - so it is safe on every deploy. + * field and displays exist before any module that attaches behaviour to that + * type is installed - hence the lowest weight in the PRE phase. Idempotent - + * the step skips once the content type exists - so it is safe on every deploy. * * @codeCoverageIgnore */ diff --git a/.vortex/installer/tests/Functional/Handlers/CustomModulesHandlerProcessTest.php b/.vortex/installer/tests/Functional/Handlers/CustomModulesHandlerProcessTest.php index 36d902db95..096b3bd122 100644 --- a/.vortex/installer/tests/Functional/Handlers/CustomModulesHandlerProcessTest.php +++ b/.vortex/installer/tests/Functional/Handlers/CustomModulesHandlerProcessTest.php @@ -29,6 +29,24 @@ public static function dataProviderHandlerProcess(): \Iterator { static::cw(function (AbstractHandlerProcessTestCase $test): void { $test->assertSutNotContains('_demo'); $test->assertSutNotContains('counter_block'); + // The search module indexes and moderates the 'page' bundle, so the + // content model stays when only the demo module is dropped. + $test->assertDirectoryExists(static::$sut . '/recipes/page'); + $test->assertFileExists(static::$sut . '/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php'); + }), + ]; + yield 'custom_modules_base_only' => [ + static::cw(function ($test): void { + $test->prompts[CustomModules::id()] = [CustomModules::BASE]; + $test->prompts[AiCodeInstructions::id()] = TRUE; + }), + static::cw(function (AbstractHandlerProcessTestCase $test): void { + $test->assertSutNotContains('_demo'); + $test->assertSutNotContains('_search'); + $test->assertDirectoryExists(static::$sut . '/web/modules/custom/sw_base'); + $test->assertDirectoryDoesNotExist(static::$sut . '/recipes/page'); + $test->assertFileDoesNotExist(static::$sut . '/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php'); + $test->assertFileNotContainsString(static::$sut . '/.gitignore', '!recipes/page'); }), ]; yield 'custom_modules_no_search' => [ @@ -44,6 +62,8 @@ public static function dataProviderHandlerProcess(): \Iterator { $test->assertSutNotContains('_base'); $test->assertSutNotContains('_demo'); $test->assertSutNotContains('_search'); + $test->assertDirectoryDoesNotExist(static::$sut . '/recipes/page'); + $test->assertFileNotContainsString(static::$sut . '/.gitignore', '!recipes/page'); }), ]; yield 'custom_modules_search_without_solr' => [ diff --git a/.vortex/tests/phpunit/Traits/SutTrait.php b/.vortex/tests/phpunit/Traits/SutTrait.php index 06f48610ba..a8c384daea 100644 --- a/.vortex/tests/phpunit/Traits/SutTrait.php +++ b/.vortex/tests/phpunit/Traits/SutTrait.php @@ -561,6 +561,7 @@ protected function assertDrupalFilesPresent(string $webroot = 'web'): void { $this->assertFileExists($webroot . '/modules/custom/sw_base/sw_base.deploy.php'); $this->assertFileExists($webroot . '/modules/custom/sw_base/sw_base.info.yml'); $this->assertFileExists($webroot . '/modules/custom/sw_base/sw_base.module'); + $this->assertFileExists($webroot . '/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php'); $this->assertFileExists($webroot . '/modules/custom/sw_base/src/Plugin/DeployStep/EnableDevelopmentModulesDeployStep.php'); $this->assertFileExists($webroot . '/modules/custom/sw_base/tests/src/Functional/ExampleTest.php'); $this->assertFileExists($webroot . '/modules/custom/sw_base/tests/src/Functional/SwBaseFunctionalTestBase.php'); @@ -569,6 +570,10 @@ protected function assertDrupalFilesPresent(string $webroot = 'web'): void { $this->assertFileExists($webroot . '/modules/custom/sw_base/tests/src/Unit/ExampleTest.php'); $this->assertFileExists($webroot . '/modules/custom/sw_base/tests/src/Unit/SwBaseUnitTestBase.php'); + // Starter content model recipe applied by the base module's deploy step. + $this->assertFileExists('recipes/page/recipe.yml'); + $this->assertFileContainsString('.gitignore', '!recipes/page'); + // Site search module created. $this->assertDirectoryExists($webroot . '/modules/custom/sw_search'); $this->assertFileExists($webroot . '/modules/custom/sw_search/sw_search.info.yml'); diff --git a/web/modules/custom/ys_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php b/web/modules/custom/ys_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php index 7df4cf811d..7e3d09f19f 100644 --- a/web/modules/custom/ys_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php +++ b/web/modules/custom/ys_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php @@ -14,13 +14,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Creates the demo content model on non-production deploys. + * Creates the starter content model on non-production deploys. * * Applies the project 'page' recipe so the Basic page content type, its body - * field and displays exist before the demo modules that attach behaviour to - * that type are installed. Runs ahead of EnableDevelopmentModulesDeployStep in - * the PRE phase (lower weight) for that reason. Idempotent - the step skips - * once the content type exists - so it is safe on every deploy. + * field and displays exist before any module that attaches behaviour to that + * type is installed - hence the lowest weight in the PRE phase. Idempotent - + * the step skips once the content type exists - so it is safe on every deploy. * * @codeCoverageIgnore */