Skip to content

Commit

Permalink
handle scoped modules (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Mar 6, 2020
1 parent 24ee5f6 commit 516d99a
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions addon_files/redmatic/bin/redmaticVersions
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,26 @@ source $ADDON_DIR/versions

JO_ARGS=""

# TODO handle scoped packages
for dir in $GLOBAL_MODULES/*
do
dir=${dir%*/}
PKG=${dir##*/}
PKGJSON=$GLOBAL_MODULES/$PKG/package.json
if [[ -f $PKGJSON ]]; then
JO_ARGS="$JO_ARGS $PKG=`jq -r '.version' $GLOBAL_MODULES/$PKG/package.json`"
fi
done

for dir in $LOCAL_MODULES/*
do
dir=${dir%*/}
PKG=${dir##*/}
PKGJSON=$LOCAL_MODULES/$PKG/package.json
if [[ -f $PKGJSON ]]; then
JO_ARGS="$JO_ARGS $PKG=`jq -r '.version' $LOCAL_MODULES/$PKG/package.json`"
fi
done
scan_dir()
{
for dir in $1/*
do
dir=${dir%*/}
PKG=${dir##*/}
PKGJSON=$1/$PKG/package.json
if [[ -f $PKGJSON ]]; then
JO_ARGS="$JO_ARGS `jq -r '.name' $1/$PKG/package.json`=`jq -r '.version' $1/$PKG/package.json`"
fi
case $PKG in @*)
scan_dir "$1/$PKG"
esac
done
}

scan_dir $GLOBAL_MODULES
scan_dir $LOCAL_MODULES

jo -p ccu=`(cat /VERSION && echo -n "deviceTypes=" && $ADDON_DIR/bin/deviceTypes) | jo` \
redmatic=$VERSION_ADDON \
nodejs=`node --version | cut -c 2-` \
$JO_ARGS

0 comments on commit 516d99a

Please sign in to comment.