From 88d7db4377a61f2094d92107f37295be09c402d4 Mon Sep 17 00:00:00 2001 From: Paul Brown <67805647+pb-dod@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:31:49 -0500 Subject: [PATCH] CLOUD-2295: allow certificates step to succeed without npm (#70) I ran into this error while testing ih-setup locally: ``` /Users/myuser/homebrew-ih-public/lib/core/certificates/step.sh: line 96: npm: command not found ``` It's assuming everyone has `npm` installed globally, but that's not the case for a lot of fresh installs. This PR adds logic to allow the certificates step to succeed if you don't have `npm` installed. --------- Co-authored-by: Paul Brown --- VERSION | 2 +- formula/ih-core.rb | 2 +- lib/core/certificates/step.sh | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index a52e041..072d0fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.35 +0.1.36 diff --git a/formula/ih-core.rb b/formula/ih-core.rb index 0a853a4..8ed230d 100644 --- a/formula/ih-core.rb +++ b/formula/ih-core.rb @@ -1,5 +1,5 @@ class IhCore < Formula - VERSION="0.1.35" + VERSION="0.1.36" desc "Brew formula for installing core tools used at Included Health engineering." homepage "https://github.com/ConsultingMD/homebrew-ih-public" license "CC BY-NC-ND 4.0" diff --git a/lib/core/certificates/step.sh b/lib/core/certificates/step.sh index 3b3bc87..20dde32 100644 --- a/lib/core/certificates/step.sh +++ b/lib/core/certificates/step.sh @@ -92,8 +92,10 @@ function ih::setup::core.certificates::install() { # with no obvious pattern. curl https://www.amazontrust.com/repository/SFSRootCAG2.pem >>"$MOZILLA_PATH" - # Configure NPM to use the bundle. - npm config set cafile "$MOZILLA_PATH" + # Configure NPM to use the bundle, if npm exists. + if command -v npm &>/dev/null; then + npm config set cafile "$MOZILLA_PATH" + fi if command -v yarn &>/dev/null; then # Configure yarn to use the bundle.