From 4f82e6ec5abf56dbc1cf7a387c14720b1ff23f84 Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Wed, 2 Sep 2026 05:59:56 -0400 Subject: [PATCH] mealie: copy Nuxt generate output and use pnpm when lockfile is present (#16938) --- ct/mealie.sh | 31 ++++++++++++++++++++++++++----- install/mealie-install.sh | 31 ++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ct/mealie.sh b/ct/mealie.sh index d2357212a..7673cb26c 100644 --- a/ct/mealie.sh +++ b/ct/mealie.sh @@ -33,7 +33,6 @@ function update_script() { fi if check_for_gh_release "mealie" "mealie-recipes/mealie"; then PYTHON_VERSION="3.12" setup_uv - NODE_MODULE="yarn" NODE_VERSION="24" setup_nodejs msg_info "Stopping Service" systemctl stop mealie @@ -67,6 +66,14 @@ STARTEOF $STD uv sync --frozen --extra pgsql msg_ok "Installed Python Dependencies" + if [[ -f /opt/mealie/frontend/pnpm-lock.yaml ]]; then + FRONTEND_PKG="pnpm" + NODE_MODULE="pnpm@11" NODE_VERSION="24" setup_nodejs + else + FRONTEND_PKG="yarn" + NODE_MODULE="yarn" NODE_VERSION="24" setup_nodejs + fi + msg_info "Building Frontend" MEALIE_VERSION=$(<$HOME/.mealie) SITE_SETTINGS=$(find /opt/mealie/frontend -name "site-settings.vue" -path "*/admin/*" | head -1) @@ -75,14 +82,28 @@ STARTEOF $STD sed -i "s|value: data.production ? i18n.t(\"about.production\") : i18n.t(\"about.development\"),|value: \"bare-metal\",|g" "$SITE_SETTINGS" export NUXT_TELEMETRY_DISABLED=1 cd /opt/mealie/frontend - $STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000 - $STD yarn generate - $STD yarn cache clean + if [[ "${FRONTEND_PKG}" == "pnpm" ]]; then + $STD pnpm install --prefer-offline --frozen-lockfile + $STD pnpm generate + $STD pnpm store prune + else + $STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000 + $STD yarn generate + $STD yarn cache clean + fi msg_ok "Built Frontend" msg_info "Copying Built Frontend" + if [[ -n "$(ls -A /opt/mealie/frontend/.output/public 2>/dev/null)" ]]; then + FRONTEND_SRC="/opt/mealie/frontend/.output/public" + elif [[ -n "$(ls -A /opt/mealie/frontend/dist 2>/dev/null)" ]]; then + FRONTEND_SRC="/opt/mealie/frontend/dist" + else + msg_error "Frontend build output not found" + exit + fi mkdir -p /opt/mealie/mealie/frontend - cp -r /opt/mealie/frontend/dist/* /opt/mealie/mealie/frontend/ + cp -r "${FRONTEND_SRC}/." /opt/mealie/mealie/frontend/ msg_ok "Copied Frontend" setup_nltk "averaged_perceptron_tagger_eng" "/nltk_data" diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 137b38622..a81faa808 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -29,10 +29,17 @@ msg_ok "Installed Dependencies" PYTHON_VERSION="3.12" setup_uv PG_VERSION="16" setup_postgresql -NODE_MODULE="yarn" NODE_VERSION="24" setup_nodejs fetch_and_deploy_gh_release "mealie" "mealie-recipes/mealie" "tarball" PG_DB_NAME="mealie_db" PG_DB_USER="mealie_user" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db +if [[ -f /opt/mealie/frontend/pnpm-lock.yaml ]]; then + FRONTEND_PKG="pnpm" + NODE_MODULE="pnpm@11" NODE_VERSION="24" setup_nodejs +else + FRONTEND_PKG="yarn" + NODE_MODULE="yarn" NODE_VERSION="24" setup_nodejs +fi + msg_info "Installing Python Dependencies with uv" cd /opt/mealie $STD uv sync --frozen --extra pgsql @@ -46,14 +53,28 @@ SITE_SETTINGS=$(find /opt/mealie/frontend -name "site-settings.vue" -path "*/adm $STD sed -i "s|https://github.com/mealie-recipes/mealie/commit/|https://github.com/mealie-recipes/mealie/releases/tag/|g" "$SITE_SETTINGS" $STD sed -i "s|value: data.buildId,|value: \"v${MEALIE_VERSION}\",|g" "$SITE_SETTINGS" $STD sed -i "s|value: data.production ? i18n.t(\"about.production\") : i18n.t(\"about.development\"),|value: \"bare-metal\",|g" "$SITE_SETTINGS" -$STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000 -$STD yarn generate -$STD yarn cache clean +if [[ "${FRONTEND_PKG}" == "pnpm" ]]; then + $STD pnpm install --prefer-offline --frozen-lockfile + $STD pnpm generate + $STD pnpm store prune +else + $STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000 + $STD yarn generate + $STD yarn cache clean +fi msg_ok "Built Frontend" msg_info "Copying Built Frontend" +if [[ -n "$(ls -A /opt/mealie/frontend/.output/public 2>/dev/null)" ]]; then + FRONTEND_SRC="/opt/mealie/frontend/.output/public" +elif [[ -n "$(ls -A /opt/mealie/frontend/dist 2>/dev/null)" ]]; then + FRONTEND_SRC="/opt/mealie/frontend/dist" +else + msg_error "Frontend build output not found" + exit +fi mkdir -p /opt/mealie/mealie/frontend -cp -r /opt/mealie/frontend/dist/* /opt/mealie/mealie/frontend/ +cp -r "${FRONTEND_SRC}/." /opt/mealie/mealie/frontend/ msg_ok "Copied Frontend" setup_nltk "averaged_perceptron_tagger_eng" "/nltk_data"