Skip to content

Instantly share code, notes, and snippets.

@wrzlbrmft
Created March 29, 2016 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrzlbrmft/57334eedea605f457ceb to your computer and use it in GitHub Desktop.
Save wrzlbrmft/57334eedea605f457ceb to your computer and use it in GitHub Desktop.
Creates a zip file of a Node.js app to be deployed to AWS Elastic Beanstalk.
#!/usr/bin/env sh
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
PROJECT_NAME="$(cat "$PROJECT_ROOT/src/package.json" | grep '"name"' | cut -d\" -f4)"
PROJECT_VERSION="$(cat "$PROJECT_ROOT/src/package.json" | grep '"version"' | cut -d\" -f4)"
rsync -vrLkpogt --delete-before --progress \
--exclude .DS_Store \
--exclude build \
--exclude node_modules \
--exclude typings \
"$PROJECT_ROOT/src" "$PROJECT_ROOT/tmp"
ZIP="$PROJECT_ROOT/$PROJECT_NAME-$PROJECT_VERSION.zip"
rm -f "$ZIP"
cd "$PROJECT_ROOT/tmp/src"
zip -r "$ZIP" .
cd "$PROJECT_ROOT"
rm -rf "$PROJECT_ROOT/tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment