drupal generate-theme cannot exclude dotfiles from starterkit

Created on 18 January 2025, 3 months ago

Problem/Motivation

One cannot exclude dotfiles from a starterkit theme.

The use case: We have a starterkit theme from a private repo composer dependency that comes with a lot of dot files for development (eslintrc, stylelintrc, nvmrc, etc.). On project startup, we generate a theme off of this starterkit theme and don't want any of those files as the project-level dotfiles will cover the tooling configuration.

The issue: The .starterkit.yml's ignore works fine on regular files. But it fails on dotfiles. 3456699 fixed this by adding ignoreDotFiles(FALSE) to the Finder instance used. However, on line 118, GenerateTheme::loadStarterKitConfig calls GenerateTheme::createFilesFinder which creates a Finder instance that doesn't ignoreDotFiles(FALSE). When GenerateTheme::loadStarterKitConfig validates its config, it omits all the dotfiles from ignore.

Was tested in D10.4 but the affected code remained the same on 11.x.

Steps to reproduce

1. Install Drupal.
2. Create a starterkit theme that includes an .eslintrc and .stylelintrc.
3. In the .starterkit.yml file of this theme, add .stylelintrc to ignore.

Expected:
When drupal generate-theme is used on this starterkit, .stylelintrc is ignored. Only .eslintrc is copied over.

Actual:
Both .eslintrc and .stylelintrc are copied over.

Proposed resolution

- Make GenerateTheme::createFilesFinder include all files.
- Make GenerateTheme::execute also use GenerateTheme::createFilesFinder, for consistency.
- Verify if all existing usages won't break.

Remaining tasks

- Merge request
- Test
- Review

API changes

- self::createFilesFinder will start including dotfiles.

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

Starterkit theme

Created by

πŸ‡ΊπŸ‡ΈUnited States fskreuz

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

Comments & Activities

Production build 0.71.5 2024