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

Regression due to PR #1046 ? #1126

Closed
vcarel opened this issue Aug 8, 2018 · 7 comments
Closed

Regression due to PR #1046 ? #1126

vcarel opened this issue Aug 8, 2018 · 7 comments

Comments

@vcarel
Copy link
Contributor

vcarel commented Aug 8, 2018

Hi, the PR #1046 caused a regression on my end.

In our translations we have arrays in keys like day_names, month_names and so on. Those are for Rails and I'm pretty sure we don't use them in our react app, but they make our build crash:

14:35:31 client.1 | rake aborted!
14:35:31 client.1 | NoMethodError: undefined method `gsub' for #<Array:0x00005654df390550>
14:35:31 client.1 | /home/vianney/.rbenv/versions/2.3.6/gemsets/oneparkweb/gems/react_on_rails-11.0.10/lib/react_on_rails/locales_to_js.rb:112:in `block in flatten'
14:35:31 client.1 | /home/vianney/.rbenv/versions/2.3.6/gemsets/oneparkweb/gems/react_on_rails-11.0.10/lib/react_on_rails/locales_to_js.rb:107:in `each'
14:35:31 client.1 | /home/vianney/.rbenv/versions/2.3.6/gemsets/oneparkweb/gems/react_on_rails-11.0.10/lib/react_on_rails/locales_to_js.rb:107:in `each_with_object'
14:35:31 client.1 | /home/vianney/.rbenv/versions/2.3.6/gemsets/oneparkweb/gems/react_on_rails-11.0.10/lib/react_on_rails/locales_to_js.rb:107:in `flatten'

Don't tell me I have to split our translation files into "server only" and "server + client" ones... 😰

@vcarel
Copy link
Contributor Author

vcarel commented Aug 8, 2018

locales_to_js before:

    def flatten(translations)
      translations.each_with_object({}) do |(k, v), h|
        if v.is_a? Hash
          flatten(v).map { |hk, hv| h["#{k}.#{hk}".to_sym] = hv }
        else
          h[k] = v
        end
      end
    end

and after:

        else
          h[k] = v.gsub("%{", "{")
        end

@justin808
Copy link
Member

Please submit a pr with the appropriate tests.

@vcarel
Copy link
Contributor Author

vcarel commented Aug 9, 2018

Hi,

The unit tests don't pass on my computer:
image

Besides rake examples:gen_all (as mentionned in CONTRIBUTING.md) doesn't work as well.
image

(I did bundle install FYI)
Can you help?

I'm was on Ruby 2.5.1 and node v10.8.0.

I can do the PR anyway if you wish, but without adding unit test...

@justin808
Copy link
Member

@vcarel please try your best.

@vcarel
Copy link
Contributor Author

vcarel commented Aug 9, 2018

@justin808 My apologies if my previous message sounded rude. Is there a specific Ruby version I should install? What about node.js? Do you think I miss some development libs on my computer?

I would be happy to contribute, really, but at least I would like to do it properly, on a working setup, doing the unit tests first. It would not help you to submit a PR with untested code.

@justin808
Copy link
Member

I'd try with the latest ruby and node versions. That should work.

@vcarel
Copy link
Contributor Author

vcarel commented Aug 10, 2018

okay, I have something which almost works with Node LTS (8.x). I was on Node 10, and it's not supported by node-sass (4.5.3 -> need upgrade to ^4.8.0) - and perhaps others libs... ?

Besides I have an issue with @patrickkettner/get-cursor-position, on which node-gyp get hung quite long at every test. All in all, it takes almost 10 mins to run all the unit tests in this configuration:

$ time rake --trace -v
[...]
rake --trace -v  51,73s user 9,80s system 10% cpu 9:38,63 total

I have been notified at my side that we have pairing issues with our provider, which could explain why it's that slow. But I would recommend however to move the deps installation (bundler and yarn) out the tests. But that's not the topic of this issue.

Moreover, I confirm that rake examples:gen_all fails a missing coffee-rails error:

cd /home/vianney/src/OnePark/react_on_rails/gen-examples/examples/basic && rake webpacker:install
Could not find gem 'coffee-rails (~> 4.2)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

And after installing coffee-rails manually, it fails later:

cd /home/vianney/src/OnePark/react_on_rails/gen-examples/examples/basic && rake webpacker:install
rake aborted!
Don't know how to build task 'webpacker:install' (see --tasks)

Anyway, at the end, I have been able to pass rake run_rspec 😄

So the fix was very easy compared to the above - here it is: #1129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants