node@6: update npm to 5.0.1

This commit is contained in:
Dominyk Tiller 2017-06-01 04:44:34 +01:00 committed by ilovezfs
parent ecb2d1e855
commit 13c32d5aed

View file

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