File prepare_vendor.sh of Package routenbuch

#!/bin/bash

PKG_NAME="routenbuch"
PKG_DIR="routenbuch"

cleanup_tmpdir() {
    popd 2>/dev/null || true
    rm -rf "${BASHLS_TMPDIR}"
}
trap cleanup_tmpdir SIGINT

cleanup_and_exit() {
    cleanup_tmpdir
    if test "${1}" = 0 -o -z "${1}" ; then
        exit 0
    else
        exit "${1}"
    fi
}

if [ ! -w "${BASHLS_TARBALL}" ]; then
    wget "${BASHLS_URL}"
fi

pushd "${PKG_DIR}" || cleanup_and_exit 1

git co .
git clean -dfx
git pull --rebase

PNPM_STORE_DIR="$(pwd)/.pnpm-store"

echo ">>>>>> Fetch node modules"
pnpm fetch --frozen-lockfile --store-dir "${PNPM_STORE_DIR}"
ret=$?
if [ ${ret} -ne 0 ]; then
    echo "ERROR: pnpm install failed"
    cleanup_and_exit 1
fi
pnpm audit

echo ">>>>>> Package vendor files"
rm -f "../${PKG_NAME}}-node-modules.tar.zst"
ZSTD_NBTHREADS=$(nproc) tar --zstd -cf "../${PKG_NAME}-node-modules.tar.zst" .pnpm-store
ret=$?
if [ ${ret} -ne 0 ]; then
    cleanup_and_exit 1
fi

popd || cleanup_and_exit 1

cleanup_and_exit 0
openSUSE Build Service is sponsored by