mirror of https://github.com/rails/rails
Uncomment bin/yarn in bin/setup for webpacker by default
By adding installing of webpacker, `bin/setup` requires manual update in order to do cold setup. This adds extra steps to generate app and setup it.
This commit is contained in:
parent
0979a16a19
commit
133805f1f9
|
@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do
|
|||
<% unless options.skip_javascript? -%>
|
||||
|
||||
# Install JavaScript dependencies
|
||||
# system('bin/yarn')
|
||||
system! 'bin/yarn'
|
||||
<% end -%>
|
||||
<% unless options.skip_active_record? -%>
|
||||
|
||||
|
|
|
@ -41,12 +41,20 @@ module ApplicationTests
|
|||
output.sub!(/^Resolving dependencies\.\.\.\n/, "")
|
||||
# Suppress Bundler platform warnings from output
|
||||
output.gsub!(/^The dependency .* will be unused .*\.\n/, "")
|
||||
# Ignores dynamic data by yarn
|
||||
output.sub!(/^yarn install v.*?$/, "yarn install")
|
||||
output.sub!(/^\[.*?\] Resolving packages\.\.\.$/, "[1/4] Resolving packages...")
|
||||
output.sub!(/^Done in \d+\.\d+s\.\n/, "Done in 0.00s.\n")
|
||||
# Ignore warnings such as `Psych.safe_load is deprecated`
|
||||
output.gsub!(/^warning:\s.*\n/, "")
|
||||
|
||||
assert_equal(<<~OUTPUT, output)
|
||||
== Installing dependencies ==
|
||||
The Gemfile's dependencies are satisfied
|
||||
yarn install
|
||||
[1/4] Resolving packages...
|
||||
success Already up-to-date.
|
||||
Done in 0.00s.
|
||||
|
||||
== Preparing database ==
|
||||
Created database 'app_development'
|
||||
|
|
|
@ -295,6 +295,17 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_adds_bin_yarn_into_setup_script
|
||||
run_generator
|
||||
|
||||
assert_file "bin/yarn"
|
||||
|
||||
assert_file "bin/setup" do |content|
|
||||
# Does not comment yarn install
|
||||
assert_match(/(?=[^#]*?) system! 'bin\/yarn'/, content)
|
||||
end
|
||||
end
|
||||
|
||||
def test_app_update_does_not_generate_yarn_contents_when_bin_yarn_is_not_used
|
||||
app_root = File.join(destination_root, "myapp")
|
||||
run_generator [app_root, "--skip-javascript"]
|
||||
|
@ -307,7 +318,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
assert_no_file "#{app_root}/bin/yarn"
|
||||
|
||||
assert_file "#{app_root}/bin/setup" do |content|
|
||||
assert_no_match(/system\('bin\/yarn'\)/, content)
|
||||
assert_no_match(/system! 'bin\/yarn'/, content)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue