diff --git a/Formula/node@6.rb b/Formula/node@6.rb index 73da400dcf..c5782c4575 100644 --- a/Formula/node@6.rb +++ b/Formula/node@6.rb @@ -3,6 +3,8 @@ class NodeAT6 < Formula homepage "https://nodejs.org/" url "https://nodejs.org/dist/v6.10.3/node-v6.10.3.tar.xz" sha256 "82262a703e61164e09170a14d88b1726720651b0c7ee87a277654247b21b5388" + revision 1 + head "https://github.com/nodejs/node.git", :branch => "v6.x-staging" bottle do @@ -33,8 +35,8 @@ class NodeAT6 < Formula # Keep in sync with main node formula resource "npm" do - url "https://registry.npmjs.org/npm/-/npm-4.2.0.tgz" - sha256 "bb9883f1581fd10854a8b6917ae1279f691a8d89e81a0cbea77b614dbcd53f5a" + url "https://registry.npmjs.org/npm/-/npm-5.0.1.tgz" + sha256 "cc31b845140791a85ab607636c6f0108346f8eb6cad7971919fd01ff4f4a1d7a" end resource "icu4c" do @@ -60,31 +62,20 @@ class NodeAT6 < Formula system "make", "install" if build.with? "npm" - resource("npm").stage buildpath/"npm_install" - - # make sure npm can find node + # Allow npm to find Node before installation has completed. ENV.prepend_path "PATH", bin - # set log level temporarily for npm's `make install` - ENV["NPM_CONFIG_LOGLEVEL"] = "verbose" - # unset prefix temporarily for npm's `make install` - ENV.delete "NPM_CONFIG_PREFIX" - cd buildpath/"npm_install" do - system "./configure", "--prefix=#{libexec}/npm" - system "make", "install" - # `package.json` has relative paths to the npm_install directory. - # This copies back over the vanilla `package.json` that is expected. - # https://github.com/Homebrew/legacy-homebrew/issues/46131#issuecomment-157845008 - cp buildpath/"npm_install/package.json", libexec/"npm/lib/node_modules/npm" - # Remove manpage symlinks from the buildpath, they are breaking bottle - # creation. The real manpages are living in libexec/npm/lib/node_modules/npm/man/ - # https://github.com/Homebrew/legacy-homebrew/pull/47081#issuecomment-165280470 - rm_rf libexec/"npm/share/" - end + bootstrap = buildpath/"npm_bootstrap" + bootstrap.install resource("npm") + system "node", bootstrap/"bin/npm-cli.js", "install", + "--verbose", "--global", "--prefix=#{libexec}", + resource("npm").cached_download + # These symlinks are never used & they've caused issues in the past. + rm_rf libexec/"share" if build.with? "completion" bash_completion.install \ - buildpath/"npm_install/lib/utils/completion.sh" => "npm" + bootstrap/"lib/utils/completion.sh" => "npm" end end end @@ -98,13 +89,13 @@ class NodeAT6 < Formula # Kill npm but preserve all other modules across node updates/upgrades. rm_rf node_modules/"npm" - cp_r libexec/"npm/lib/node_modules/npm", node_modules + cp_r libexec/"lib/node_modules/npm", node_modules # This symlink doesn't hop into homebrew_prefix/bin automatically so - # remove it and make our own. This is a small consequence of our bottle - # npm make install workaround. All other installs **do** symlink to - # homebrew_prefix/bin correctly. We ln rather than cp this because doing - # so mimics npm's normal install. - ln_sf npm_exec, "#{HOMEBREW_PREFIX}/bin/npm" + # we make our own. This is a small consequence of our + # bottle-npm-and-retain-a-private-copy-in-libexec setup + # All other installs **do** symlink to homebrew_prefix/bin correctly. + # We ln rather than cp this because doing so mimics npm's normal install. + ln_sf npm_exec, HOMEBREW_PREFIX/"bin/npm" # Let's do the manpage dance. It's just a jump to the left. # And then a step to the right, with your hand on rm_f. @@ -112,7 +103,7 @@ class NodeAT6 < Formula # Dirs must exist first: https://github.com/Homebrew/legacy-homebrew/issues/35969 mkdir_p HOMEBREW_PREFIX/"share/man/#{man}" rm_f Dir[HOMEBREW_PREFIX/"share/man/#{man}/{npm.,npm-,npmrc.,package.json.}*"] - ln_sf Dir[libexec/"npm/lib/node_modules/npm/man/#{man}/{npm,package.json}*"], HOMEBREW_PREFIX/"share/man/#{man}" + ln_sf Dir[libexec/"lib/node_modules/npm/man/#{man}/{npm,package.json}*"], HOMEBREW_PREFIX/"share/man/#{man}" end npm_root = node_modules/"npm"