Add backward compatibility#252
Conversation
241c00f to
df64a02
Compare
|
Otherwise LGTM |
b34a1f6 to
22a9a63
Compare
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| ruby: ['2.6', '2.7', '3.0'] |
There was a problem hiding this comment.
If you are okay with updating our test environment in this PR, I can do it. But also we can do it in a separate PR.
My proposal:
Ruby:
- ruby: ['2.6', '2.7', '3.0']
+ ruby: ['2.7', '3.0', '3.2']Node:
- node: [12.x, 14.x, 16.x]
+ node: [14.x, 16.x, 18.x]There was a problem hiding this comment.
@justin808
What about this?
Maybe better to discuss this for v7.
| @@ -0,0 +1,24 @@ | |||
| require_relative "test_app/config/environment" | |||
There was a problem hiding this comment.
name needs to be more descriptive, maybe with some comments at the beginning of this file
why is this code separate from spec_helper.rb?
There was a problem hiding this comment.
Could we run this code with a before_each? this file got required in many different files.
There was a problem hiding this comment.
I am afraid we can do this unless we want to initialize a new Rails.application for each single test case, which is expensive.
This would be a temporary implementation till Version 7. From version 7 and dropping backward compatibility, we go back to what we used to be.
I agree about the filename. The file initializes a Rails application and sets Shakapacker or Webpacker configuration. Maybe app_initializer would be a better name. I am afraid if I give it such a name and leave the file in the same directory as other spec files, we cannot recognize it easily. Maybe put it in a helper directory? Not sure of the best approach.
4dde39b to
255c291
Compare
2776578 to
60ccf1c
Compare
a197740 to
2b9440e
Compare
|
Ready? |
756e056 to
4cc8b9f
Compare
2b9440e to
d4fc297
Compare
|
|
||
| def get_config_file_path_with_backward_compatibility(config_path) | ||
| if config_path.to_s.end_with?("shakapacker.yml") && !File.exist?(config_path) | ||
| webpacker_config_path = if config_path.class == Pathname |
There was a problem hiding this comment.
Rubocop forces me to use such indentation. We have this rule:
Use 2 (not 26) spaces for indentation.
(convention:Layout/IndentationWidth)
09d3ee7 to
80636f6
Compare
8a3a0b6 to
fca217a
Compare
|
|
||
| # For backward compatibility | ||
| Shakapacker.set_shakapacker_env_variables_for_backward_compatibility | ||
| @config_path = Pathname.new(ENV["SHAKAPACKER_CONFIG"] || config_path) |
There was a problem hiding this comment.
was this done somewhere else in a prior PR?
There was a problem hiding this comment.
Which line?
If 17, no.
For line no.18, I found it challenging to set config path from env when we do it in Instance class. This way, I let the configuration class make the final decision about the config path.
Perhaps it was better to do it in the renaming PR. Yet, this is just internal change.
* Use Shakapacker module, config filesm, and env variables * Rename rake files to shakapacker * Update JS code and tests * Fix conflict * Update Readme and contribution guide for shakapacker * Remove debug lines * Fix linter issue * Use Shakapacker module, config filesm, and env variables * Add support for old configfile * Add rake tasks * Add files to support requiring Webpacker module * Add backward compatibility test * Add rake task for backward compatibility test * Add CI for backward compatibility specs * Add backward compatibility to JS package * Add backward compatibility for --debug-shakapacker option * Fix chdir in afterAll hook in js tests * Fix js tests for compiling files in source_path * Use symlink address for config file * Use fs.existsSync to check if file exist * Remove a redundant assignment * Improve deprecation messages * Improve gitignore in test apps * Improve deprecation message for env variables * Update documentation * Show deprecation message for old binstubs * Update changelog * Add and improve test for custom config path in env variable * Improve robustness in config.fetch method * Update docs * Update deprecation message * Simplify config.fetch method * Remove lines releated to git conflict * Improve the order of code * Add v7 upgrade guide link to changelog
* Rename Webpacker instances to shakapacker (#245) * Add backward compatibility (#252) * Update docs for spelling change (#263) * Fix backward compatibility for setting WEBPACKER_CONFIG in webpack.config.js (#266) * Remove redundant code for enhancing precompile task (#270) * Update webpack dev server configuration (#276) * Stop stripping top level dirs (#283) * Improve source_entry_path robustness (#284) --------- Co-authored-by: Tom Dracz <[email protected]>
config/shakapacker.yml)shakapacker_precompileentry in the config file--debug-shakapackeroption (Without test)config/webpacker.ymlin Ruby./bin/webapckerWEBPACKER_XYZenvironment variables--debug-webpackeroptionSome points: