-
Notifications
You must be signed in to change notification settings - Fork 405
Description
As a user, I want to be able to generate multple UIs from a single pattern tree.
We will basically support a workflow first described in @bradfrost's article, The Workshop and the Storefront.
Pattern Lab Node needs to change to accept N number of UIs to build. This issue will attempt to capture what is needed for that to be successful.
I think an acceptable way to think of how this would work is to start at the configuration point and move forward from there.
Proposed Solution
patternlab-config.json
"uikits": [
{
"name": "@pattern-lab/uikit-workshop",
"outputDir": "workshop",
"enabled": true,
"excludedPatternStates": [],
"excludedTags": []
},
{
"name": "@pattern-lab/uikit-storefront",
"outputDir": "storefront",
"enabled": true,
"excludedPatternStates": ["inprogress", "inreview"],
"excludedTags": []
},
]
High-Level Pseudocode build()
- Build source patterns
require()
all uikits by name- For each uikit in uikits...
- Build frontend...
- bail if not enabled via config or maybe a runtime flag
- exclude patterns as indicated by state and tag exclusions in the config
- output to
outputDir
as root - join topaths.public
- Copy assets into frontend
- Build frontend...
From what I can think about it right now, uikit build could be parallelized. Not sure if it's worth doing that, but may be neat!
Questions
- Would all uikits share the same
_meta
files? That would certainly be easiest, but may be limiting.
Evaluation
❌ index.js
headPatternPromise
andfootPatternPromise
decomposed but only used withinui_builder
(a good thing from a refactoring standpoint)
❌ patternlab.js
-
The assigment of templates hanging off of
patternlabFiles
assumes a single uikitheader
footer
patternSection
patternSectionSubType
-
writePatternFiles()
assumes a single uikit
❌ ui_builder.js
- assumes a single uikit
- needs to filter out states and tags not wanted to output
❌ exportData.js
- assumes a single uikit
- might be a good extension point for custom logic within a uikit. use events?
❌ copier.js
- assumes a single uikit
❌ pattern_graph.js
exportToDot()
assumes a single uikit
✔️ pattern_exporter.js
- assumes a single location - but I think that is okay
MISC
-
We need to well-document part of the UI-build process we have previously let slide if we want teams to adopt this approach (or even if we want to easily create
uikit-storefront
- the data schema available to a uikit at render time
- the expected templates a uikit provides
- the file locations Pattern Lab will output after build
-
We need to update Ecosystem documentation to refer to uikits and the ability to have N of them
-
It's probably revisting in
meta
patterns are truly optional. We try to fall back to general header and footer but I need to test if this works in practice.