Skip to content

Commit

Permalink
Specify exact version in generator
Browse files Browse the repository at this point in the history
If the React on Rails version is standard, then that version is used
to specify the npm package to load.

If the React on Rails version is a beta version, then no version is
specified.
  • Loading branch information
justin808 committed Nov 11, 2020
1 parent 2710d54 commit 042023c
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 042023c

Please sign in to comment.