diff options
author | Balaji Vijayakumar <kuttibalaji.v6@gmail.com> | 2022-12-09 12:59:26 +0530 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-12-09 13:51:05 +0530 |
commit | acb0a6f117987e44b91eda1be9ad44d70238b8fc (patch) | |
tree | c2a1fff569df611ddfd2310bdefe45f912e4b736 /scripts/build-unix.sh | |
parent | Fix logic used to check if there were local changes in docker builds (diff) | |
download | ferdium-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-x | scripts/build-unix.sh | 31 |
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 | |||
60 | else | 60 | else |
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 |
73 | fi | 67 | fi |
@@ -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 |
89 | command_exists asdf && asdf reshim nodejs | 83 | command_exists asdf && asdf reshim nodejs |
90 | 84 | ||
91 | # Ensure that the system dependencies are at the correct version | ||
92 | # Check npm version | ||
93 | EXPECTED_NPM_VERSION=$(node -p 'require("./package.json").engines.npm') | ||
94 | ACTUAL_NPM_VERSION=$(npm --version) | ||
95 | if [[ "$ACTUAL_NPM_VERSION" != "$EXPECTED_NPM_VERSION" ]]; then | ||
96 | npm i -gf npm@$EXPECTED_NPM_VERSION | ||
97 | fi | ||
98 | |||
99 | # Check pnpm version | 85 | # Check pnpm version |
100 | EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') | 86 | EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') |
101 | ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present | 87 | ACTUAL_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 |
107 | command_exists asdf && asdf reshim nodejs | 93 | command_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 | ||
111 | if [[ -s 'pnpm-lock.yaml' ]]; then | ||
112 | BASE_CMD=pnpm | ||
113 | else | ||
114 | BASE_CMD=npm | ||
115 | fi | ||
116 | |||
117 | ENV_FILE=".env" | 95 | ENV_FILE=".env" |
118 | if [[ ! -s $ENV_FILE ]]; then | 96 | if [[ ! -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 | # ----------------------------------------------------------------------------- |
127 | printf "\n*************** Building recipes ***************\n" | 105 | printf "\n*************** Building recipes ***************\n" |
128 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
129 | pushd recipes | 106 | pushd recipes |
130 | pnpm i | 107 | pnpm i |
131 | pnpm package | 108 | pnpm package |
132 | popd | 109 | popd |
133 | 110 | ||
134 | # Now the meat..... | 111 | # Now the meat..... |
135 | $BASE_CMD i | 112 | pnpm i |
136 | node ace migration:refresh | 113 | node ace migration:refresh |
137 | 114 | ||
138 | # ----------------------------------------------------------------------------- | 115 | # ----------------------------------------------------------------------------- |
139 | printf "\n*************** Building app ***************\n" | 116 | printf "\n*************** Building app ***************\n" |
140 | $BASE_CMD start --dev | 117 | pnpm start --dev |
141 | 118 | ||
142 | printf "\n*************** App successfully stopped! ***************\n" | 119 | printf "\n*************** App successfully stopped! ***************\n" |