patternlab-node icon indicating copy to clipboard operation
patternlab-node copied to clipboard

error at build when two pattern folders uses the same name with a different number

Open gael-boyenval opened this issue 8 years ago • 12 comments

I am using Pattern Lab Node v2.4.0 on Mac with Node v6, using the Gulp Edition.

Expected Behavior

throw a more explicit error like pattern directory name duplicated : XXX

Actual Behavior

throw this error Could not find patternType 01-atoms-01-atoms. This is a critical error. and fail the build

Steps to Reproduce

name two folders _patterns/00-atoms/00-images and _patterns/00-atoms/01-images and build/watch

gael-boyenval avatar Aug 17 '16 16:08 gael-boyenval

Thanks for reporting this @gael-boyenval - glad we were able to debug it and keep you running

bmuenzenmeyer avatar Aug 17 '16 16:08 bmuenzenmeyer

@bmuenzenmeyer you're welcome, i thank you very much for the help.

gael-boyenval avatar Aug 17 '16 16:08 gael-boyenval

This also happens in the other pattern folders - including for SEO (it took me a long time to find this bug report!)

Could not find patternType 01-molecules-01-molecules. This is a critical error. Could not find patternType 02-organisms-02-organisms. This is a critical error. Could not find patternType 03-templates-03-templates. This is a critical error. Could not find patternType 04-pages-04-pages. This is a critical error.

acarnwath avatar Jul 25 '17 17:07 acarnwath

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 09 '18 15:01 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '18 18:03 stale[bot]

To fix this issue we will need to make a breaking change. At the moment the shorthand pattern name will be generated from patternType-patternName.

To be sure that this isn't happening anymore there will be two approaches.

  1. Generate shorthand name as patternType-patternSubType-patternName which feels a bit too long.
  2. Alternatively, we add a markdown pattern-property which allows adding an individual shorthand name for that pattern. after that, you can reference the pattern by that name which will be patternType-customShorthandName

JosefBredereck avatar Apr 29 '20 16:04 JosefBredereck

The shorthand syntax leads to PL lockin. I'd rather us do away with any logic whatsoever that contributes to patterns not being portable.

bmuenzenmeyer avatar May 01 '20 12:05 bmuenzenmeyer

Experiencing this as well. In the process up upgrading from version 2.7 to latest. Got all the twig functions and filters migrated to new version and finally building now. But now the build errors with

Could not find patternType 01-components-01-components. This is a critical error.
⊙ patternlab → TypeError: Cannot read property 'patternSubtypeItems' of undefined

Is there any work around until the issue is resolved?

justclint avatar May 01 '20 17:05 justclint

Use links without numbers components-component

JosefBredereck avatar May 01 '20 17:05 JosefBredereck

Given that the numbering scheme of folders and files will be deprecated in the near future (#1028), I doubt something will be done about this.

@bmuenzenmeyer can this issue be closed?

ringods avatar May 15 '20 13:05 ringods

It's not about the numbers it's about the names.

JosefBredereck avatar May 15 '20 15:05 JosefBredereck

The shorthand syntax leads to PL lockin. I'd rather us do away with any logic whatsoever that contributes to patterns not being portable.

Given that #1181, #1176, and #1028 are in place and handlebars (see) or other rendering engines have their own way of referencing partials we have to find another way to solve this issue.

But also handlebars or twig are looking for a registered partial when referencing patterns. We register all partials (for example) in engine-handlebars or engine-twig and we generate that partial in core-object_factory. Given the fact that we still use the shorthand version the only way to overcome the given issue would be to update the pattern partial to patternGroup-patternSubGroup-patternName or to the path of the pattern patternGroup/patternSubGroup/.../patternName.

After removing the ##- prefix it shouldn't be possible to do the following

_patterns/00-atoms/00-images and _patterns/00-atoms/01-images

and the only way a pattern name could exist twice would be when you have those two files _patterns/atoms/images/cool-image.* and _patterns/atoms/other-images/cool-image.*, because you will get a resulting name/partial of atoms-cool-image.

Any suggestions or opinions?

JosefBredereck avatar Aug 18 '20 17:08 JosefBredereck