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

Generator raises error when application.js is not found #78

Closed
rupurt opened this issue Nov 5, 2015 · 10 comments
Closed

Generator raises error when application.js is not found #78

rupurt opened this issue Nov 5, 2015 · 10 comments

Comments

@rupurt
Copy link
Contributor

rupurt commented Nov 5, 2015

We currently have our application split up into multiple smaller applications so don't use the main application.js file. It would nice if the generator allowed you to specify the name of the manifest file e.g.

rails generate react_on_rails:install -m my_cool_app
@justin808
Copy link
Member

@rupurt As a workaround, just create an empty file right now.

If you could submit a PR for your enhancement, we'd take it!

@rupurt
Copy link
Contributor Author

rupurt commented Nov 5, 2015

@justin808 that's what I did 😄

I'll see if I have some time to take a stab at it over the weekend.

@robwise
Copy link
Contributor

robwise commented Nov 5, 2015

@rupurt That would be awesome! Definitely take a look at the lib/generators/react_on_rails/base_generator.rb file, as I believe this may be the right place for this logic. We could also try putting this logic inside of the config/initializers/react_on_rails.rb initializer, although I'm not sure if that work and/or maybe that's not a solution for your specific scenario.

@yorzi
Copy link
Contributor

yorzi commented Nov 6, 2015

Generator raises error when application.css.scss is not found as well (in our case we use application.scss), I think it's a similar issue. It might be good to be able to config these files in initializer.

@robwise
Copy link
Contributor

robwise commented Nov 6, 2015

@yorzi I would say this issue is an enhancement, whereas yours is closer to a bug. I have therefore made a separate issue: #86

@yorzi
Copy link
Contributor

yorzi commented Nov 6, 2015

@robwise 👍 I can look into that today.

@justin808
Copy link
Member

@yorzi Would be awesome if you can submit a PR to fix the missing files!

@justin808
Copy link
Member

@robwise Can we close this one?

@robwise
Copy link
Contributor

robwise commented Nov 19, 2015

@justin808 negative, I fixed a different issue that was with the application.scss, not js. This issue will still occur. I can come up with a fix if you want.

  1. We can allow passing an argument to specify a different file than application.js
  2. We can simply create an application.js file if it is missing

The latter solution would not actually really fix @rupurt's problem, though, but it would at least let the generator run through completion by default instead of essentially forcing him to figure out that he needs to make his own application.js file, run the generator, and then move the code manually to where he wants it.

@justin808
Copy link
Member

@robwise I vote for 2) with a warning as the user will see the diff and can take appropriate action.

robwise added a commit that referenced this issue Nov 20, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it.
robwise added a commit that referenced this issue Nov 20, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it.
robwise added a commit that referenced this issue Nov 23, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it.
robwise added a commit that referenced this issue Nov 23, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it. Note that we don't generate a turbolinks
sprockets requirement if we create the file for the user since
this is not really related to implementing React on Rails.
Users should add this manually if they want turbolinks.
robwise added a commit that referenced this issue Nov 23, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it. Note that we don't generate a turbolinks
sprockets requirement if we create the file for the user since
this is not really related to implementing React on Rails.
Users should add this manually if they want turbolinks.
robwise added a commit that referenced this issue Nov 23, 2015
Fixes #78
Generator used to put a setup error message when it did not find
application.js. Now, it will simply just create one with the
necessary data in it. Note that we don't generate a turbolinks
sprockets requirement if we create the file for the user since
this is not really related to implementing React on Rails.
Users should add this manually if they want turbolinks.
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

4 participants