From 4e279b4b80252266d3a938a5da43aa7c3a5103b3 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 08:53:59 -0500 Subject: [PATCH 01/13] Creating formula for Node14 --- Formula/node@14.rb | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Formula/node@14.rb diff --git a/Formula/node@14.rb b/Formula/node@14.rb new file mode 100644 index 0000000000000..95836f30f4810 --- /dev/null +++ b/Formula/node@14.rb @@ -0,0 +1,64 @@ +class NodeAT14 < Formula + desc "Platform built on V8 to build network applications" + homepage "https://nodejs.org/" + url "https://nodejs.org/dist/v14.14.0/node-v14.14.0.tar.gz" + sha256 "afb0b401d62d9fcfc68258f50d0bf042998d349ce9c1d7a2d45dd87870b3aab7" + license "MIT" + revision 1 + + livecheck do + url "https://nodejs.org/dist/" + regex(%r{href=["']?v?(12(?:\.\d+)+)/?["' >]}i) + end + + bottle do + cellar :any + sha256 "daa9494f82ba99556e6a1ad9e230ec02c10e37eb1e41c67da699b886c9e2fc25" => :catalina + sha256 "869917c95932d812c51cd45c5c77e9faadd9d94fbfc8b3858dea32659b9436f7" => :mojave + sha256 "521f230437a6dcc79336dccfa12fb15f26286d6208a1384c9cd9517a6da09a60" => :high_sierra + end + + keg_only :versioned_formula + + depends_on "pkg-config" => :build + depends_on "python@3.9" => :build + depends_on "icu4c" + + def install + # make sure subprocesses spawned by make are using our Python 3 + ENV["PYTHON"] = Formula["python@3.9"].opt_bin/"python3" + + system "python3", "configure.py", "--prefix=#{prefix}", "--with-intl=system-icu" + system "make", "install" + end + + def post_install + (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + end + + test do + path = testpath/"test.js" + path.write "console.log('hello');" + + output = shell_output("#{bin}/node #{path}").strip + assert_equal "hello", output + output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"en-EN\").format(1234.56))'").strip + assert_equal "1,234.56", output + + output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"de-DE\").format(1234.56))'").strip + assert_equal "1.234,56", output + + # make sure npm can find node + ENV.prepend_path "PATH", opt_bin + ENV.delete "NVM_NODEJS_ORG_MIRROR" + assert_equal which("node"), opt_bin/"node" + assert_predicate bin/"npm", :exist?, "npm must exist" + assert_predicate bin/"npm", :executable?, "npm must be executable" + npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] + system "#{bin}/npm", *npm_args, "install", "npm@latest" + system "#{bin}/npm", *npm_args, "install", "bufferutil" + assert_predicate bin/"npx", :exist?, "npx must exist" + assert_predicate bin/"npx", :executable?, "npx must be executable" + assert_match "< hello >", shell_output("#{bin}/npx cowsay hello") + end +end From e0ff1ac970f1329631818018680d023bdad952a7 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 09:07:31 -0500 Subject: [PATCH 02/13] Switching to metadata from last V14 commit --- Formula/node@14.rb | 85 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 95836f30f4810..8c65607c4b1c5 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -4,36 +4,89 @@ class NodeAT14 < Formula url "https://nodejs.org/dist/v14.14.0/node-v14.14.0.tar.gz" sha256 "afb0b401d62d9fcfc68258f50d0bf042998d349ce9c1d7a2d45dd87870b3aab7" license "MIT" - revision 1 + head "https://github.com/nodejs/node.git" livecheck do url "https://nodejs.org/dist/" - regex(%r{href=["']?v?(12(?:\.\d+)+)/?["' >]}i) + regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i) end bottle do cellar :any - sha256 "daa9494f82ba99556e6a1ad9e230ec02c10e37eb1e41c67da699b886c9e2fc25" => :catalina - sha256 "869917c95932d812c51cd45c5c77e9faadd9d94fbfc8b3858dea32659b9436f7" => :mojave - sha256 "521f230437a6dcc79336dccfa12fb15f26286d6208a1384c9cd9517a6da09a60" => :high_sierra + sha256 "f1be3b305c38cc1a71cc089ec1f2983fa6b796f568aac3a6e4c93d79dc87661b" => :catalina + sha256 "ff29457f90b4dbf7164a3c8e1204321d3e37e33697006cab136b3e21a238fd02" => :mojave + sha256 "42b51e14448f7c4548effecd6f3f4c943785e122096b59ad8d4cb0b5c974faae" => :high_sierra end - keg_only :versioned_formula - depends_on "pkg-config" => :build depends_on "python@3.9" => :build depends_on "icu4c" + # We track major/minor from upstream Node releases. + # We will accept *important* npm patch releases when necessary. + resource "npm" do + url "https://registry.npmjs.org/npm/-/npm-6.14.8.tgz" + sha256 "fe8e873cb606c06f67f666b4725eb9122c8927f677c8c0baf1477f0ff81f5a2c" + end + def install # make sure subprocesses spawned by make are using our Python 3 ENV["PYTHON"] = Formula["python@3.9"].opt_bin/"python3" - system "python3", "configure.py", "--prefix=#{prefix}", "--with-intl=system-icu" + # Never install the bundled "npm", always prefer our + # installation from tarball for better packaging control. + args = %W[--prefix=#{prefix} --without-npm --with-intl=system-icu] + # Remove `--openssl-no-asm` workaround when upstream releases a fix + # See also: https://github.com/nodejs/node/issues/34043 + args << "--openssl-no-asm" if Hardware::CPU.arm? + args << "--tag=head" if build.head? + + system "./configure", *args system "make", "install" + + # Allow npm to find Node before installation has completed. + ENV.prepend_path "PATH", bin + + bootstrap = buildpath/"npm_bootstrap" + bootstrap.install resource("npm") + system "node", bootstrap/"bin/npm-cli.js", "install", "-ddd", "--global", + "--prefix=#{libexec}", resource("npm").cached_download + + # The `package.json` stores integrity information about the above passed + # in `cached_download` npm resource, which breaks `npm -g outdated npm`. + # This copies back over the vanilla `package.json` to fix this issue. + cp bootstrap/"package.json", libexec/"lib/node_modules/npm" + # These symlinks are never used & they've caused issues in the past. + rm_rf libexec/"share" + + bash_completion.install bootstrap/"lib/utils/completion.sh" => "npm" end def post_install - (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + node_modules = HOMEBREW_PREFIX/"lib/node_modules" + node_modules.mkpath + # Kill npm but preserve all other modules across node updates/upgrades. + rm_rf node_modules/"npm" + + cp_r libexec/"lib/node_modules/npm", node_modules + # This symlink doesn't hop into homebrew_prefix/bin automatically so + # 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 node_modules/"npm/bin/npm-cli.js", HOMEBREW_PREFIX/"bin/npm" + ln_sf node_modules/"npm/bin/npx-cli.js", HOMEBREW_PREFIX/"bin/npx" + + # Create manpage symlinks (or overwrite the old ones) + %w[man1 man5 man7].each do |man| + # Dirs must exist first: https://github.com/Homebrew/legacy-homebrew/issues/35969 + mkdir_p HOMEBREW_PREFIX/"share/man/#{man}" + # still needed to migrate from copied file manpages to symlink manpages + rm_f Dir[HOMEBREW_PREFIX/"share/man/#{man}/{npm.,npm-,npmrc.,package.json.,npx.}*"] + ln_sf Dir[node_modules/"npm/man/#{man}/{npm,package-,shrinkwrap-,npx}*"], HOMEBREW_PREFIX/"share/man/#{man}" + end + + (node_modules/"npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end test do @@ -52,13 +105,13 @@ def post_install ENV.prepend_path "PATH", opt_bin ENV.delete "NVM_NODEJS_ORG_MIRROR" assert_equal which("node"), opt_bin/"node" - assert_predicate bin/"npm", :exist?, "npm must exist" - assert_predicate bin/"npm", :executable?, "npm must be executable" + assert_predicate HOMEBREW_PREFIX/"bin/npm", :exist?, "npm must exist" + assert_predicate HOMEBREW_PREFIX/"bin/npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] - system "#{bin}/npm", *npm_args, "install", "npm@latest" - system "#{bin}/npm", *npm_args, "install", "bufferutil" - assert_predicate bin/"npx", :exist?, "npx must exist" - assert_predicate bin/"npx", :executable?, "npx must be executable" - assert_match "< hello >", shell_output("#{bin}/npx cowsay hello") + system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "npm@latest" + system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "bufferutil" unless head? + assert_predicate HOMEBREW_PREFIX/"bin/npx", :exist?, "npx must exist" + assert_predicate HOMEBREW_PREFIX/"bin/npx", :executable?, "npx must be executable" + assert_match "< hello >", shell_output("#{HOMEBREW_PREFIX}/bin/npx cowsay hello") end end From b9711eb628d415a52ba8c84b97120726cc7ab630 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 09:25:20 -0500 Subject: [PATCH 03/13] Adding keg_only --- Formula/node@14.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 8c65607c4b1c5..e952f01817f78 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -18,6 +18,8 @@ class NodeAT14 < Formula sha256 "42b51e14448f7c4548effecd6f3f4c943785e122096b59ad8d4cb0b5c974faae" => :high_sierra end + keg_only :versioned_formula + depends_on "pkg-config" => :build depends_on "python@3.9" => :build depends_on "icu4c" From 1a92357ca0a192a4e070d39c4a373d3703b97778 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 09:32:30 -0500 Subject: [PATCH 04/13] Removing HEAD --- Formula/node@14.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index e952f01817f78..7bc1e98213360 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -4,7 +4,6 @@ class NodeAT14 < Formula url "https://nodejs.org/dist/v14.14.0/node-v14.14.0.tar.gz" sha256 "afb0b401d62d9fcfc68258f50d0bf042998d349ce9c1d7a2d45dd87870b3aab7" license "MIT" - head "https://github.com/nodejs/node.git" livecheck do url "https://nodejs.org/dist/" @@ -41,7 +40,6 @@ def install # Remove `--openssl-no-asm` workaround when upstream releases a fix # See also: https://github.com/nodejs/node/issues/34043 args << "--openssl-no-asm" if Hardware::CPU.arm? - args << "--tag=head" if build.head? system "./configure", *args system "make", "install" @@ -93,7 +91,9 @@ def post_install test do path = testpath/"test.js" - path.write "console.log('hello');" + path.write "console.log('he + +llo');" output = shell_output("#{bin}/node #{path}").strip assert_equal "hello", output @@ -111,7 +111,7 @@ def post_install assert_predicate HOMEBREW_PREFIX/"bin/npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "npm@latest" - system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "bufferutil" unless head? + system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "bufferutil" assert_predicate HOMEBREW_PREFIX/"bin/npx", :exist?, "npx must exist" assert_predicate HOMEBREW_PREFIX/"bin/npx", :executable?, "npx must be executable" assert_match "< hello >", shell_output("#{HOMEBREW_PREFIX}/bin/npx cowsay hello") From f0efd31e5b200650db7158e309b25bca36e89980 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 10:39:40 -0500 Subject: [PATCH 05/13] Typo --- Formula/node@14.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 7bc1e98213360..e8c46997fb557 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -91,9 +91,7 @@ def post_install test do path = testpath/"test.js" - path.write "console.log('he - -llo');" + path.write "console.log('hello');" output = shell_output("#{bin}/node #{path}").strip assert_equal "hello", output From fe057719df22b5c557e7992285c702d1cf9eefe4 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 11:35:36 -0500 Subject: [PATCH 06/13] Removing "bottle do" --- Formula/node@14.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index e8c46997fb557..2dc9358671fa0 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -10,13 +10,6 @@ class NodeAT14 < Formula regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i) end - bottle do - cellar :any - sha256 "f1be3b305c38cc1a71cc089ec1f2983fa6b796f568aac3a6e4c93d79dc87661b" => :catalina - sha256 "ff29457f90b4dbf7164a3c8e1204321d3e37e33697006cab136b3e21a238fd02" => :mojave - sha256 "42b51e14448f7c4548effecd6f3f4c943785e122096b59ad8d4cb0b5c974faae" => :high_sierra - end - keg_only :versioned_formula depends_on "pkg-config" => :build From a171a658864f8ec7dc0bc1d958cec954431176a9 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Sat, 24 Oct 2020 12:38:38 -0500 Subject: [PATCH 07/13] Update Formula/node@14.rb Co-authored-by: Jason Karns --- Formula/node@14.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 2dc9358671fa0..139653ed23617 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -7,7 +7,7 @@ class NodeAT14 < Formula livecheck do url "https://nodejs.org/dist/" - regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i) + regex(%r{href=["']?v?(14(?:\.\d+)+)/?["' >]}i) end keg_only :versioned_formula From 417c6a6d1965148e879ffc72a5f7e56bec530a6c Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Mon, 26 Oct 2020 05:49:13 -0500 Subject: [PATCH 08/13] Update node@14.rb Making the post_install look like the rest of the versioned node formula --- Formula/node@14.rb | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 139653ed23617..812511e8dd5c0 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -56,30 +56,7 @@ def install end def post_install - node_modules = HOMEBREW_PREFIX/"lib/node_modules" - node_modules.mkpath - # Kill npm but preserve all other modules across node updates/upgrades. - rm_rf node_modules/"npm" - - cp_r libexec/"lib/node_modules/npm", node_modules - # This symlink doesn't hop into homebrew_prefix/bin automatically so - # 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 node_modules/"npm/bin/npm-cli.js", HOMEBREW_PREFIX/"bin/npm" - ln_sf node_modules/"npm/bin/npx-cli.js", HOMEBREW_PREFIX/"bin/npx" - - # Create manpage symlinks (or overwrite the old ones) - %w[man1 man5 man7].each do |man| - # Dirs must exist first: https://github.com/Homebrew/legacy-homebrew/issues/35969 - mkdir_p HOMEBREW_PREFIX/"share/man/#{man}" - # still needed to migrate from copied file manpages to symlink manpages - rm_f Dir[HOMEBREW_PREFIX/"share/man/#{man}/{npm.,npm-,npmrc.,package.json.,npx.}*"] - ln_sf Dir[node_modules/"npm/man/#{man}/{npm,package-,shrinkwrap-,npx}*"], HOMEBREW_PREFIX/"share/man/#{man}" - end - - (node_modules/"npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end test do From 0ee279d885ce1dbe8c019dc23ab71bcd86a55d4f Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Mon, 26 Oct 2020 07:13:30 -0500 Subject: [PATCH 09/13] Update node@14.rb Matching the other versioned node installs even more. --- Formula/node@14.rb | 52 ++++++++-------------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 812511e8dd5c0..ff6e602a856b4 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -16,45 +16,11 @@ class NodeAT14 < Formula depends_on "python@3.9" => :build depends_on "icu4c" - # We track major/minor from upstream Node releases. - # We will accept *important* npm patch releases when necessary. - resource "npm" do - url "https://registry.npmjs.org/npm/-/npm-6.14.8.tgz" - sha256 "fe8e873cb606c06f67f666b4725eb9122c8927f677c8c0baf1477f0ff81f5a2c" - end - def install - # make sure subprocesses spawned by make are using our Python 3 - ENV["PYTHON"] = Formula["python@3.9"].opt_bin/"python3" - - # Never install the bundled "npm", always prefer our - # installation from tarball for better packaging control. - args = %W[--prefix=#{prefix} --without-npm --with-intl=system-icu] - # Remove `--openssl-no-asm` workaround when upstream releases a fix - # See also: https://github.com/nodejs/node/issues/34043 - args << "--openssl-no-asm" if Hardware::CPU.arm? - - system "./configure", *args + system "./configure", "--prefix=#{prefix}", "--with-intl=system-icu" system "make", "install" - - # Allow npm to find Node before installation has completed. - ENV.prepend_path "PATH", bin - - bootstrap = buildpath/"npm_bootstrap" - bootstrap.install resource("npm") - system "node", bootstrap/"bin/npm-cli.js", "install", "-ddd", "--global", - "--prefix=#{libexec}", resource("npm").cached_download - - # The `package.json` stores integrity information about the above passed - # in `cached_download` npm resource, which breaks `npm -g outdated npm`. - # This copies back over the vanilla `package.json` to fix this issue. - cp bootstrap/"package.json", libexec/"lib/node_modules/npm" - # These symlinks are never used & they've caused issues in the past. - rm_rf libexec/"share" - - bash_completion.install bootstrap/"lib/utils/completion.sh" => "npm" end - + def post_install (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end @@ -75,13 +41,13 @@ def post_install ENV.prepend_path "PATH", opt_bin ENV.delete "NVM_NODEJS_ORG_MIRROR" assert_equal which("node"), opt_bin/"node" - assert_predicate HOMEBREW_PREFIX/"bin/npm", :exist?, "npm must exist" - assert_predicate HOMEBREW_PREFIX/"bin/npm", :executable?, "npm must be executable" + assert_predicate bin/"npm", :exist?, "npm must exist" + assert_predicate bin/"npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] - system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "npm@latest" - system "#{HOMEBREW_PREFIX}/bin/npm", *npm_args, "install", "bufferutil" - assert_predicate HOMEBREW_PREFIX/"bin/npx", :exist?, "npx must exist" - assert_predicate HOMEBREW_PREFIX/"bin/npx", :executable?, "npx must be executable" - assert_match "< hello >", shell_output("#{HOMEBREW_PREFIX}/bin/npx cowsay hello") + system "#{bin}/npm", *npm_args, "install", "npm@latest" + system "#{bin}/npm", *npm_args, "install", "bufferutil" + assert_predicate bin/"npx", :exist?, "npx must exist" + assert_predicate bin/"npx", :executable?, "npx must be executable" + assert_match "< hello >", shell_output("#{bin}/npx cowsay hello") end end From 8812950826906be2754bf09846ef6f8af1c7512d Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Mon, 26 Oct 2020 07:23:29 -0500 Subject: [PATCH 10/13] Fixing whitespace --- Formula/node@14.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index ff6e602a856b4..5af9c50e6e34e 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -20,13 +20,13 @@ def install system "./configure", "--prefix=#{prefix}", "--with-intl=system-icu" system "make", "install" end - + def post_install - (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + (lib / "node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end test do - path = testpath/"test.js" + path = testpath / "test.js" path.write "console.log('hello');" output = shell_output("#{bin}/node #{path}").strip @@ -40,14 +40,14 @@ def post_install # make sure npm can find node ENV.prepend_path "PATH", opt_bin ENV.delete "NVM_NODEJS_ORG_MIRROR" - assert_equal which("node"), opt_bin/"node" - assert_predicate bin/"npm", :exist?, "npm must exist" - assert_predicate bin/"npm", :executable?, "npm must be executable" + assert_equal which("node"), opt_bin / "node" + assert_predicate bin / "npm", :exist?, "npm must exist" + assert_predicate bin / "npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] system "#{bin}/npm", *npm_args, "install", "npm@latest" system "#{bin}/npm", *npm_args, "install", "bufferutil" - assert_predicate bin/"npx", :exist?, "npx must exist" - assert_predicate bin/"npx", :executable?, "npx must be executable" + assert_predicate bin / "npx", :exist?, "npx must exist" + assert_predicate bin / "npx", :executable?, "npx must be executable" assert_match "< hello >", shell_output("#{bin}/npx cowsay hello") end end From 73a089361315fe8ef8a19f152fdc46385505260f Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Mon, 26 Oct 2020 07:40:09 -0500 Subject: [PATCH 11/13] Adding python to install --- Formula/node@14.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 5af9c50e6e34e..5f23790060847 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -17,7 +17,10 @@ class NodeAT14 < Formula depends_on "icu4c" def install - system "./configure", "--prefix=#{prefix}", "--with-intl=system-icu" + # make sure subprocesses spawned by make are using our Python 3 + ENV["PYTHON"] = Formula["python@3.9"].opt_bin / "python3" + + system "python3", "configure.py", "--prefix=#{prefix}", "--with-intl=system-icu" system "make", "install" end From 3dd9de9e5565505b93ca8a4db52c40b655caf100 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Tue, 27 Oct 2020 08:35:08 -0500 Subject: [PATCH 12/13] Apply suggestions from code review Co-authored-by: Diogo Azevedo --- Formula/node@14.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 5f23790060847..624c729d8fbe3 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -18,18 +18,18 @@ class NodeAT14 < Formula def install # make sure subprocesses spawned by make are using our Python 3 - ENV["PYTHON"] = Formula["python@3.9"].opt_bin / "python3" + ENV["PYTHON"] = Formula["python@3.9"].opt_bin/"python3" system "python3", "configure.py", "--prefix=#{prefix}", "--with-intl=system-icu" system "make", "install" end def post_install - (lib / "node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end test do - path = testpath / "test.js" + path = testpath/"test.js" path.write "console.log('hello');" output = shell_output("#{bin}/node #{path}").strip @@ -43,14 +43,14 @@ def post_install # make sure npm can find node ENV.prepend_path "PATH", opt_bin ENV.delete "NVM_NODEJS_ORG_MIRROR" - assert_equal which("node"), opt_bin / "node" - assert_predicate bin / "npm", :exist?, "npm must exist" - assert_predicate bin / "npm", :executable?, "npm must be executable" + assert_equal which("node"), opt_bin/"node" + assert_predicate bin/"npm", :exist?, "npm must exist" + assert_predicate bin/"npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] system "#{bin}/npm", *npm_args, "install", "npm@latest" system "#{bin}/npm", *npm_args, "install", "bufferutil" - assert_predicate bin / "npx", :exist?, "npx must exist" - assert_predicate bin / "npx", :executable?, "npx must be executable" + assert_predicate bin/"npx", :exist?, "npx must exist" + assert_predicate bin/"npx", :executable?, "npx must be executable" assert_match "< hello >", shell_output("#{bin}/npx cowsay hello") end end From 7dc15bcdce9446f2dea7eca224404be5985b79a8 Mon Sep 17 00:00:00 2001 From: Eric Veenendaal Date: Tue, 27 Oct 2020 11:34:07 -0500 Subject: [PATCH 13/13] Updating to v14.15.0 --- Formula/node@14.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/node@14.rb b/Formula/node@14.rb index 624c729d8fbe3..c0a3226494b89 100644 --- a/Formula/node@14.rb +++ b/Formula/node@14.rb @@ -1,8 +1,8 @@ class NodeAT14 < Formula desc "Platform built on V8 to build network applications" homepage "https://nodejs.org/" - url "https://nodejs.org/dist/v14.14.0/node-v14.14.0.tar.gz" - sha256 "afb0b401d62d9fcfc68258f50d0bf042998d349ce9c1d7a2d45dd87870b3aab7" + url "https://nodejs.org/dist/v14.15.0/node-v14.15.0.tar.gz" + sha256 "5f9529e0a42985d5a81620635ab2541e3553daede42903d1b3176f808d46411c" license "MIT" livecheck do