1
0
Fork 0

combine script will now include modules that are not require()'d by any other module

closure/master
Mike Gerwitz 2011-08-28 17:33:44 -04:00
parent 2efdbe8969
commit 70142f5059
1 changed files with 20 additions and 2 deletions

View File

@ -30,7 +30,7 @@ RMTRAIL="$PATH_TOOLS/rmtrail"
# determine the order in which modules must be concatenated; order matters to
# ensure dependencies are loaded before the module that depends on them
CAT_MODULES=$(
cat_modules=$(
cd "$PATH_TOOLS/../" &&
grep -rIo ' require(.*)' lib/ \
| sed "s/^lib\///;s/\.js://;s/require(.*'\/\(.*\)'.*/\1/" \
@ -40,6 +40,24 @@ CAT_MODULES=$(
exit 3
}
# get a list of all available modules
all_modules=$(
cd "$PATH_LIB" &&
ls -1 *.js \
| sed 's/\.js$//'
)
# get lsit of modules that haven't been
remain_modules=$(
echo "$cat_modules
$all_modules" \
| sort \
| uniq -u
)
cat_modules="$cat_modules
$remain_modules"
##
# Output template header
##
@ -91,7 +109,7 @@ fi
tpl_header
# output each of the modules
for module in $CAT_MODULES; do
for module in $cat_modules; do
filename="$PATH_LIB/$module.$MODULE_EXT"
if [ ! -f "$filename" ]; then