Skip to content

Commit

Permalink
Run yarn check --verify-tree as part of the yarn integrity check (#1774)
Browse files Browse the repository at this point in the history
From the yarn documentation[1]:

`yarn check --integrity` checks that versions and hashed
values of the package contents in the project’s package.json
match those in yarn’s lock file.

That doesn't actually check that the packages are actually
installed in node_modules. To check that we need to run
`yarn check --verify-tree`

[1]: https://yarnpkg.com/lang/en/docs/cli/check/
  • Loading branch information
afcapel authored and gauravtiwari committed Oct 26, 2018
1 parent c270e75 commit bb132d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/webpacker/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class Webpacker::Engine < ::Rails::Engine
# - add `config.webpacker.check_yarn_integrity = true`
initializer "webpacker.yarn_check" do |app|
if File.exist?("yarn.lock") && Webpacker.config.config_path.exist? && Webpacker.config.check_yarn_integrity?
output = `yarn check --integrity 2>&1`
output = `yarn check --integrity && yarn check --verify-tree 2>&1`

unless $?.success?
$stderr.puts "\n\n"
$stderr.puts "========================================"
$stderr.puts " Your Yarn packages are out of date!"
$stderr.puts " Please run `yarn install` to update."
$stderr.puts " Please run `yarn install --check-files` to update."
$stderr.puts "========================================"
$stderr.puts "\n\n"
$stderr.puts "To disable this check, please change `check_yarn_integrity`"
Expand Down

0 comments on commit bb132d5

Please sign in to comment.