提交 8e9e9439 编写于 作者: D David Heinemeier Hansson 提交者: GitHub

Revert back to the original of using package.json in the root of the project (#28093)

上级 1d8466c3
......@@ -68,7 +68,7 @@
*DHH*
* Add Yarn support in new apps with a yarn binstub and vendor/package.json. Skippable via --skip-yarn option.
* Add Yarn support in new apps with a yarn binstub and package.json. Skippable via --skip-yarn option.
*Liceth Ovalles*, *Guillermo Iguaran*, *DHH*
......
......@@ -166,7 +166,7 @@ def vendor
empty_directory_with_keep_file "vendor"
unless options[:skip_yarn]
template "package.json", "vendor/package.json"
template "package.json"
end
end
end
......@@ -280,7 +280,7 @@ def create_vendor_files
build(:vendor)
if options[:skip_yarn]
remove_file "vendor/package.json"
remove_file "package.json"
end
end
......
VENDOR_PATH = File.expand_path('../vendor', __dir__)
VENDOR_PATH = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do
begin
exec "yarnpkg #{ARGV.join(" ")}"
......
......@@ -7,7 +7,7 @@ Rails.application.config.assets.version = '1.0'
# Rails.application.config.assets.paths << Emoji.images_path
<%- unless options[:skip_yarn] -%>
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('vendor/node_modules')
Rails.application.config.assets.paths << Rails.root.join('node_modules')
<%- end -%>
# Precompile additional assets.
......
......@@ -22,8 +22,8 @@
<% end -%>
<% unless options[:skip_yarn] -%>
/vendor/node_modules
/vendor/yarn-error.log
/node_modules
/yarn-error.log
<% end -%>
.byebug_history
......@@ -117,7 +117,7 @@ def skipped_files
public/apple-touch-icon-precomposed.png
public/apple-touch-icon.png
public/favicon.icon
vendor/package.json
package.json
)
end
end
......@@ -422,7 +422,7 @@ def test_generator_if_skip_sprockets_is_given
def test_generator_if_skip_yarn_is_given
run_generator [destination_root, "--skip-yarn"]
assert_no_file "vendor/package.json"
assert_no_file "package.json"
assert_no_file "bin/yarn"
end
......@@ -497,21 +497,21 @@ def test_coffeescript_is_skipped_if_required
def test_generator_for_yarn
run_generator([destination_root])
assert_file "vendor/package.json", /dependencies/
assert_file "package.json", /dependencies/
assert_file "config/initializers/assets.rb", /node_modules/
end
def test_generator_for_yarn_skipped
run_generator([destination_root, "--skip-yarn"])
assert_no_file "vendor/package.json"
assert_no_file "package.json"
assert_file "config/initializers/assets.rb" do |content|
assert_no_match(/node_modules/, content)
end
assert_file ".gitignore" do |content|
assert_no_match(/vendor\/node_modules/, content)
assert_no_match(/vendor\/yarn-error\.log/, content)
assert_no_match(/node_modules/, content)
assert_no_match(/yarn-error\.log/, content)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册