Skip to content

Commit

Permalink
Specify exact version of npm package in generator
Browse files Browse the repository at this point in the history
Otherwise npm is using the latest version, which might be the matching version
if a patch was put on a prior release.
  • Loading branch information
justin808 committed Nov 14, 2020
1 parent c94b392 commit a00c575
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ def add_base_gems_to_gemfile
end

def add_yarn_dependencies
run "yarn add react-on-rails --exact"
major_minor_patch_only = /\A\d+\.\d+\.\d+\z/.freeze
if ReactOnRails::VERSION.match?(major_minor_patch_only)
run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact"
else
# otherwise add latest
puts "Adding the lastest react-on-rails NPM module. Double check this is correct in package.json"
run "yarn add react-on-rails --exact"
end
end

def append_to_spec_rails_helper
Expand Down

0 comments on commit a00c575

Please sign in to comment.