diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 72076c8705a62127b9c0883ba92c7403524903fa..379dfde4704804600996994298637bf89bf58fe5 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -29,6 +29,8 @@ module Homebrew description: "Create a basic template for a Go build." switch "--meson", description: "Create a basic template for a Meson-style build." + switch "--node", + description: "Create a basic template for a Node build." switch "--perl", description: "Create a basic template for a Perl build." switch "--python", @@ -54,7 +56,7 @@ module Homebrew switch :force switch :verbose switch :debug - conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--perl", "--python", "--rust" + conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node", "--perl", "--python", "--rust" named 1 end end @@ -92,6 +94,8 @@ module Homebrew :crystal elsif args.go? :go + elsif args.node? + :node elsif args.perl? :perl elsif args.python? diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index fafc97b0b911762950ab69663d06474a666b92ab..81eec27d0eadbc8766c2fd5cffb9b4cd286fd163 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -84,6 +84,10 @@ module Homebrew # Documentation: https://docs.brew.sh/Formula-Cookbook # https://rubydoc.brew.sh/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! + <% if mode == :node %> + require "language/node" + + <% end %> class #{Formulary.class_s(name)} < Formula <% if mode == :python %> include Language::Python::Virtualenv @@ -112,6 +116,8 @@ module Homebrew <% elsif mode == :meson %> depends_on "meson" => :build depends_on "ninja" => :build + <% elsif mode == :node %> + depends_on "node" <% elsif mode == :perl %> uses_from_macos "perl" <% elsif mode == :python %> @@ -153,6 +159,9 @@ module Homebrew system "ninja", "-v" system "ninja", "install", "-v" end + <% elsif mode == :node %> + system "npm", "install", *Language::Node.std_npm_install_args(libexec) + bin.install_symlink Dir["\#{libexec}/bin/*"] <% elsif mode == :perl %> ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" ENV.prepend_path "PERL5LIB", libexec/"lib" diff --git a/completions/bash/brew b/completions/bash/brew index 1a57828607243ee158a85defc114116e83fd0a58..25014fe9407478ad612ce2e7a189a70422b95bc9 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -169,6 +169,7 @@ _brew_create() { --help --meson --no-fetch + --node --perl --python --ruby diff --git a/docs/Manpage.md b/docs/Manpage.md index a41eb26a2f07aa604c6e9412d9ab6a09948d935f..cd7bc1ffd19e80d9b552f9ce4aa014e9ca35674c 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -784,6 +784,8 @@ a simple example. For the complete API, see: Create a basic template for a Go build. * `--meson`: Create a basic template for a Meson-style build. +* `--node`: + Create a basic template for a Node build. * `--perl`: Create a basic template for a Perl build. * `--python`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 25e5ce2cc4e161363c42278651bad86e9102cc84..4fc1074618beb9882883ae6981deed4b1fd2036a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1022,6 +1022,10 @@ Create a basic template for a Go build\. Create a basic template for a Meson\-style build\. . .TP +\fB\-\-node\fR +Create a basic template for a Node build\. +. +.TP \fB\-\-perl\fR Create a basic template for a Perl build\. .