mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-19 01:24:18 +00:00
61 lines
1.7 KiB
Bash
Executable file
61 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Setup
|
|
#######################################################
|
|
transformations="[ babelify ]"
|
|
toolpath="${1:-node_modules/.bin/browserify}"
|
|
toolname="$(basename "${toolpath}")"
|
|
|
|
if [ "${toolname}" = "node-sass" ]; then
|
|
srcExtension="scss"
|
|
dstExtension="css"
|
|
else
|
|
srcExtension="js"
|
|
dstExtension="js"
|
|
fi
|
|
|
|
if [ "${toolname}" = "watchify" ]; then
|
|
extraArgs="-t ${transformations} --ignore-watch=**/build/** --verbose"
|
|
elif [ "${toolname}" = "browserify" ]; then
|
|
extraArgs="-t ${transformations} --ignore-watch=**/build/** --verbose"
|
|
else
|
|
extraArgs=""
|
|
fi
|
|
|
|
|
|
bundleTarget="build/uppy.${dstExtension}"
|
|
|
|
# Individual files, built seperately
|
|
#######################################################
|
|
allSourceFiles=""
|
|
for src in $(find src -name "*.${srcExtension}" -type f); do
|
|
allSourceFiles="${allSourceFiles} ${src}"
|
|
dst="build/$(basename $(dirname ${src}))/$(basename ${src})"
|
|
echo "--> ${src} -> ${dst}"
|
|
|
|
# Argument should be `browserify`, or `node-sass`
|
|
if [ "${toolname}" = "node-sass" ]; then
|
|
"${toolpath}" "${src}" "${dst}" ${extraArgs}
|
|
else
|
|
"${toolpath}" "${src}" -o "${dst}" ${extraArgs}
|
|
fi
|
|
done
|
|
|
|
# All files in one bundle
|
|
#######################################################
|
|
echo "--> *.${srcExtension} -> ${bundleTarget}"
|
|
if [ "${toolname}" = "node-sass" ]; then
|
|
"${toolpath}" ${allSourceFiles} "${bundleTarget}" ${extraArgs}
|
|
else
|
|
"${toolpath}" ${allSourceFiles} -o "${bundleTarget}" ${extraArgs}
|
|
fi
|
|
|
|
# Install into examples
|
|
for path in $(find examples -maxdepth 1 -mindepth 1 -type d); do
|
|
exampleProject="$(basename "${path}")"
|
|
rsync \
|
|
-ai \
|
|
--exclude='.DS_Store' \
|
|
--exclude='.empty' \
|
|
build/ "examples/${exampleProject}/static/uppy"
|
|
done
|