|
13 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 | 14 | # See the License for the specific language governing permissions and
|
15 | 15 | # limitations under the License.
|
16 |
| -printf "Checking for required npm version..." |
17 |
| -npm install -g npm > ~/monolith-to-microservices/logs/npm.txt 2>&1 |
18 |
| -printf "Completed.\n" |
19 | 16 |
|
20 |
| -printf "Installing monolith dependencies..." |
| 17 | +set -eEuo pipefail |
| 18 | + |
| 19 | +if [[ -v CLOUD_SHELL ]] |
| 20 | +then |
| 21 | + printf "Setting up NVM...\n" |
| 22 | + export NVM_DIR="/usr/local/nvm" |
| 23 | + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm |
| 24 | + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion |
| 25 | + printf "Completed.\n\n" |
| 26 | + |
| 27 | + printf "Updating nodeJS version...\n" |
| 28 | + nvm install --lts |
| 29 | + printf "Completed.\n\n" |
| 30 | +else |
| 31 | + printf "Checking for required npm version...\n" |
| 32 | + npm install -g npm |
| 33 | + printf "Completed.\n\n" |
| 34 | +fi |
| 35 | + |
| 36 | +printf "Installing monolith dependencies...\n" |
21 | 37 | cd ./monolith
|
22 |
| -npm install > ~/monolith-to-microservices/logs/monolith.txt 2>&1 |
23 |
| -printf "Completed.\n" |
| 38 | +npm install |
| 39 | +printf "Completed.\n\n" |
24 | 40 |
|
25 |
| -printf "Installing microservies dependencies..." |
| 41 | +printf "Installing microservies dependencies...\n" |
26 | 42 | cd ../microservices
|
27 |
| -npm install > ~/monolith-to-microservices/logs/microservices.txt 2>&1 |
28 |
| -printf "Completed.\n" |
| 43 | +npm install |
| 44 | +printf "Completed.\n\n" |
29 | 45 |
|
30 |
| -printf "Installing React app dependencies..." |
| 46 | +printf "Installing React app dependencies...\n" |
31 | 47 | cd ../react-app
|
32 |
| -npm install > ~/monolith-to-microservices/logs/react.txt 2>&1 |
33 |
| -printf "Completed.\n" |
| 48 | +npm install |
| 49 | +printf "Completed.\n\n" |
34 | 50 |
|
35 |
| -printf "Building React app and placing into sub projects..." |
36 |
| -npm run build > ~/monolith-to-microservices/logs/build.txt 2>&1 |
| 51 | +printf "Building React app and placing into sub projects...\n" |
| 52 | +npm run build |
37 | 53 | printf "Completed.\n\n"
|
38 | 54 |
|
39 |
| -printf "Script completed successfully!\n" |
| 55 | +printf "Setup completed successfully!\n" |
0 commit comments