Skip to content

Commit bb132d5

Browse files
afcapelgauravtiwari
authored andcommitted
Run yarn check --verify-tree as part of the yarn integrity check (#1774)
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/
1 parent c270e75 commit bb132d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/webpacker/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ class Webpacker::Engine < ::Rails::Engine
3030
# - add `config.webpacker.check_yarn_integrity = true`
3131
initializer "webpacker.yarn_check" do |app|
3232
if File.exist?("yarn.lock") && Webpacker.config.config_path.exist? && Webpacker.config.check_yarn_integrity?
33-
output = `yarn check --integrity 2>&1`
33+
output = `yarn check --integrity && yarn check --verify-tree 2>&1`
3434

3535
unless $?.success?
3636
$stderr.puts "\n\n"
3737
$stderr.puts "========================================"
3838
$stderr.puts " Your Yarn packages are out of date!"
39-
$stderr.puts " Please run `yarn install` to update."
39+
$stderr.puts " Please run `yarn install --check-files` to update."
4040
$stderr.puts "========================================"
4141
$stderr.puts "\n\n"
4242
$stderr.puts "To disable this check, please change `check_yarn_integrity`"

0 commit comments

Comments
 (0)