language/node: npm pack ignore prepublish scripts

This tells npm pack to don't run prepublish scripts at all.
I think this is the best default because:
* most modules don't have a prepublish script at all and aren't affected
  by this change
* most prepublish scripts are calling devDeps, which would fail in our
  case, because (dev)Deps aren't installed at npm pack time until #2820
  gets resolved
* we favor npm registry tarball for formula downloads, which are already
  prepublished, so we would in the best case needlessly run prepublish
  a second time and in the worst case it would fail (because a clean
  step is required before running prepublish a second time in a row)
* This change does the right thing for >99% of all the packages and
  would only affect packages with prepublish scripts downloaded from a
  non-npm registry tarball (like github tarballs) and with a prepublish
  script wich does no't require any devDep (unlike for cross platform)
This commit is contained in:
Christian Moritz 2017-06-29 20:24:15 +02:00
parent fe39dbb78c
commit 466fe9841a
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ module Language
# fed to `npm install` only symlinks are created linking back to that # fed to `npm install` only symlinks are created linking back to that
# directory, consequently breaking that assumption. We require a tarball # directory, consequently breaking that assumption. We require a tarball
# because npm install creates a "real" installation when fed a tarball. # because npm install creates a "real" installation when fed a tarball.
pack_cmd = "npm pack -ddd" pack_cmd = "npm pack -ddd --ignore-scripts"
ohai pack_cmd ohai pack_cmd
output = `#{pack_cmd}` output = `#{pack_cmd}`
if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty? if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?

View File

@ -24,7 +24,7 @@ describe Language::Node do
describe "#std_npm_install_args" do describe "#std_npm_install_args" do
npm_install_arg = "libexec" npm_install_arg = "libexec"
npm_pack_cmd = "npm pack -ddd" npm_pack_cmd = "npm pack -ddd --ignore-scripts"
it "raises error with non zero exitstatus" do it "raises error with non zero exitstatus" do
allow(Language::Node).to receive(:`).with(npm_pack_cmd).and_return("error msg") allow(Language::Node).to receive(:`).with(npm_pack_cmd).and_return("error msg")