#!/bin/bash if [ -n "$2" ]; then type="$2" else type="development" fi buildResource() { if [ ! -d "cordova" ]; then echo "current path is wrong! Please use tools/build.sh xxx to run!" exit 1 fi # build resources echo "------- begin build vue project MODE[$type] -------" npm run build-"$type" echo "------- vue project build over[$type] -------" } enterCordova() { # enter cordova project cd cordova # del tem file rm -rf www/cordova.js } buildAndroid() { echo "------- begin build android project[$type] -------" # build android package cordova build android --release -- --keystore="../config/release.keystore" --alias=tianwang --storePassword=wanbits --password=wanbits echo "------- android project build over[$type] -------" } buildIOS() { echo "------- begin build ios project[$type] -------" # build ios package cordova build ios echo "------- ios project build over[$type] -------" } help() { echo "use: no params build android with dev android [type] -- build android [type: dev pub, default:dev] help -- show help info ios [type] -- build ios [type: dev pub, default:dev]" exit } # build app if [ -n "$1" ]; then if [ "$1" == "android" ]; then buildResource enterCordova buildAndroid elif [ "$1" == "ios" ]; then buildResource enterCordova buildIOS elif [ "$1" == "help" ]; then help else help fi else buildResource enterCordova buildAndroid fi echo "------- all [$type] done -------"