-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
Prevent Shakapacker v7 deprecation messages #1592
Prevent Shakapacker v7 deprecation messages #1592
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be any test?
lib/react_on_rails/configuration.rb
Outdated
@@ -266,6 +266,14 @@ def raise_missing_components_subdirectory | |||
|
|||
raise ReactOnRails::Error, msg | |||
end | |||
|
|||
def shakapacker_precompile? | |||
config = Webpacker.config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, won't Webpacker be unavailable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
But still, we need to provide support for the old spelling.
As soon as we force the upgrade to Shakapacker 7+, we need to have support for webpacker spelling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, we release an update to Shakapacker.
Somebody has not yet updated React on Rails.
config = Webpacker.config
crashes.
Check that the constant Webpacker
exists before calling it.
Other code spots might have the same issue. Check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix this issue in another dedicated PR.
I think at some point, we should drop support Shakapacker 6. I think it is important to push projects to move to use the new API for shakapacker and version 7 was the transitional version for that migration.
546982c
to
b4a324e
Compare
Please fix conflicts and see my comments. |
@ahangarha please finish up so I can merge. |
913b63b
to
dbbc7ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in #1598. Otherwise this is OK.
ad2422f
to
2d91229
Compare
2d91229
to
cfcc3e1
Compare
cfcc3e1
to
19762e4
Compare
def shakapacker_precompile? | ||
return Webpacker.config.webpacker_precompile? if ReactOnRails::WebpackerUtils.using_shakapacker_6? | ||
|
||
Webpacker.config.shakapacker_precompile? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahangarha @Judahmeek should this be
Shakapacker.config.shakapacker_precompile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this when we drop support for Webpacker/Shakapacker 6.
This way, we still know we are supporting the old interface. Otherwise, changing the name is not a big issue and can be done in a separate PR.
def self.using_shakapacker_6? | ||
shakapacker_major_version = shakapacker_version_as_array[0] | ||
|
||
shakapacker_major_version == 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shakapacker_version[:major] == 6
isn't that nicer? you can change the shakapacker_version method very easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if it is okay to modify that method, your suggestion is much much better.
Can we be sure that nobody uses that method?
@@ -25,16 +25,16 @@ | |||
|
|||
it "changes package.json to use local react-on-rails version of module" do | |||
assert_file("package.json") do |contents| | |||
assert_match('"react-on-rails"', contents) | |||
assert_match('"postinstall"', contents) | |||
expect(contents).to match('"react-on-rails"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, such changes are in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. But it was needed to pass Rubocop.
Summary
This PR prevents displaying the Shakapcker 7+ deprecation message for:
webpacker_precompile?
webpacker:clean
rake taskPull Request checklist
Update documentationThis change is