[2.0.x] Keep patterns directory structure when converting them to components

Created on 20 May 2025, 3 months ago

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.

🐛 Bug report
Status

Active

Version

2.0

Component

UI Patterns Library

Created by

🇫🇷France duaelfr Montpellier, France

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

Merge Requests

Comments & Activities

  • Issue created by @duaelfr
  • 🇫🇷France duaelfr Montpellier, France

    There you go.
    Patch attached for composer users.

  • Pipeline finished with Failed
    3 months ago
    Total: 588s
    #502069
  • Pipeline finished with Success
    2 months ago
    Total: 755s
    #502286
  • 🇫🇷France pdureau Paris

    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.

  • 🇫🇷France duaelfr Montpellier, France

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

  • 🇫🇷France duaelfr Montpellier, France

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

  • Pipeline finished with Failed
    2 months ago
    Total: 591s
    #502820
  • 🇫🇷France pdureau Paris

    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

  • 🇫🇷France duaelfr Montpellier, France

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

  • Pipeline finished with Success
    2 months ago
    Total: 882s
    #507294
  • Pipeline finished with Skipped
    2 months ago
    #507475
  • Pipeline finished with Skipped
    2 months ago
    #507476
  • 🇫🇷France pdureau Paris

    thanks

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

  • Pipeline finished with Success
    about 1 month ago
    Total: 52s
    #538275
  • Pipeline finished with Success
    about 1 month ago
    #538269
  • Pipeline finished with Failed
    about 1 month ago
    Total: 82s
    #538285
  • Pipeline finished with Success
    about 1 month ago
    Total: 51s
    #538334
  • Pipeline finished with Success
    about 1 month ago
    #538928
  • Pipeline finished with Success
    about 1 month ago
    Total: 93s
    #538953
  • Pipeline finished with Success
    about 1 month ago
    Total: 381s
    #538954
  • Pipeline finished with Failed
    about 1 month ago
    Total: 51s
    #539102
  • Pipeline finished with Failed
    about 1 month ago
    Total: 48s
    #539103
  • Pipeline finished with Success
    about 1 month ago
    Total: 49s
    #539104
  • Pipeline finished with Success
    about 1 month ago
    Total: 49s
    #539115
  • Pipeline finished with Success
    about 1 month ago
    #539222
  • Pipeline finished with Success
    27 days ago
    Total: 53s
    #540859
  • Pipeline finished with Failed
    25 days ago
    Total: 106s
    #543090
  • Pipeline finished with Success
    25 days ago
    Total: 265s
    #543092
  • Pipeline finished with Success
    25 days ago
    Total: 48s
    #543108
  • Pipeline finished with Canceled
    13 days ago
    #553405
  • Pipeline finished with Success
    13 days ago
    #553410
  • Pipeline finished with Success
    13 days ago
    #553418
  • Pipeline finished with Success
    13 days ago
    #553426
  • Pipeline finished with Success
    13 days ago
    #553442
  • Pipeline finished with Skipped
    12 days ago
    #554317
Production build 0.71.5 2024