From feecba8625a0692e55de33920211b002d52b3e96 Mon Sep 17 00:00:00 2001 From: Akshat Gupta Date: Wed, 22 Apr 2020 14:33:44 +0530 Subject: [PATCH 1/3] Adding ability to run npm ci by default --- 10/s2i/bin/assemble | 20 +++++++++++++++++++- 12/s2i/bin/assemble | 21 +++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/10/s2i/bin/assemble b/10/s2i/bin/assemble index 78c9b975..219333aa 100755 --- a/10/s2i/bin/assemble +++ b/10/s2i/bin/assemble @@ -81,12 +81,30 @@ fi if [ "$NODE_ENV" != "production" ]; then echo "---> Building your Node application from source" + + # We will be using npm CI by default for more information please refer to + # https://github.com/sclorg/s2i-nodejs-container/issues/212 + echo "---> Installing dependencies with npm ci" + npm ci || \ + # npm ci will fail if certain conditions aren't met as mentioned in + # https://docs.npmjs.com/cli-commands/ci.html#description + echo "---> npm ci failed, installing dependencies with npm install"; \ npm install else echo "---> Installing all dependencies" - NODE_ENV=development npm install + + # We will be using npm CI by default for more information please refer to + # https://github.com/sclorg/s2i-nodejs-container/issues/212 + echo "---> Installing dependencies with npm ci" + npm ci || \ + # npm ci will fail if certain conditions aren't met as mentioned in + # https://docs.npmjs.com/cli-commands/ci.html#description + echo "---> npm ci failed, installing dependencies with npm install"; \ + npm install + + NODE_ENV=development #do not fail when there is no build script echo "---> Building in production mode" diff --git a/12/s2i/bin/assemble b/12/s2i/bin/assemble index 78c9b975..99395495 100755 --- a/12/s2i/bin/assemble +++ b/12/s2i/bin/assemble @@ -81,12 +81,29 @@ fi if [ "$NODE_ENV" != "production" ]; then echo "---> Building your Node application from source" - npm install + # We will be using npm CI by default for more information please refer to + # https://github.com/sclorg/s2i-nodejs-container/issues/212 + echo "---> Installing dependencies with npm ci" + npm ci || \ + # npm ci will fail if certain conditions aren't met as mentioned in + # https://docs.npmjs.com/cli-commands/ci.html#description + echo "---> npm ci failed, installing dependencies with npm install"; \ + npm install else echo "---> Installing all dependencies" - NODE_ENV=development npm install + + # We will be using npm CI by default for more information please refer to + # https://github.com/sclorg/s2i-nodejs-container/issues/212 + echo "---> Installing dependencies with npm ci" + npm ci || \ + # npm ci will fail if certain conditions aren't met as mentioned in + # https://docs.npmjs.com/cli-commands/ci.html#description + echo "---> npm ci failed, installing dependencies with npm install"; \ + npm install + + NODE_ENV=development #do not fail when there is no build script echo "---> Building in production mode" From d9db2c89d2e8117030487d633f16d80a5e143a04 Mon Sep 17 00:00:00 2001 From: Akshat Gupta Date: Fri, 24 Apr 2020 23:47:39 +0530 Subject: [PATCH 2/3] Resolving PR review --- 10/s2i/bin/assemble | 4 +--- 12/s2i/bin/assemble | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/10/s2i/bin/assemble b/10/s2i/bin/assemble index 219333aa..a7c14a7a 100755 --- a/10/s2i/bin/assemble +++ b/10/s2i/bin/assemble @@ -102,9 +102,7 @@ else # npm ci will fail if certain conditions aren't met as mentioned in # https://docs.npmjs.com/cli-commands/ci.html#description echo "---> npm ci failed, installing dependencies with npm install"; \ - npm install - - NODE_ENV=development + NODE_ENV=development npm install #do not fail when there is no build script echo "---> Building in production mode" diff --git a/12/s2i/bin/assemble b/12/s2i/bin/assemble index 99395495..07aaa083 100755 --- a/12/s2i/bin/assemble +++ b/12/s2i/bin/assemble @@ -101,9 +101,7 @@ else # npm ci will fail if certain conditions aren't met as mentioned in # https://docs.npmjs.com/cli-commands/ci.html#description echo "---> npm ci failed, installing dependencies with npm install"; \ - npm install - - NODE_ENV=development + NODE_ENV=development npm install #do not fail when there is no build script echo "---> Building in production mode" From 5a5bac7579c13e0309cbba00d222b0a759808cad Mon Sep 17 00:00:00 2001 From: Akshat Gupta Date: Sat, 25 Apr 2020 00:09:03 +0530 Subject: [PATCH 3/3] Adding NODE_ENV alongside npm ci --- 10/s2i/bin/assemble | 2 +- 12/s2i/bin/assemble | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/10/s2i/bin/assemble b/10/s2i/bin/assemble index a7c14a7a..baa16ed1 100755 --- a/10/s2i/bin/assemble +++ b/10/s2i/bin/assemble @@ -98,7 +98,7 @@ else # We will be using npm CI by default for more information please refer to # https://github.com/sclorg/s2i-nodejs-container/issues/212 echo "---> Installing dependencies with npm ci" - npm ci || \ + NODE_ENV=development npm ci || \ # npm ci will fail if certain conditions aren't met as mentioned in # https://docs.npmjs.com/cli-commands/ci.html#description echo "---> npm ci failed, installing dependencies with npm install"; \ diff --git a/12/s2i/bin/assemble b/12/s2i/bin/assemble index 07aaa083..e1e46671 100755 --- a/12/s2i/bin/assemble +++ b/12/s2i/bin/assemble @@ -97,7 +97,7 @@ else # We will be using npm CI by default for more information please refer to # https://github.com/sclorg/s2i-nodejs-container/issues/212 echo "---> Installing dependencies with npm ci" - npm ci || \ + NODE_ENV=development npm ci || \ # npm ci will fail if certain conditions aren't met as mentioned in # https://docs.npmjs.com/cli-commands/ci.html#description echo "---> npm ci failed, installing dependencies with npm install"; \