Skip to content

Commit

Permalink
bump to v1.2, support alpine, POSIX-compliant postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Jun 26, 2020
1 parent 44089b6 commit d0e54bd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Right now there are no configurable options however this could be easily
added by passing JSON options to `minify.js` and adding a bit of code
on the crystal side. Pull requests welcome!

Currently supports linux, macos, and alpine. Could easily support FreeBSD
and Windows with a several line change.

## Installation

Just add the following to yoour `shard.yml`:
Expand Down
2 changes: 1 addition & 1 deletion js/node_modules/terser/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
cd js || exit 1
npm install -g pkg || exit 1
npm install --save terser || exit 1
pkg minify.js --out-path ../dist --targets macos,linux
pkg minify.js --out-path ../dist --targets macos,linux,alpine
18 changes: 12 additions & 6 deletions postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/bash
#!/bin/sh
mkdir -p bin || exit 1
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
MINIFIER_BIN=linux
elif [[ "$OSTYPE" == "darwin"* ]]; then
MINIFIER_BIN=macos
case $OSTYPE in
"linux-gnu"*) MINIFIER_BIN=linux ;;
"darwin"*) MINIFIER_BIN=macos ;;
esac
if [ -e /etc/os-release ]; then
. /etc/os-release
case $ID in
"alpine"*) MINIFIER_BIN=alpine ;;
*) MINIFIER_BIN=linux ;;
esac
fi
echo "$MINIFIER_BIN detected, downloading minifier binary..."
curl -L --url https://github.com/sam0x17/es6-minifier/releases/download/minify-dist/minify-$MINIFIER_BIN --output bin/es6-minifier || exit 1
curl -L --url https://github.com/sam0x17/es6-minifier/releases/download/0.1.2/minify-$MINIFIER_BIN --output bin/es6-minifier || exit 1
chmod +x bin/es6-minifier || exit 1
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: es6-minifier
version: 0.1.0
version: 0.1.2

authors:
- Sam Johnson <sam@durosoft.com>
Expand Down

0 comments on commit d0e54bd

Please sign in to comment.