diff --git a/core/lib/Drupal/Core/Command/GenerateTheme.php b/core/lib/Drupal/Core/Command/GenerateTheme.php index 89540768d28dd25fe8966996535f0602cf5d765c..ed61dcfdd8e49836169161497b2cbc16bc0a9b31 100644 --- a/core/lib/Drupal/Core/Command/GenerateTheme.php +++ b/core/lib/Drupal/Core/Command/GenerateTheme.php @@ -133,6 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $mirror_iterator = (new Finder) ->in($starterkit->getPath()) ->files() + ->ignoreDotFiles(FALSE) ->notName($starterkit_config['ignore']) ->notPath($starterkit_config['ignore']); diff --git a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php index 3a2eeb13d5517f2460d051dc26061fa1b8658057..339eb2b520b66205157de328507c40fc87f09fc3 100644 --- a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php +++ b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php @@ -582,6 +582,24 @@ public function testInfoOverrides(): void { self::assertEquals(['core/jquery'], $info['libraries']); } + public function testIncludeDotFiles(): void { + file_put_contents($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/.gitignore', '*.map'); + $tester = $this->runCommand( + [ + 'machine-name' => 'test_custom_theme', + '--name' => 'Test custom starterkit theme', + '--description' => 'Custom theme generated from a starterkit theme', + ] + ); + + $tester->assertCommandIsSuccessful($tester->getErrorOutput()); + $this->assertThemeExists('themes/test_custom_theme'); + + // Verify that the .gitignore file is present in the generated theme. + $theme_path_absolute = $this->getWorkspaceDirectory() . '/themes/test_custom_theme'; + self::assertFileExists($theme_path_absolute . '/.gitignore'); + } + private function writeStarterkitConfig(array $config): void { $starterkit_yml = $this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.starterkit.yml'; $starterkit_config = Yaml::decode(file_get_contents($starterkit_yml));