Updated and simplified build scripts

This commit is contained in:
WolverinDEV 2018-10-28 23:59:15 +01:00
parent 5cbaa747ba
commit b5252faad7
13 changed files with 209 additions and 118 deletions

View file

@ -245,7 +245,7 @@
$flagset = 0b00;
$environment = "";
$type = "dev";
if($_SERVER["argv"][3] == "dev") {
if($_SERVER["argv"][3] == "dev" || $_SERVER["argv"][3] == "development") {
if ($_SERVER["argv"][2] == "web") {
$flagset = 0b01;
$environment = "web/environment/development";
@ -256,7 +256,7 @@
error_log("Invalid type!");
goto help;
}
} else if($_SERVER["argv"][3] == "rel") {
} else if($_SERVER["argv"][3] == "rel" || $_SERVER["argv"][3] == "release") {
$type = "rel";
if ($_SERVER["argv"][2] == "web") {
$flagset = 0b01;

34
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "client",
"version": "1.0.0",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -29,6 +29,7 @@
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/@types/moment/-/moment-2.13.0.tgz",
"integrity": "sha1-YE69GJvDvDShVIaJQE5hoqSqyJY=",
"dev": true,
"requires": {
"moment": "*"
}
@ -943,12 +944,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -963,17 +966,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -1090,7 +1096,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -1102,6 +1109,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1116,6 +1124,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -1123,12 +1132,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -1147,6 +1158,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -1227,7 +1239,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -1239,6 +1252,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1360,6 +1374,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -1961,7 +1976,8 @@
"moment": {
"version": "2.22.2",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz",
"integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y="
"integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=",
"dev": true
},
"ms": {
"version": "2.1.1",

View file

@ -6,15 +6,13 @@
"directories": {},
"scripts": {
"compile-sass": "sass --update .:.",
"build-worker": "tsc -p shared/js/workers/tsconfig_worker_codec.json",
"build-web-app": "tsc -p tsconfig/tsconfig_web_app.json",
"build-web-app-release": "tsc -p tsconfig/tsconfig_web_app_packaged.json",
"build-web-preload": "tsc -p tsconfig/tsconfig_web_preload.json"
"build-worker": "tsc -p shared/js/workers/tsconfig_worker_codec.json"
},
"author": "TeaSpeak (WolverinDEV)",
"license": "ISC",
"devDependencies": {
"@types/emscripten": "0.0.31",
"@types/moment": "^2.13.0",
"@types/jquery": "3.3.5",
"@types/node": "^9.4.6",
"@types/websocket": "0.0.38",
@ -22,9 +20,6 @@
"sass": "^1.14.1",
"typescript": "^3.1.1"
},
"dependencies": {
"@types/moment": "^2.13.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/TeaSpeak/TeaWeb/TeaWeb.git"
@ -32,5 +27,5 @@
"bugs": {
"url": "https://github.com/TeaSpeak/TeaWeb/issues"
},
"homepage": "https://github.com/TeaSpeak/TeaWeb/TeaWeb#readme"
"homepage": "https://www.teaspeak.de"
}

View file

@ -1,8 +1,11 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
source "${BASEDIR}/resolve_commands.sh"
function generate_link() {
if [ ! -L $2 ] || [ ${BASH_ARGV[0]} == "force" ]; then
if [ -e $2 ]; then
if [ ! -L $2 ] || [ "${BASH_ARGV[0]}" == "force" ]; then
if [ -e $2 ] || [ -L $2 ]; then
rm $2
fi
ln -rs $1 $2
@ -17,11 +20,11 @@ cd "$BASEDIR/../"
#Note: For the client we have to use the given file
#Web
tsc -p web/tsconfig/tsdeclaration.json
execute_tsc -p web/tsconfig/tsdeclaration.json
echo "Generated web declarations"
#Shared
tsc -p shared/tsconfig/tsdeclaration.json
execute_tsc -p shared/tsconfig/tsdeclaration.json
echo "Generated shared declarations"
#Now build the merged declaration for the shared project

View file

@ -1,25 +0,0 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
npm run "build-web-app"
if [ $? -ne 0 ]; then
echo "Failed to compile app!"
exit 0
fi
npm run "build-web-preload"
if [ $? -ne 0 ]; then
echo "Failed to compile app-preloader!"
exit 0
fi
php files.php generate web dev
if [ $? -ne 0 ]; then
echo "Failed to setup environment!"
exit 0
fi
echo "Development environment successfully generated!"
echo "Note: Do not forget to recompile the typescript files when edited!"

View file

@ -1,31 +0,0 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
#Cleanup stuff
rm -r generated &> /dev/null
if [ -e generated ]; then
echo "Failed to remove generated directory!"
exit 1
fi
npm run "build-web-app-release"
if [ $? -ne 0 ]; then
echo "Failed to compile app!"
exit 0
fi
npm run "build-web-preload"
if [ $? -ne 0 ]; then
echo "Failed to compile app-preloader!"
exit 0
fi
php files.php generate web rel
if [ $? -ne 0 ]; then
echo "Failed to setup environment!"
exit 0
fi
echo "Release environment successfully generated!"

View file

@ -1,35 +0,0 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
if [ ! -d web/rel-environment ]; then
echo "Please generate first the release environment!"
exit 1
fi
git diff-index HEAD -- . ':!asm/libraries/'
if [ $? -ne 0 ]; then
echo "You're using a private modified build!"
echo "Cant assign git hash!"
NAME="TeaWeb.zip"
else
NAME="TeaWeb-$(git rev-parse --short HEAD).zip"
fi
if [ -e ${NAME} ]; then
echo "Deleting old file"
rm -r ${NAME}
fi
cd web/rel-environment
zip -9 -r ${NAME} *
if [ $? -ne 0 ]; then
echo "Failed to package environment!"
fi
mv ${NAME} ../../
cd ../../
echo "Release package successfully packaged!"
echo "Target file: ${NAME}"

26
scripts/resolve_commands.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
function execute_tsc() {
if [ "$command_tsc" == "" ]; then
if [ "$node_bin" == "" ]; then
node_bin=$(npm bin)
fi
if [ ! -e "${node_bin}/tsc" ]; then
echo "Could not find tsc command"
echo "May type npm install"
exit 1
fi
command_tsc="${node_bin}/tsc"
output=$(${command_tsc} -v)
if [ $? -ne 0 ]; then
echo "Failed to execute a simple tsc command!"
echo "$output"
exit 1
fi
fi
${command_tsc} $@
}

84
scripts/web_build.sh Executable file
View file

@ -0,0 +1,84 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
source ./scripts/resolve_commands.sh
if [ "$1" == "development" ] || [ "$1" == "dev" ]; then
source_path="web/environment/development"
type="development"
elif [ "$1" == "release" ] || [ "$1" == "rel" ]; then
source_path="web/environment/release"
type="release"
else
if [ $# -lt 1 ]; then
echo "Invalid argument count!"
else
echo "Invalid option $1"
fi
echo 'Available options are: "development" or "dev", "release" or "rel"'
exit 1
fi
echo "Generating style files"
npm run compile-sass
if [ $? -ne 0 ]; then
echo "Failed to generate style files"
exit 1
fi
echo "Generating web workers"
npm run build-worker
if [ $? -ne 0 ]; then
echo "Failed to build web workers"
exit 1
fi
#Now lets build the declarations
echo "Building declarations"
./scripts/build_declarations.sh
if [ $? -ne 0 ]; then
echo "Failed to generate declarations"
exit 1
fi
if [ "$type" == "release" ]; then #Compile everything for release mode
#Compile the shared source first
echo "Building shared source"
./shared/generate_packed.sh
if [ $? -ne 0 ]; then
echo "Failed to build shared source"
exit 1
fi
#Now compile the web client itself
echo "Building web client"
./web/generate_packed.sh
if [ $? -ne 0 ]; then
echo "Failed to build web client"
exit 1
fi
elif [ "$type" == "development" ]; then
echo "Building shared source"
execute_tsc -p ./shared/tsconfig/tsconfig.json
if [ $? -ne 0 ]; then
echo "Failed to compile shared sources"
exit 1
fi
echo "Building web client source"
execute_tsc -p ./web/tsconfig/tsconfig.json
if [ $? -ne 0 ]; then
echo "Failed to compile web sources"
exit 1
fi
fi
echo "Generating environment"
php files.php generate web ${type}
if [ $? -ne 0 ]; then
echo "Failed to generate environment"
exit 1
fi
echo "Successfully build!"

55
scripts/web_package.sh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
if [ "$1" == "development" ] || [ "$1" == "dev" ]; then
source_path="web/environment/development"
type="development"
elif [ "$1" == "release" ] || [ "$1" == "rel" ]; then
source_path="web/environment/release"
type="release"
else
if [ $# -lt 1 ]; then
echo "Invalid argument count!"
else
echo "Invalid option $1"
fi
echo 'Available options are: "development" or "dev", "release" or "rel"'
exit 1
fi
if [ ! -d "$source_path" ]; then
echo "Could not find environment! ($source_path)"
echo "Please generate it first!"
exit 1
fi
response=$(git diff-index HEAD -- . ':!asm/libraries/' ':!package-lock.json' ':!vendor/')
if [ "$response" != "" ]; then
echo "You're using a private modified build!"
echo "Cant assign git hash!"
NAME="TeaWeb.zip"
else
NAME="TeaWeb-$(git rev-parse --short HEAD).zip"
fi
if [ -e ${NAME} ]; then
echo "Found old file. Deleting it."
rm -r ${NAME}
fi
current_path=$(pwd)
cd "$source_path"
zip -9 -r ${NAME} *
if [ $? -ne 0 ]; then
echo "Failed to package environment!"
exit 1
fi
cd "$current_path"
mv "${source_path}/${NAME}" .
echo "Release package successfully packaged!"
echo "Target file: ${NAME}"

View file

@ -2,6 +2,7 @@
BASEDIR=$(dirname "$0")
cd "$BASEDIR"
source ../scripts/resolve_commands.sh
#Generate the loader definitions first
LOADER_FILE="declarations/exports_loader.d.ts"
@ -11,13 +12,14 @@ if [ -e ${LOADER_FILE} ]; then
echo "Failed to remove loader file!\nThis could be critical later!"
fi
fi
tsc -p tsconfig/tsdeclaration_loader.json &> /dev/null #We dont want the output!
result=$(execute_tsc -p tsconfig/tsdeclaration_loader.json)
if [ ! -e ${LOADER_FILE} ]; then
echo "Failed to generate definitions"
echo "$result"
exit 1
fi
tsc -p tsconfig/tsconfig_packed.json
execute_tsc -p tsconfig/tsconfig_packed.json
if [ $? -ne 0 ]; then
echo "Failed to generate packed file!"
exit 1

View file

@ -2,6 +2,7 @@
BASEDIR=$(dirname "$0")
cd "$BASEDIR"
source ../scripts/resolve_commands.sh
if [ ! -e declarations/imports_shared.d.ts ]; then
echo "generate the declarations first!"
@ -15,7 +16,7 @@ if [ ! -e ../shared/generated/shared.js ]; then
exit 1
fi
tsc -p tsconfig/tsconfig_packed.json
execute_tsc -p tsconfig/tsconfig_packed.json
if [ $? -ne 0 ]; then
echo "Failed to build file"
exit 1

View file

@ -11,6 +11,6 @@
"outFile": "declarations/exports"
},
"include": [
"js/**/*.ts"
"../js/**/*.ts"
]
}