UNPKG

780 BPlain TextView Raw
1#!/usr/bin/env bash
2
3set -e
4
5package=$1
6standalone=$2
7compress=$3
8
9name=$(./scripts/info $package name)
10main=$(./scripts/info $package main)
11version=$(./scripts/info $package version)
12description=$(./scripts/info $package description)
13
14if [ "$package" != "." ]; then
15 package="./node_modules/$package"
16fi
17
18mkdir -p dist
19
20browserify -r "$package/$main:$name" \
21 -o "dist/$name.bundle.js" \
22 $([ -n "$standalone" ] && echo "-s $standalone")
23
24uglifyjs dist/$name.bundle.js \
25 -o dist/$name.min.js \
26 -c $compress \
27 -m \
28 $([ -n "$standalone" ] && echo "--source-map dist/$name.min.js.map -r $standalone") \
29 --preamble "/* $name $version: $description */"
30
31if [ -z "$standalone" ]; then
32 rm dist/$name.bundle.js
33fi