36 lines
1008 B
Ruby
36 lines
1008 B
Ruby
require "language/node"
|
|
|
|
class Ncc < Formula
|
|
desc "Compile a Node.js project into a single file"
|
|
homepage "https://github.com/vercel/ncc"
|
|
url "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.0.tgz"
|
|
sha256 "6b31b548faf760f9b8feb2a091fcfbf98c6590515d14df799ff615cba487236a"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "bc7bb6a47adac6089878c4799d4a61ee35b34878b1db481915a6c5c6479a79ac"
|
|
end
|
|
|
|
depends_on "node"
|
|
|
|
def install
|
|
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
|
|
bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
end
|
|
|
|
test do
|
|
(testpath/"input.js").write <<~EOS
|
|
function component() {
|
|
const element = document.createElement('div');
|
|
element.innerHTML = 'Hello' + ' ' + 'webpack';
|
|
return element;
|
|
}
|
|
|
|
document.body.appendChild(component());
|
|
EOS
|
|
|
|
system bin/"ncc", "build", "input.js", "-o", "dist"
|
|
assert_match "document.createElement", File.read("dist/index.js")
|
|
end
|
|
end
|