These are chat archives for chandu0101/scalajs-react-components

Jun 2017
Roberto Leibman
Jun 13 2017 04:49
I'll take a look tomorrow. I added the flags because I recently read an article on recommended flags, but I'm happy to see them go if I can make the compiler move.
Roberto Leibman
Jun 13 2017 17:24
I've been fighting sbt too! Argh. If I try to do everything in the core project then compile just hangs... My intuition tells me that there's a circular dependency, something like: generateMui depends on npmUpdate, npmUpdate depends on compile and compile depends on generateMui. inspect tree compile doesn't show that.
So I'm thinking that the npmUpdate needs to happen on the gen project (or in a different project if you want to keep the gen project cleaner). From the point of view of sbt-bundler, I see what they're trying to do, you only bundle after you've compiled all your code, but we're using the npmUpdate task for a different purpose.
Roberto Leibman
Jun 13 2017 18:04
OK... got something!
I just checked in my latest working stuff, please take a look. The core project now compiles. There were many errors with the SemanticUI stuff, mostly because of missing type mappings in the Sui generators, so I commented that out for now.
And yes, removing most of the flags significantly improves the build time.
Roberto Leibman
Jun 13 2017 22:59
@oyvindberg I'm trying to generate the rest of the elemental ui components.
Though some of them are coded just like the material ui components, most are not. Instead of declaring a variable and then exporting it, the typical component looks like this:
'use strict';

var blacklist = require('blacklist');
var classnames = require('classnames');
var React = require('react');

module.exports = React.createClass({
    displayName: 'Form',
    propTypes: {
        children: React.PropTypes.node.isRequired,
        className: React.PropTypes.string,
        component: React.PropTypes.oneOfType([React.PropTypes.element, React.PropTypes.string]),
        type: React.PropTypes.oneOf(['basic', 'horizontal', 'inline'])
    getDefaultProps: function getDefaultProps() {
        return {
            component: 'form',
            type: 'basic'
    render: function render() {
        var props = blacklist(this.props, 'children', 'type', 'component');
        props.className = classnames('Form', 'Form--' + this.props.type, this.props.className);

        return React.createElement(this.props.component, props, this.props.children);
So I've been trying to hack at it trying to figure out the parsing code. The closest I was able to come up with is to add the following to Visitor Components:
      case a: AccessNode if a.getProperty == "exports" =>
        bn.rhs match {
          case right: CallNode =>
            right.getArgs.asScala.collect {
              case o: ObjectNode =>
                o.getElements.asScala.collect {
                  case a: PropertyNode if a.getKeyName == "displayName" =>
                    val name = a.getValue.asInstanceOf[LiteralNode[String]].getValue
                    ret(CompName(name)) = o
And it almost worked, I managed to get the component, but then the parsing that follows (in Require.scala) doesn't behave as I expect.
Any help would be appreciated :)