Package: rails / 2:6.0.3.7+dfsg-2

use-system-yarnpkg.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Description: Use system yarnpkg instead of yarn
 In Debian, yarn is packaged as "yarnpkg".
 .
 This patch will replace all the "bin/yarn" usages to "bin/yarnpkg".
Author: Jongmin Kim <jmkim@pukyong.ac.kr>
Forwarded: no
Last-Update: 2019-06-21
--- a/railties/lib/rails/app_updater.rb
+++ b/railties/lib/rails/app_updater.rb
@@ -21,7 +21,7 @@
       private
         def generator_options
           options = { api: !!Rails.application.config.api_only, update: true }
-          options[:skip_javascript] = !File.exist?(Rails.root.join("bin", "yarn"))
+          options[:skip_javascript] = !File.exist?(Rails.root.join("bin", "yarnpkg"))
           options[:skip_active_record]  = !defined?(ActiveRecord::Railtie)
           options[:skip_active_storage] = !defined?(ActiveStorage::Engine) || !defined?(ActiveRecord::Railtie)
           options[:skip_action_mailer]  = !defined?(ActionMailer::Railtie)
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -96,7 +96,7 @@
       bin
 
       if options[:skip_javascript]
-        remove_file "bin/yarn"
+        remove_file "bin/yarnpkg"
       end
     end
 
@@ -474,7 +474,7 @@
       end
 
       def delete_bin_yarn
-        remove_file "bin/yarn" if options[:skip_javascript]
+        remove_file "bin/yarnpkg" if options[:skip_javascript]
       end
 
       def finish_template
--- a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt
+++ b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt
@@ -18,7 +18,7 @@
 <% unless options.skip_javascript? -%>
 
   # Install JavaScript dependencies
-  # system('bin/yarn')
+  # system('bin/yarnpkg')
 <% end -%>
 <% unless options.skip_active_record? -%>
 
--- a/railties/lib/rails/tasks/yarn.rake
+++ b/railties/lib/rails/tasks/yarn.rake
@@ -8,7 +8,7 @@
     node_env = ENV.fetch("NODE_ENV") do
       valid_node_envs.include?(Rails.env) ? Rails.env : "production"
     end
-    system({ "NODE_ENV" => node_env }, "#{Rails.root}/bin/yarn install --no-progress --frozen-lockfile")
+    system({ "NODE_ENV" => node_env }, "#{Rails.root}/bin/yarnpkg install --no-progress --frozen-lockfile")
   end
 end
 
--- a/railties/test/generators/api_app_generator_test.rb
+++ b/railties/test/generators/api_app_generator_test.rb
@@ -105,7 +105,7 @@
       { api: true, update: true }, { destination_root: destination_root, shell: @shell }
     quietly { generator.send(:update_bin_files) }
 
-    assert_no_file "bin/yarn"
+    assert_no_file "bin/yarnpkg"
   end
 
   private
@@ -167,7 +167,7 @@
       %w(app/assets
          app/helpers
          app/views/layouts/application.html.erb
-         bin/yarn
+         bin/yarnpkg
          config/initializers/assets.rb
          config/initializers/cookies_serializer.rb
          config/initializers/content_security_policy.rb
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -41,7 +41,7 @@
   bin/rails
   bin/rake
   bin/setup
-  bin/yarn
+  /bin/yarnpkg
   config/application.rb
   config/boot.rb
   config/cable.yml
@@ -315,10 +315,10 @@
       generator.send(:app_const)
       quietly { generator.send(:update_bin_files) }
 
-      assert_no_file "#{app_root}/bin/yarn"
+      assert_no_file "#{app_root}/bin/yarnpkg"
 
       assert_file "#{app_root}/bin/setup" do |content|
-        assert_no_match(/system\('bin\/yarn'\)/, content)
+        assert_no_match(/system\('bin\/yarnpkg'\)/, content)
       end
     end
   end
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -342,14 +342,13 @@
     skip "#34009 disabled JS by default for plugins" if generator_class.name == "Rails::Generators::PluginGenerator"
     run_generator
     assert_file "#{application_path}/package.json", /dependencies/
-    assert_file "#{application_path}/bin/yarn"
+    assert_file "/bin/yarnpkg"
     assert_file "#{application_path}/config/initializers/assets.rb", /node_modules/
   end
 
   def test_generator_for_yarn_skipped
     run_generator([destination_root, "--skip-javascript"])
     assert_no_file "#{application_path}/package.json"
-    assert_no_file "#{application_path}/bin/yarn"
 
     assert_file "#{application_path}/config/initializers/assets.rb" do |content|
       assert_no_match(/node_modules/, content)
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -518,14 +518,14 @@
 
   unless File.exist?("#{RAILS_FRAMEWORK_ROOT}/actionview/lib/assets/compiled/rails-ujs.js")
     Dir.chdir("#{RAILS_FRAMEWORK_ROOT}/actionview") do
-      sh "yarn build"
+      sh "yarnpkg build"
     end
   end
 
   assets_path = "#{RAILS_FRAMEWORK_ROOT}/railties/test/isolation/assets"
   unless Dir.exist?("#{assets_path}/node_modules")
     Dir.chdir(assets_path) do
-      sh "yarn install"
+      sh "yarnpkg install"
     end
   end