Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatternEngines ongoing work, round 3 #199

Merged
merged 29 commits into from Dec 4, 2015

Conversation

geoffp
Copy link
Contributor

@geoffp geoffp commented Dec 1, 2015

The day's work.

  • list items work with Mustache!
  • all unit tests pass except one.
  • all direct uses of Mustache are now gone
  • new partial finding regex for Mustache that accounts for regular syntax, verbose syntax, style modifier syntax, pattern parameter syntax, and single and double quoted strings in pattern parameters with escaped quotes. Making this hurt my brain very badly. Plus, unit tests for this based on all test cases used in development.
  • utility functions have been factored out of the pattern assembler and moved to utilities.js
  • isPatternFile has moved to pattern_engines since that's where the information it needs is concentrated.

TODO:

  • failing test: list_item_hunter - process_list_item_partials finds verbose partials and outputs repeated renders
  • Investigate why pseudo-patterns are being placed in the menus out of order
  • Finish factoring out all direct uses of mustache
  • Hunt down all Mustache-specific "finder" regexes in the hunters and move them into the Mustache plugin
    • finders in pattern_assembler
    • finders elsewhere? they could be lurking
  • Use or remove the util module
  • Migrate unit tests to use "real" instantiated oPatterns
    • Machinery to create empty/custom oPatterns programatically
    • Replace object-literal fake oPatterns in unit tests with real oPatterns

Brendan Rice and others added 22 commits November 8, 2015 13:09
factory in the pseudopattern hunter; misc. code cleanup; hide some debug
console.logs behind the flag
utilities module; move isPatternFile into pattern_engines module since
that's where the knowledge it needs is concentrated
verbose syntax, style modifier syntax, pattern parameter syntax, and
single and double quoted strings in pattern parameters with escaped
quotes. Making this hurt my brain very badly. Update the appropriate
unit test with all the test cases used to develop the regex, plus some
flown in from other unit tests.
@bradfrost
Copy link
Member

Greetings from a fascinated onlooker! I just want to say thank you to you and certainly everyone else (especially @bmuenzenmeyer) for rocking and rolling on the node version of Pattern Lab.

@geoffp
Copy link
Contributor Author

geoffp commented Dec 2, 2015

Hi Brad!

Thanks right back at both of you for Pattern Lab/Node and Atomic Design. They've been crucial to our ongoing work on the responsive m.target.com. And @bmuenzenmeyer has made it a real pleasure to contribute and be involved.

@bmuenzenmeyer
Copy link
Member

@bradfrost Hey there. Thanks for the kind words - it's fuel to make the port more than I'd ever imagined on the outset. You and @dmolsen and everyone interested has made it what it is today.

@geoffp SUPER DUPER DUPER interested in knowing more about m.target.com and how you use the project. I'd be humbled to add a wiki page or prominent shoutout to project that use patternlab. Perhaps this is something that patternlab.io could host Brad?

I'm getting a bit buried on this pattern-engine work and other pattern lab documentation/issues coming in but I will try to review more in-depth soon. Thanks

@geoffp
Copy link
Contributor Author

geoffp commented Dec 2, 2015

@bmuenzenmeyer, I know, I'm really sorry about the sheer volume of the pattern-engine code. I know it's hard to review; I have a window of opportunity during which I can contribute this work, so I'm trying to get it as close to "done" as I can while the window's still open.

I'd love to tell you guys all about how we use it, and why we chose the Node port. I feel like I should find someone here who can confirm for me what it's okay for me to talk about before I start yapping all over the public internets. It's a big company.

@bmuenzenmeyer
Copy link
Member

I'd be over the moon crazy excited to hear about it (publicly or
privately). A lot of work (I am sure Brad and Dave can agree) is like
eating your own dogfood, so they say.... but hearing how others are
benefiting from the tools and concepts is really what makes it all
worth-while :D

On Wed, Dec 2, 2015 at 10:54 AM Geoff Pursell notifications@github.com
wrote:

@bmuenzenmeyer https://github.com/bmuenzenmeyer, I know, I'm really
sorry about the sheer volume of the pattern-engine code. I know it's hard
to review; I have a window of opportunity during which I can contribute
this work, so I'm trying to get it as close to "done" as I can while the
window's still open.

