Skip to content

Add class_path to allow generated components to reside in subdirectories #890

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

Merged
merged 2 commits into from
Apr 16, 2018

Conversation

matt-potter
Copy link
Contributor

Summary

Although the documentation references rendering components from sub-directories, the generator only allows generation of components in the components/ directory. This PR adds class_path into the generated path, allowing use such as:

➜ rails g react:component frontend/my_component
Running via Spring preloader in process 45812
      create  app/javascript/components/frontend/MyComponent.js

@BookOfGreg
Copy link
Member

Good idea @matt-potter , thanks for the contribution!
It looks good. I'll take a look into why the tests are failing, seems to be capybara suddenly upset in a totally different section of code.

Could you look into adding(or modifying) one test around this area for the new functionality please?
https://github.com/reactjs/react-rails/blob/master/test/generators/component_generator_test.rb#L5

@matt-potter
Copy link
Contributor Author

sure, will do! yep, didn't think the CI was anything related.

@matt-potter
Copy link
Contributor Author

Hi @BookOfGreg, I've added a test and updated the readme

@BookOfGreg
Copy link
Member

Lovely, that looks good. I'll fixup whatever is going on with CI and get it shipped. Hopefully within the week if I get time at work.

@matt-potter
Copy link
Contributor Author

Great, thanks @BookOfGreg !

@BookOfGreg BookOfGreg self-assigned this Apr 15, 2018
@BookOfGreg
Copy link
Member

Looks like it was a combo of chromedriver + general ruby updates making master broken but that's close to fixed now.

Thanks again for contributing, hope you stop by to help again 😁

@BookOfGreg BookOfGreg merged commit 1fb7012 into reactjs:master Apr 16, 2018
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.

2 participants