aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build-unix.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build-unix.sh')
-rwxr-xr-xscripts/build-unix.sh33
1 files changed, 19 insertions, 14 deletions
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh
index 42de96a1a..15e9f26c8 100755
--- a/scripts/build-unix.sh
+++ b/scripts/build-unix.sh
@@ -83,33 +83,38 @@ fi
83command_exists asdf && asdf reshim nodejs 83command_exists asdf && asdf reshim nodejs
84 84
85# Ensure that the system dependencies are at the correct version 85# Ensure that the system dependencies are at the correct version
86# Check npm version
87EXPECTED_NPM_VERSION=$(node -p 'require("./package.json").engines.npm')
88ACTUAL_NPM_VERSION=$(npm --version)
89if [[ "$ACTUAL_NPM_VERSION" != "$EXPECTED_NPM_VERSION" ]]; then
90 npm i -gf npm@$EXPECTED_NPM_VERSION
91fi
92
86# Check pnpm version 93# Check pnpm version
87EXPECTED_PNPM_VERSION=$(node -p 'require("./package.json").engines.pnpm') 94EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm')
88ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present 95ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present
89if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then 96if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then
90 npm i -gf pnpm@$EXPECTED_PNPM_VERSION 97 npm i -gf pnpm@$EXPECTED_PNPM_VERSION
91fi 98fi
92 99
93# Check pnpm version of the recipes submodule
94EXPECTED_RECIPES_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm')
95if [[ "$EXPECTED_PNPM_VERSION" != "$EXPECTED_RECIPES_PNPM_VERSION" ]]; then
96 fail_with_docs "The expected versions of pnpm are not the same in the main repo and in the recipes submodule, please sync them.
97 expected in recipes : [$EXPECTED_RECIPES_PNPM_VERSION]
98 expected in main repo: [$EXPECTED_PNPM_VERSION]
99 actual : [$EXPECTED_PNPM_VERSION]"
100fi
101
102# If 'asdf' is installed, reshim for new nodejs if necessary 100# If 'asdf' is installed, reshim for new nodejs if necessary
103command_exists asdf && asdf reshim nodejs 101command_exists asdf && asdf reshim nodejs
104 102
105# ----------------------------------------------------------------------------- 103# -----------------------------------------------------------------------------
104# This is useful if we move from 'npm' to 'pnpm' for the main repo as well
105if [[ -s 'pnpm-lock.yaml' ]]; then
106 BASE_CMD=pnpm
107else
108 BASE_CMD=npm
109fi
110
106# Now the meat..... 111# Now the meat.....
107pnpm i 112$BASE_CMD i
108pnpm prepare-code 113$BASE_CMD run prepare-code
109pnpm test
110 114
111# ----------------------------------------------------------------------------- 115# -----------------------------------------------------------------------------
112printf "\n*************** Building recipes ***************\n" 116printf "\n*************** Building recipes ***************\n"
117# Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm
113pushd recipes 118pushd recipes
114pnpm i && pnpm lint && pnpm reformat-files && pnpm package 119pnpm i && pnpm lint && pnpm reformat-files && pnpm package
115popd 120popd
@@ -128,7 +133,7 @@ else
128 TARGET_OS="linux" 133 TARGET_OS="linux"
129fi 134fi
130 135
131pnpm build --$TARGET_ARCH --$TARGET_OS --dir 136$BASE_CMD run build -- --$TARGET_ARCH --$TARGET_OS --dir
132 137
133printf "\n*************** App successfully built! ***************\n" 138printf "\n*************** App successfully built! ***************\n"
134 139