Skip to content

Commit

Permalink
Install prerelease github version if we are not on a released version…
Browse files Browse the repository at this point in the history
… of Webpacker
  • Loading branch information
dhh committed Oct 1, 2018
1 parent f5903ab commit 895d2cf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/install/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@
EOS
end

say "Installing all JavaScript dependencies"
run "yarn add @rails/webpacker"
if Webpacker::VERSION == /^[0-9]+\.[0-9]+\.[0-9]+$/
say "Installing all JavaScript dependencies [#{Webpacker::VERSION}]"
run "yarn add @rails/webpacker"
else
say "Installing all JavaScript dependencies [from prerelease rails/webpacker]"
run "yarn add https://github.com/rails/webpacker"
end

say "Installing dev server for live reloading"
run "yarn add --dev webpack-dev-server"
Expand Down

4 comments on commit 895d2cf

@javan
Copy link
Contributor

@javan javan commented on 895d2cf Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to check for this? It prevents using pre-release gem/npm pairs, like:

@dhh
Copy link
Member Author

@dhh dhh commented on 895d2cf Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a command-line switch to use a pre-release npm installation? We could also amend the regexp to do something special on "pre" versus "alpha".

@gauravtiwari
Copy link
Member

@gauravtiwari gauravtiwari commented on 895d2cf Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we could use the next tag if the version contains - alpha, beta or pre otherwise pull it from git repo.

yarn add @rails/webpacker@next

@javan
Copy link
Contributor

@javan javan commented on 895d2cf Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This condition never worked correctly because the comparison was done using == instead of =~. Fixed in 8481614.

Please sign in to comment.