Skip to content

Commit

Permalink
scripts.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
zuiwuchang committed Nov 29, 2023
1 parent d6505ad commit c4df9ac
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function help(){
echo " view view build helper"
fi
echo " pack pack release"
echo " scripts pack scripts"
echo " run run project"
echo " docker docker build helper"
echo
Expand All @@ -44,6 +45,11 @@ case "$1" in
export Command="$0 pack"
"$BashDir/script/pack.sh" "$@"
;;
scripts)
shift
export Command="$0 scripts"
"$BashDir/script/scripts.sh" "$@"
;;
go)
shift
export Command="$0 go"
Expand Down
55 changes: 55 additions & 0 deletions script/scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -e

BashDir=$(cd "$(dirname $BASH_SOURCE)" && pwd)
eval $(cat "$BashDir/conf.sh")
if [[ "$Command" == "" ]];then
Command="$0"
fi

function help(){
echo "pack scripts"
echo
echo "Usage:"
echo " $Command [flags]"
echo
echo "Flags:"
echo " -o, --output pack output name"
echo " -h, --help help for $Command"
}

ARGS=`getopt -o ho --long help,output: -n "$Command" -- "$@"`
eval set -- "${ARGS}"
pack="gz"
output=""
while true
do
case "$1" in
-h|--help)
help
exit 0
;;
-o|--output)
output="$2"
shift 2
;;
--)
shift
break
;;
*)
echo Error: unknown flag "$1" for "$Command"
echo "Run '$Command --help' for usage."
exit 1
;;
esac
done

cd bin
if [[ "$output" == "" ]];then
output="scripts-`date +%F`.tar.gz"
fi
tar -zcvf "$output" js ts main.d.ts tsconfig.json
echo
echo pack to "\"$output\"" successed

0 comments on commit c4df9ac

Please sign in to comment.