Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion bin/package-link
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set -o pipefail # don't ignore exit codes when piping output
set -o posix # more strict failures in subshells
# set -x # enable debugging

IFS="$(printf "\n\t")"
# ---- End unofficial bash strict mode boilerplate

package_name=$1
Expand All @@ -19,6 +18,20 @@ yalc_packages_file_name="yalc-packages"
container_id="$(docker-compose ps -q web)"
container_copied_packages_path="/home/node/copied-packages"

# validate input
IFS='/'
read -a pkgarr <<< "$1"
org_name=${pkgarr[0]}

#check if the organization name is valid by cross referencing with node_modules
is_package=$(find node_modules -type d -name $org_name)
if [ -z "$is_package" ]; then
echo "$org_name does not exist"
exit 0
fi

IFS="$(printf "\n\t")"

if [[ -z "${package_name}" ]]; then
if ! [[ -f "$yalc_packages_file_name" ]]; then
echo "Yalc packages file doesn't exist. Creating..."
Expand Down
15 changes: 14 additions & 1 deletion bin/package-unlink
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ set -o pipefail # don't ignore exit codes when piping output
set -o posix # more strict failures in subshells
# set -x # enable debugging

IFS="$(printf "\n\t")"
# ---- End unofficial bash strict mode boilerplate

package_name=$1

# validate input
IFS='/'
read -a pkgarr <<< "$1"
org_name=${pkgarr[0]}

#check if the organization name is valid by cross referencing with node_modules
is_package=$(find node_modules -type d -name $org_name)
if [ -z "$is_package" ]; then
echo "$org_name does not exist"
exit 0
fi

IFS="$(printf "\n\t")"

# Unlink the yalc dependency, remove the package drectory and npm install
echo "Unlinking package from Example Storefront..."
docker-compose exec web sh -c "cd /usr/local/src/app && yalc remove ${package_name}"
Expand Down