Lona / Lona

A tool for defining design systems and using them to generate cross-platform UI code, Sketch files, and other artifacts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help getting started on lona compiler contributions

509dave16 opened this issue · comments

Learning Reason beforehand

@dabbott I noticed that you wrote the compiler in Reason which is awesome! But I know historically many people have mentioned that the learning curve of Reason is still pretty high even though it's fairly similar to JS syntax. What are your recommended learning resources for getting up to speed on Reason? The only thing I am familiar with as a good resource is the Reason Town Podcast.

Tasks on roadmap for compiler

  • Are there any tasks on the roadmap currently for the compiler that can be addressed right off the bat?
  • If not are there other lona studio/swift tasks that need to be completed first?
  • Or done in tandem with work on the compiler?

Side note

I have written a realm migration generator. Which is why I am very interested in contributing to lona's compiler. Another example that I have seen of component generation is the mobile ui kit Framework7. The author wrote his own component compiler for framework7 package so that it could be used in many of the web frontend ui frameworks: http://phenomejs.org/

Reason

@509dave16 Reason can be a bit tricky, but here are a few things I found helpful:

  • I've found this VSCode plugin (https://marketplace.visualstudio.com/items?itemName=jaredly.reason-vscode) to be way more stable than the official one, so I'd recommend using it instead
  • Reason is mostly just a different syntax for OCaml, so I found going through the first couple chapters of the OCaml guide to be pretty useful http://caml.inria.fr/pub/docs/manual-ocaml/. The reason docs focus mainly on the syntax, whereas the OCaml docs actually cover how the language works
  • Lately I've been trying to stay away from both the OCaml and JS standard library. The OCaml standard library is pretty confusing and verbose in a lot of ways. I still use it for basic things like list mapping/folding but most of the time I find it hurts more than it helps. The JS standard lib is also pretty awkward to use from Reason, except for Strings. There's a new library created by the Reason team, Belt, but it's still very beta.

Tasks

There's plenty to do 😆. I think if you're most interested in the compiler we can start there. As a small task to help with getting your environment set up and learning the codebase a bit, howabout:

Add a comment to the top of every generated file:

// Generated by Lona Compiler 0.1.1

with the version number coming from the package.json. This is useful so people don't go modifying the generated files without knowing.

While working, you can test the compiled output via the :watch commands in the package.json. After you're done, run yarn snapshot and commit all the generated files. It's the same idea as a Jest snapshot test, but simpler and better-suited for our output.

Misc

Realm migration generator looks cool! There's a lot of mapping between type systems in Lona, so I think you'll find it similar in some ways. I've found this to be the most fascinating project I've ever worked on. Phenomejs looks cool too... I think eventually the Lona format could be a typed React-like syntax instead of JSON, for better mergeability.

@dabbott Awesome. Appreciate all the feedback and suggestions. Do you want to create an issue for including compiler version in the generated files? Or is this task small enough that I can just do a pull request and skip referencing an issue?

Creating an issue is a good idea! I just made this one: #264

@509dave16 were you able to get things set up OK?

@dabbott Sorry for the long intermission. I have yet to start on #264 . The reason I have taken an interest in your project and wanted to help was because I started doing React Native contract work. I just need to carve out some time to get down to business with that issue.

@509dave16 ok, let me know if you run into any issues. I'd also be happy to help you get set up if you're planning to use Lona for a RN project.