I'd love to tell you guys all about how we use it, and why we chose the
Node port. I feel like I should find someone here who can confirm for me
what it's okay for me to talk about before I start yapping all over the
public internets. It's a big company.


Reply to this email directly or view it on GitHub
#199 (comment)
.

@geoffp
Copy link
Contributor Author

geoffp commented Dec 2, 2015

I got a green light! 🚦 I don't speak for Target as a whole, of course, just for myself and my team.

We use Pattern Lab/Node as the primary front-end development environment for most of the chunks of UI, large and small, on the new m.target.com, which is a fully responsive new version of Target's main e-commerce platform. Right now it's targeted at phones and tablets. Atomic design has been our chosen methodology from the beginning of this phase of development (about a year ago). We've talked to Brad and Josh Clark, and tried to get our design taxonomy right form the beginning, which is incredibly hard to do when you're trying to go really fast. We're still grappling with how to classify some things.

Back then, we evaluated PL/PHP and PL/Node; we chose Node for two reasons: one, we're moving toward Node.js on the back end, and have no preexisting PHP usage, so it was a better fit for our developers. But more importantly: we eventually want to operationalize our templates, and because all our work is in the JS domain (mostly in the browser), we need support for JS templating engines.

Back then, we thought we were moving towards Handlebars, so we forked PL/Node and hacked it up (hastily) to replace Mustache with Handlebars. That was pretty easy, since Handlebars is a superset of Mustache, but there were two problems with it: one, it was still hard-coded to one template engine, and two, we wound up not using that engine.

So now, we are doing it (more) right, making it work flexibly, and giving back to the community, which it is an honor and a privilege to do. We need to make it support Handlebars (to support our existing library of patterns), but also Underscore (our on-the-ground reality of the moment) and eventually whatever "real" web component system we wind up with, whether it's Polymer/Web Components or React.

We love developing UI without the overhead of a full web app, a11y loves using patterns as a11y "unit tests", and we love being forced to think about UI structure through Atomic.

@bmuenzenmeyer
Copy link
Member

Investigate why pseudo-patterns are being placed in the menus out of order

I haven't run this code yet, but the this PR addressed this last time. Perhaps it's a simple order of operations bug again.

I want to respond more long form to your latest comment. Thanks for writing!

true for a pseudopattern JSON file and it wasn't. In fact, its unit test
was lying to us. Lies! Also: implement a proper isPseudoPatternJSON()
function in pattern_engines to centralize that logic and write a unit
test for it; move isPatternFile unit test to the right file
@bmuenzenmeyer
Copy link
Member

@geoffp per Salem, when you are ready I will merge this.

@geoffp
Copy link
Contributor Author

geoffp commented Dec 3, 2015

@sghoweri, that's fine by me. Alternatively, you could submit a pull request against my fork, and then I could do the merge there right away. I think I still have to get my branch up to date with the latest stable release, so I may be in merge-land anyway.

@bmuenzenmeyer fixed the out-of-order thing. It was totally my fault -- the isPatternFile() function should have returned true for a pseudopattern JSON file name and it wasn't, so processPatternIterative() wasn't registering the preliminary pseudopattern at the right time. It was getting registered later in the process, though, hence the out-of-order menu. I even had the unit test written to lie to us and say everything was fine.

@geoffp
Copy link
Contributor Author

geoffp commented Dec 3, 2015

@bmuenzenmeyer cool. I want to take one more look at the unit test that's still failing and see if I can get us into a completely clean state, if that's okay with you.

…ern-engines

Conflicts:
	builder/lineage_hunter.js
	builder/list_item_hunter.js
	builder/object_factory.js
	builder/parameter_hunter.js
	builder/pattern_assembler.js
	builder/patternlab.js
	builder/pseudopattern_hunter.js
	test/pattern_assembler_tests.js
repeated renders' test to actually, you know, test verbose partials
@geoffp
Copy link
Contributor Author

geoffp commented Dec 4, 2015

Okay! I'm ready to let go for the weekend. Hopefully this is a clean platform on which @sghoweri can rock and roll. We're passing all the unit tests, and up to date with the latest release! Exactly the kind of Friday afternoon situation you want.

@bmuenzenmeyer, this includes the tricky 0.15.1 merge (fingers crossed) and a non-liar unit test for the list item hunter/verbose partial syntax. There was also one more Mustache-specific regex in the pattern assembler (getPartialKey) that's been factored out.

@bmuenzenmeyer
Copy link
Member

Great work! I am going to accept this so Salem can start looking at it easier perhaps. Will try to review this weekend too amidst trying to finish my own v1.0.0 work

bmuenzenmeyer pushed a commit that referenced this pull request Dec 4, 2015
PatternEngines ongoing work, round 3
@bmuenzenmeyer bmuenzenmeyer merged commit b807680 into pattern-lab:pattern-engines Dec 4, 2015
@sghoweri
Copy link
Contributor

sghoweri commented Dec 4, 2015

+1

Awesome - thanks guys!

@sghoweri
Copy link
Contributor

sghoweri commented Dec 8, 2015

OK - just a really quick update before I gotta hit the hay. Today I successfully managed to get my ongoing Twig template support updates working with the latest pattern-engines branch updates from the weekend. There's a few things I'll want to run by you guys before my next PR goes out but so far so good.

Even better news: I managed to get the lineage mapping (and code viewer links for these) working in addition to pattern modifiers workings with the Twig engine as well. Haven't had a chance to take a crack at some of the other regex matches (like style modifiers) yet but for all intents and purposes these Twig updates are pretty damn close to the feature parity of the mustache templates (plus all the goodies Twig provides us).

I'll see if I can get these updates checked in tomorrow or Wednesday so we can keep the ball rolling on this!

@bmuenzenmeyer
Copy link
Member

Awesome @sghoweri looking forward to it! It's amazing to see this come together, at a time when I finally finish up some of the last v1.0.0 work too, so we can move into the future with these engines 🚀

@bmuenzenmeyer
Copy link
Member

Hey all - I just pushed some small changes to dev

@geoffp
Copy link
Contributor Author

geoffp commented Dec 8, 2015

Should I keep my branch up to date with dev then?

@bmuenzenmeyer
Copy link
Member

It needs to get merges sooner or later, either by you or I. I suggested it only because I know you were in the unit tests a bit and they changed a bit, along with cleaning up a bug in pseudopattern generation.

You can see the commit here.

The only remaining item on my upstream end is this one which I am working on now - then I'll be focusing 100% on engines and post 1.0.0 world.

@geoffp
Copy link
Contributor Author

geoffp commented Dec 8, 2015

Good call. Seems pretty easy to merge.

@sghoweri, I super-want your latest work because I'm going to start on the Handlebars engine and I bet real money you've already fixed a bunch of the problems I'm going to find.

@dmolsen
Copy link
Member

dmolsen commented Dec 8, 2015

This is fascinating to watch from the outside. Thanks for collaborating on this.

@dmolsen
Copy link
Member

dmolsen commented Dec 8, 2015

oh, and @geoffp, thanks for sharing your notes on your experience. very cool to hear that the concept is being useful for folks.

@sghoweri
Copy link
Contributor

sghoweri commented Dec 8, 2015

@geoffp Have the code up on my pattern-engines fork if you wanted to take a look (https://github.com/sghoweri/patternlab-node/tree/pattern-engines), albeit not 100% done yet.

Besides to make the code viewer more template-agnostic, I'd imagine you'd be most interested in changes I had to make to the pattern_assembler.js (so non .mustache templates are picked up) + the overall process it took to get Twig working in the pattern_engines folder since I'd imagine rolling in other templating languages (like Handlebars) would be very similar, if not a bit easier.

Still cleaning up some stuff but lemme know if you had any questions in the meantime!

@geoffp
Copy link
Contributor Author

geoffp commented Dec 8, 2015

@dmolsen, you're welcome; it's fun to write stuff like that. And likewise, thanks for all your excellent work on PL.
@sghoweri, thank you! Your pattern_assembler fixes are very helpful.

The adventure continues in #208.

geoffp pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
geoffp pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
geoffp pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
bmuenzenmeyer pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
geoffp pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
geoffp pushed a commit that referenced this pull request Feb 23, 2018
PatternEngines ongoing work, round 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants