Problem/Motivation

In 1.x we could organize our patterns in subdirectories. When converting them to components using the drush script, this structure is lost. On projects with a lot of patterns/components, it can be very tedious to reorganize them all.

Steps to reproduce

  1. Create a pattern in a subdirectory of templates/patterns (eg: templates/patterns/atoms)
  2. Run the drush script

Expected: the component is created in an "atom" directory
Current: the component is created in the "components" directory directly

Proposed resolution

Keep the directory structure when creating components.

CommentFileSizeAuthor
#7 3525566-7.patch5.47 KBduaelfr
#3 3525566-3.patch4.6 KBduaelfr
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

duaelfr created an issue. See original summary.

duaelfr’s picture

Assigned: duaelfr » Unassigned
Status: Active » Needs review
StatusFileSize
new4.6 KB

There you go.
Patch attached for composer users.

pdureau’s picture

Assigned: Unassigned » duaelfr
Status: Needs review » Needs work

Great find! We can merge this ASAP.

However, would it be possible to not hardcode /templates/patterns/

      $component_path = str_replace('/templates/patterns/', '/components/', $legacy_definition['base path']);

UI Patterns 1.x components can be found in other places.

duaelfr’s picture

Assigned: duaelfr » Unassigned

@pdureau Thanks for the review.
Do you have some examples of other locations where patterns can be found? How can this be dynamically determined?

g4mbini’s picture

duaelfr’s picture

Status: Needs work » Needs review
StatusFileSize
new5.47 KB

New attempt to fix the issue.
Patch for composer attached.

pdureau’s picture

Assigned: Unassigned » duaelfr
Status: Needs review » Needs work

Looks good to me. I will ask another maintainer to review.

But before, little cspells fix expected: https://git.drupalcode.org/project/ui_patterns/-/jobs/5325802

duaelfr’s picture

Assigned: duaelfr » Unassigned
Status: Needs work » Needs review

Done (no need for a new patch as it's only a typo in a comment).

  • pdureau committed 43f6334b on 2.0.x authored by duaelfr
    Issue #3525566 by duaelfr: Keep patterns directory structure when...
pdureau’s picture

Title: [2.0.x] Keep patterns directory structure when converting them to components » [2.0.5] Keep patterns directory structure when converting them to components
Status: Needs review » Fixed

thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.