Skip to content

patternengines needs to support @scoped/modules #735

Closed
@bmuenzenmeyer

Description

@bmuenzenmeyer

I am using Pattern Lab Node v3.0.0-alpha.3 on Windows, with Node v8.60, using direct consumption.

Expected Behavior
  • patternlab.build() runs
Actual Behavior

patternlab.build() is broken

pattern_engines.js needs to be able to find patternengines defined in any of the following locations within node_modules/:

  • patternengine-node-mustache
  • @pattern-lab/patternengine-node-mustache
  • @third-party/patternengine-node-language

Perhaps a better approach than diveSync would be an a small existing utility that can look for directories that match a regex. https://www.npmjs.com/package/require-glob or even just https://www.npmjs.com/package/glob would likely work?

Additional thoughts

  • the first entry in enginesDirectories[the core] can removed, since core will not have engines anymore
  • pattern_engines is currently failing because diveSync is not smart enough to see @pattern-lab/ (or any scoped packages, for that matter) and also check in there.
  • the engineMatcher regex may need to also change
  • unit tests should be able to help cover this scenario
  • DO NOT SIGNIFICANTLY REFACTOR THIS CODE. Scope of change is limited to supporting searching within scoped packages
Steps to Reproduce

clone https://github.com/bmuenzenmeyer/patternlab-node-3.0-demo-vanilla
npm install
node index.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions