From 12bf78f41b64d0d4a113bf5e20e20d4f01932808 Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Wed, 4 Oct 2023 16:48:10 -0400 Subject: [PATCH] chore(script): pack_to_dest script --- scripts/pack_to_dest.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/pack_to_dest.sh diff --git a/scripts/pack_to_dest.sh b/scripts/pack_to_dest.sh new file mode 100755 index 0000000000..4d937f1762 --- /dev/null +++ b/scripts/pack_to_dest.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -ex + +# Build and pack package as tgz and move to destination + +package_name=$1 +package_dir="packages/$package_name" +dest=$2 + +if [ -z "$package_name" ]; then + echo "Please specify a package to publish" + exit 1 +fi + +# Check if packages/$package_name exists + +if [ ! -d "$package_dir" ]; then + echo "Package $package_name does not exist" + exit 1 +fi + +# Check if destination directory exists +if [ ! -d "$dest" ]; then + echo "Destination directory $dest does not exist" + exit 1 +fi + +pnpm --filter "$package_name" run clean +pnpm --filter "$package_name" run build +pnpm -C "$package_dir" pack --pack-destination "$dest"