From a8a2ff5a6314ec51efad0914f51e91998619aedd Mon Sep 17 00:00:00 2001 From: Masafumi Oyamada Date: Thu, 15 Aug 2019 00:48:21 +0900 Subject: [PATCH] Add bin/build and bin/upload --- release.sh => bin/build | 8 +++++--- bin/upload | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) rename release.sh => bin/build (70%) create mode 100755 bin/upload diff --git a/release.sh b/bin/build similarity index 70% rename from release.sh rename to bin/build index 3272f40..3e4f84a 100755 --- a/release.sh +++ b/bin/build @@ -1,14 +1,16 @@ #!/bin/bash +PROJ_ROOT=$(dirname $(realpath $0))/../ +cd $PROJ_ROOT + npx prettier --tab-width 2 --write 'src/**/*.js' npx webpack --mode=production -cd package -npx jsbox build +(cd package; npx jsbox build) PKG_FILE="package/.output/ikeysnail.box" -if [ ! -e $PKG_FILE ]; then +if [[ -e $PKG_FILE ]]; then echo "Finished creating the package." echo "Run $ npm run release" else diff --git a/bin/upload b/bin/upload new file mode 100755 index 0000000..62e86af --- /dev/null +++ b/bin/upload @@ -0,0 +1,19 @@ +#!/bin/bash + +PROJ_ROOT=$(dirname $(realpath $0))/../ +cd $PROJ_ROOT + +if [ $# -ne 1 ]; then + echo "Usage: upload HOSTNAME" + exit 1 +fi + +HOST=$1 +PKG_FILE="package/.output/ikeysnail.box" + +if [ -e $PKG_FILE ]; then + curl -X POST --form "files[]"=@$PKG_FILE http://${HOST}/upload +else + echo "No package found !" + exit 1 +fi