#!/bin/bash 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 -------" npm run build echo "------- vue project build over -------" } enterCordova() { # enter cordova project cd cordova # del tem file rm -rf www/cordova.js } buildAndroid() { echo "------- begin build android project -------" # build android package cordova build android --release -- --keystore="../config/release.keystore" --alias=tianwang --storePassword=wanbits --password=wanbits echo "------- android project build over -------" } buildIOS() { echo "------- begin build ios project -------" # build ios package cordova build ios echo "------- ios project build over -------" } # build app if [ -n "$1" ]; then if [ "$1" == "android" ] then buildResource enterCordova buildAndroid elif [ "$1" == "ios" ] then buildResource enterCordova buildIOS elif [ "$1" == "help" ]; then echo "use: no params build all android -- build android help -- show help info ios -- build ios" exit else echo "use: no params build all android -- build android help -- show help info ios -- build ios" exit fi else buildResource enterCordova buildAndroid buildIOS fi echo "------- all done -------"