1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-04 20:07:17 -05:00
notes/node_modules/ajv/scripts/bundle

34 lines
780 B
Plaintext
Raw Normal View History

2017-03-09 13:16:08 -05:00
#!/usr/bin/env bash
set -e
package=$1
standalone=$2
compress=$3
name=$(./scripts/info $package name)
main=$(./scripts/info $package main)
version=$(./scripts/info $package version)
description=$(./scripts/info $package description)
if [ "$package" != "." ]; then
package="./node_modules/$package"
fi
mkdir -p dist
browserify -r "$package/$main:$name" \
-o "dist/$name.bundle.js" \
$([ -n "$standalone" ] && echo "-s $standalone")
uglifyjs dist/$name.bundle.js \
-o dist/$name.min.js \
-c $compress \
-m \
$([ -n "$standalone" ] && echo "--source-map dist/$name.min.js.map -r $standalone") \
--preamble "/* $name $version: $description */"
if [ -z "$standalone" ]; then
rm dist/$name.bundle.js
fi