aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build-unix.sh
diff options
context:
space:
mode:
authorLibravatar Balaji Vijayakumar <kuttibalaji.v6@gmail.com>2022-12-09 12:59:26 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-12-09 13:51:05 +0530
commitacb0a6f117987e44b91eda1be9ad44d70238b8fc (patch)
treec2a1fff569df611ddfd2310bdefe45f912e4b736 /scripts/build-unix.sh
parentFix logic used to check if there were local changes in docker builds (diff)
downloadferdium-server-acb0a6f117987e44b91eda1be9ad44d70238b8fc.tar.gz
ferdium-server-acb0a6f117987e44b91eda1be9ad44d70238b8fc.tar.zst
ferdium-server-acb0a6f117987e44b91eda1be9ad44d70238b8fc.zip
migrate npm to pnpm for build
Diffstat (limited to 'scripts/build-unix.sh')
-rwxr-xr-xscripts/build-unix.sh31
1 files changed, 4 insertions, 27 deletions
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh
index 24ab0f7..28d0e7c 100755
--- a/scripts/build-unix.sh
+++ b/scripts/build-unix.sh
@@ -60,14 +60,8 @@ if [ "$CLEAN" != "true" ]; then
60else 60else
61 printf "\n*************** Cleaning!!!!!! ***************\n" 61 printf "\n*************** Cleaning!!!!!! ***************\n"
62 62
63 if [[ -s 'pnpm-lock.yaml' ]]; then 63 pnpm store prune || true # in case the pnpm executable itself is not present
64 pnpm store prune || true # in case the pnpm executable itself is not present 64 rm -rf ~/.pnpm-store ~/.pnpm-state
65 rm -rf ~/.pnpm-store ~/.pnpm-state
66 fi
67
68 npm cache clean --force
69 rm -rf ~/.npm ~/.node-gyp ~/.asdf/installs/nodejs/*/.npm/
70
71 git -C recipes clean -fxd # Clean recipes folder/submodule 65 git -C recipes clean -fxd # Clean recipes folder/submodule
72 git clean -fxd # Note: This will blast away the 'recipes' folder if you have symlinked it 66 git clean -fxd # Note: This will blast away the 'recipes' folder if you have symlinked it
73fi 67fi
@@ -88,14 +82,6 @@ fi
88# If 'asdf' is installed, reshim for new nodejs if necessary 82# If 'asdf' is installed, reshim for new nodejs if necessary
89command_exists asdf && asdf reshim nodejs 83command_exists asdf && asdf reshim nodejs
90 84
91# Ensure that the system dependencies are at the correct version
92# Check npm version
93EXPECTED_NPM_VERSION=$(node -p 'require("./package.json").engines.npm')
94ACTUAL_NPM_VERSION=$(npm --version)
95if [[ "$ACTUAL_NPM_VERSION" != "$EXPECTED_NPM_VERSION" ]]; then
96 npm i -gf npm@$EXPECTED_NPM_VERSION
97fi
98
99# Check pnpm version 85# Check pnpm version
100EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') 86EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm')
101ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present 87ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present
@@ -106,14 +92,6 @@ fi
106# If 'asdf' is installed, reshim for new nodejs if necessary 92# If 'asdf' is installed, reshim for new nodejs if necessary
107command_exists asdf && asdf reshim nodejs 93command_exists asdf && asdf reshim nodejs
108 94
109# -----------------------------------------------------------------------------
110# This is useful if we move from 'npm' to 'pnpm' for the main repo as well
111if [[ -s 'pnpm-lock.yaml' ]]; then
112 BASE_CMD=pnpm
113else
114 BASE_CMD=npm
115fi
116
117ENV_FILE=".env" 95ENV_FILE=".env"
118if [[ ! -s $ENV_FILE ]]; then 96if [[ ! -s $ENV_FILE ]]; then
119 APP_KEY=`cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w ${1:-32} | head -n 1` 97 APP_KEY=`cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w ${1:-32} | head -n 1`
@@ -125,18 +103,17 @@ mkdir -p data
125 103
126# ----------------------------------------------------------------------------- 104# -----------------------------------------------------------------------------
127printf "\n*************** Building recipes ***************\n" 105printf "\n*************** Building recipes ***************\n"
128# Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm
129pushd recipes 106pushd recipes
130pnpm i 107pnpm i
131pnpm package 108pnpm package
132popd 109popd
133 110
134# Now the meat..... 111# Now the meat.....
135$BASE_CMD i 112pnpm i
136node ace migration:refresh 113node ace migration:refresh
137 114
138# ----------------------------------------------------------------------------- 115# -----------------------------------------------------------------------------
139printf "\n*************** Building app ***************\n" 116printf "\n*************** Building app ***************\n"
140$BASE_CMD start --dev 117pnpm start --dev
141 118
142printf "\n*************** App successfully stopped! ***************\n" 119printf "\n*************** App successfully stopped! ***************\n"