Updated the build scripts for an successfully client build
parent
c460d05ee5
commit
cafdf637cf
20
file.ts
20
file.ts
|
@ -750,7 +750,6 @@ namespace server {
|
|||
if(!p.startsWith("/")) p = "/" + p;
|
||||
if(p.endsWith(".html")) {
|
||||
const np = await generator.search_http_file(files, p.substr(0, p.length - 5) + ".php", options.search_options);
|
||||
console.log("%s => %s", p, np);
|
||||
if(np) p = p.substr(0, p.length - 5) + ".php";
|
||||
}
|
||||
serve_file(p, url.query, response);
|
||||
|
@ -1007,18 +1006,12 @@ async function main_develop(node: boolean, target: "client" | "web", port: numbe
|
|||
}
|
||||
|
||||
async function git_tag() {
|
||||
const exec = util.promisify(cp.exec);
|
||||
|
||||
/* check if we've any uncommited changes */
|
||||
{
|
||||
let { stdout, stderr } = await exec("git diff-index HEAD -- . ':!asm/libraries/' ':!package-lock.json' ':!vendor/'");
|
||||
if(stderr) throw stderr;
|
||||
if(stdout) return "0000000";
|
||||
}
|
||||
|
||||
let { stdout, stderr } = await exec("git rev-parse --short HEAD");
|
||||
if(stderr) throw stderr;
|
||||
return stdout.substr(0, 7);
|
||||
const git_rev = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
|
||||
let version;
|
||||
if(git_rev.indexOf("/") === -1)
|
||||
return git_rev.substr(0, 7);
|
||||
else
|
||||
return fs.readFileSync(path.join(__dirname, ".git", git_rev.substr(5).trim())).toString().substr(0, 7);
|
||||
}
|
||||
|
||||
async function main_generate(target: "client" | "web", mode: "rel" | "dev", dest_path: string, args: any[]) {
|
||||
|
@ -1219,4 +1212,5 @@ main(process.argv.slice(2)).then(ignore_exit => {
|
|||
}).catch(error => {
|
||||
console.error("Failed to execute application. Exception reached execution root!");
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
|
@ -259,6 +259,8 @@ export type ErrorHandler = (message: string, detail: string) => void;
|
|||
let _callback_critical_error: ErrorHandler;
|
||||
let _callback_critical_called: boolean = false;
|
||||
export function critical_error(message: string, detail?: string) {
|
||||
document.getElementById("loader-overlay").classList.add("started");
|
||||
|
||||
if(_callback_critical_called) {
|
||||
console.warn("[CRITICAL] %s", message);
|
||||
if(typeof(detail) === "string")
|
||||
|
|
|
@ -5,14 +5,10 @@
|
|||
"main": "main.js",
|
||||
"directories": {},
|
||||
"scripts": {
|
||||
"compile-sass": "sass --update .:.",
|
||||
"compile-file-helper": "tsc file.ts",
|
||||
"build-worker-codec": "tsc -p web/js/workers/tsconfig_worker_codec.json",
|
||||
"build-worker-pow": "tsc -p shared/js/workers/tsconfig_worker_pow.json",
|
||||
"build-worker": "npm run build-worker-codec; npm run build-worker-pow;",
|
||||
"compile-sass": "sass --update shared/css/:shared/css/ web/css/:web/css/ client/css/:client/css/",
|
||||
"compile-project-base": "tsc -p tsbaseconfig.json",
|
||||
"dtsgen": "node tools/dtsgen/index.js",
|
||||
"trgen": "node tools/trgen/index.js",
|
||||
"ttsc": "ttsc",
|
||||
"sass": "sass",
|
||||
"csso": "csso",
|
||||
"rebuild-structure-web-dev": "php files.php generate web dev",
|
||||
|
@ -59,7 +55,6 @@
|
|||
"terser": "^4.2.1",
|
||||
"terser-webpack-plugin": "latest",
|
||||
"ts-loader": "^6.2.2",
|
||||
"ttypescript": "^1.5.10",
|
||||
"typescript": "3.6.5",
|
||||
"wabt": "^1.0.13",
|
||||
"webpack": "^4.42.1",
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
source "$(dirname "$0")/resolve_commands.sh"
|
||||
cd "$(dirname "$0")/../" || { echo "Failed to enter the base directory"; exit 1; }
|
||||
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Invalid argument count!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" == "client" ]]; then
|
||||
build_target="client"
|
||||
elif [[ "$1" == "web" ]]; then
|
||||
build_target="web"
|
||||
else
|
||||
echo "Invalid option $2"
|
||||
echo 'Available options are: "web" or "client"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$2" == "development" ]] || [[ "$2" == "dev" ]] || [[ "$2" == "debug" ]]; then
|
||||
build_type="development"
|
||||
elif [[ "$2" == "release" ]] || [[ "$2" == "rel" ]]; then
|
||||
build_type="release"
|
||||
else
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Invalid argument count!"
|
||||
else
|
||||
echo "Invalid option $2"
|
||||
fi
|
||||
echo 'Available options are: "development" or "dev", "release" or "rel"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Generating required project build files"
|
||||
npm run compile-project-base; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to generate project build files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Generating required build tooks"
|
||||
./tools/build_trgen.sh; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to build build_typescript translation generator"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Generating style files"
|
||||
npm run compile-sass; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to generate style files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Compile vendor XBBCode"
|
||||
execute_ttsc -p ./vendor/xbbcode/tsconfig.json; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to build the XBBCode vendor"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$build_type" == "release" ]]; then # Compile everything for release mode
|
||||
echo "Packing generated css files"
|
||||
./shared/css/generate_packed.sh; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to package generated css files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NODE_ENV=production npm run build-$build_target; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to build the $build_target applcation"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$build_type" == "development" ]]; then
|
||||
NODE_ENV=development npm run build-$build_target; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to build the $build_target applcation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating environment"
|
||||
node file.js generate $build_target ${build_type}; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to generate environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$build_target builded successfully!"
|
|
@ -1,103 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source `dirname $0`/resolve_commands.sh
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
|
||||
source_path="client-api/environment/ui-files/raw"
|
||||
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "debug" ]]; then
|
||||
type="development"
|
||||
elif [[ "$1" == "release" ]] || [[ "$1" == "rel" ]]; then
|
||||
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 file helper script"
|
||||
npm run compile-file-helper
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate file helper"
|
||||
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-codec
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build web worker codec"
|
||||
exit 1
|
||||
fi
|
||||
npm run build-worker-pow
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build web worker pow"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Lets build some tools
|
||||
#dtsgen should be already build by build_declarations.sh
|
||||
./tools/build_trgen.sh
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build typescript translation generator"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Now lets build the declarations
|
||||
echo "Building declarations"
|
||||
./scripts/build_declarations.sh force
|
||||
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 client UI"
|
||||
./client/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_ttsc -p ./shared/tsconfig/tsconfig.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to compile shared sources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building client UI source"
|
||||
execute_ttsc -p ./client/tsconfig/tsconfig.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to compile web sources"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating environment"
|
||||
node file.js generate client ${type}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully build!"
|
|
@ -1,12 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ./scripts/deploy_ui_files.sh http://dev.clientapi.teaspeak.de/api.php test 1.1.0
|
||||
# Example usage: ./scripts/deploy_ui_files.sh http://dev.clientapi.teaspeak.de/api.php test 1.1.0
|
||||
|
||||
TMP_FILE_NAME="TeaSpeakUI.tar.gz"
|
||||
TMP_DIR_NAME="tmp"
|
||||
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
cd "$(dirname "$0")/../" || { echo "failed to enter base directory"; exit 1; }
|
||||
|
||||
if [[ "$#" -ne 3 ]]; then
|
||||
echo "Illegal number of parameters (url | channel | required version)"
|
||||
|
@ -18,6 +17,7 @@ if [[ ! -d client-api/environment/ui-files/ ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [[ "${teaclient_deploy_secret}" == "" ]]; then
|
||||
echo "Missing deploy secret!"
|
||||
exit 1
|
||||
|
@ -26,33 +26,36 @@ fi
|
|||
if [[ -e "${TMP_FILE_NAME}" ]]; then
|
||||
echo "Temp file already exists!"
|
||||
echo "Deleting it!"
|
||||
rm ${TMP_FILE_NAME}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
||||
if ! rm ${TMP_FILE_NAME}; then
|
||||
echo "Failed to delete file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
GIT_HASH=$(git rev-parse --verify --short HEAD)
|
||||
APPLICATION_VERSION=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['version'])")
|
||||
APPLICATION_VERSION=$(< package.json python -c "import sys, json; print(json.load(sys.stdin)['version'])")
|
||||
echo "Git hash ${GIT_HASH} on version ${APPLICATION_VERSION} on channel $2"
|
||||
|
||||
#Packaging the app
|
||||
cd client-api/environment/ui-files/
|
||||
cd client-api/environment/ui-files/ || {
|
||||
echo "Missing UI files directory"
|
||||
exit 1
|
||||
}
|
||||
if [[ -e ${TMP_DIR_NAME} ]]; then
|
||||
rm -r ${TMP_DIR_NAME}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if ! rm -r ${TMP_DIR_NAME}; then
|
||||
echo "Failed to remove temporary directory!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cp -rL raw ${TMP_DIR_NAME}
|
||||
|
||||
for file in $(find ${TMP_DIR_NAME} -name '*.php'); do
|
||||
while IFS= read -r -d '' file
|
||||
do
|
||||
echo "Evaluating php file $file"
|
||||
__cur_dir=$(pwd)
|
||||
cd $(dirname ${file})
|
||||
RESULT=$(php "$(basename ${file})" 2> /dev/null)
|
||||
cd "$(dirname "${file}")" || { echo "Failed to enter php file directory"; exit 1; }
|
||||
php_result=$(php "$(basename "${file}")" 2> /dev/null)
|
||||
CODE=$?
|
||||
if [[ ${CODE} -ne 0 ]]; then
|
||||
echo "Failed to evaluate php file $file!"
|
||||
|
@ -60,14 +63,14 @@ for file in $(find ${TMP_DIR_NAME} -name '*.php'); do
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd ${__cur_dir}
|
||||
echo "${RESULT}" > "${file::-4}.html"
|
||||
done
|
||||
cd "${__cur_dir}" || { echo "failed to enter original dir"; exit 1; }
|
||||
echo "${php_result}" > "${file::-4}.html"
|
||||
done < <(find "${TMP_DIR_NAME}" -name '*.php' -print0)
|
||||
|
||||
cd ${TMP_DIR_NAME}
|
||||
tar chvzf ${TMP_FILE_NAME} *
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to pack file"
|
||||
cd ${TMP_DIR_NAME} || { echo "failed to enter the temp dir"; exit 1; }
|
||||
tar chvzf ${TMP_FILE_NAME} ./*; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to pack file ($_exit_code)"
|
||||
exit 1
|
||||
fi
|
||||
mv ${TMP_FILE_NAME} ../../../../
|
||||
|
@ -84,16 +87,16 @@ RESP=$(curl \
|
|||
-F "version=$APPLICATION_VERSION" \
|
||||
-F "git_ref=$GIT_HASH" \
|
||||
-F "secret=${teaclient_deploy_secret}" \
|
||||
-F "file=@`pwd`/TeaSpeakUI.tar.gz" \
|
||||
$1
|
||||
-F "file=@$(pwd)/TeaSpeakUI.tar.gz" \
|
||||
"$1"
|
||||
)
|
||||
echo "$RESP"
|
||||
SUCCESS=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
|
||||
SUCCESS=$(echo "${RESP}" | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
|
||||
|
||||
if [[ ! "${SUCCESS}" == "True" ]]; then
|
||||
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['error'])" 2>/dev/null)
|
||||
if [[ $? -ne 0 ]]; then
|
||||
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null)
|
||||
ERROR=$(echo "${RESP}" | python -c "import sys, json; print(json.load(sys.stdin)['error'])" 2>/dev/null); _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
ERROR=$(echo "${RESP}" | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null)
|
||||
fi
|
||||
echo "Failed to deploy build!"
|
||||
echo "${ERROR}"
|
||||
|
|
|
@ -14,13 +14,13 @@ if [[ "$response" != "" ]]; then
|
|||
exit 1
|
||||
else
|
||||
if [[ "$1" == "sort-tag" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
if [[ "$1" == "name" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
if [[ "$1" == "file-name" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
exit 0
|
||||
fi
|
|
@ -1,117 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source `dirname $0`/resolve_commands.sh
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
|
||||
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "debug" ]]; 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 file helper script"
|
||||
npm run compile-file-helper
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate file helper"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Compile vendor XBBCode"
|
||||
execute_ttsc -p ./vendor/xbbcode/tsconfig.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build the XBBCode vendor"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
execute_ttsc ./vendor/emoji-picker/src/jquery.lsxemojipicker.ts
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build the lsxemojipicker vendor"
|
||||
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-codec
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build web worker codec"
|
||||
exit 1
|
||||
fi
|
||||
npm run build-worker-pow
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build web worker pow"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Lets build some tools
|
||||
#dtsgen should be already build by build_declarations.sh
|
||||
./tools/build_trgen.sh
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build typescript translation generator"
|
||||
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_ttsc -p ./shared/tsconfig/tsconfig.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to compile shared sources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building web client source"
|
||||
execute_ttsc -p ./web/tsconfig/tsconfig.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to compile web sources"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating environment"
|
||||
node file.js generate web ${type}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully build!"
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
cd "$(dirname "$0")/../" || { echo "Failed to enter base directory"; exit 1; }
|
||||
|
||||
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "dev" ]]; then
|
||||
source_path="web/environment/development"
|
||||
|
@ -36,19 +35,18 @@ fi
|
|||
|
||||
if [[ -e ${NAME} ]]; then
|
||||
echo "Found old file. Deleting it."
|
||||
rm -r ${NAME}
|
||||
rm -r "${NAME}"
|
||||
fi
|
||||
|
||||
current_path=$(pwd)
|
||||
cd "$source_path"
|
||||
zip -9 -r ${NAME} *
|
||||
cd "$source_path" || { echo "Failed to enter source path"; exit 1; }
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if zip -9 -r "${NAME}" ./*; then
|
||||
echo "Failed to package environment!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$current_path"
|
||||
cd "$current_path" || { echo "Failed to reenter source path"; exit 1; }
|
||||
|
||||
mv "${source_path}/${NAME}" .
|
||||
echo "Release package successfully packaged!"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
#find css/static/ -name '*.css' -exec cat {} \; | npm run csso -- --output `pwd`/generated/static/base.css
|
||||
|
||||
|
||||
|
@ -62,20 +62,20 @@ files=(
|
|||
target_file=`pwd`/../generated/static/base.css
|
||||
|
||||
if [[ ! -d $(dirname ${target_file}) ]]; then
|
||||
echo "Creating target path ($(dirname ${target_file}))"
|
||||
mkdir -p $(dirname ${target_file})
|
||||
echo "Creating target path ($(dirname "${target_file}"))"
|
||||
mkdir -p $(dirname "${target_file}")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to create target path!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "/* Auto generated merged CSS file */" > ${target_file}
|
||||
echo "/* Auto generated merged CSS file */" > "${target_file}"
|
||||
for file in "${files[@]}"; do
|
||||
if [[ ${file} =~ css/* ]]; then
|
||||
file="./${file:4}"
|
||||
fi
|
||||
cat ${file} >> ${target_file}
|
||||
cat "${file}" >> "${target_file}"
|
||||
done
|
||||
|
||||
cat ${target_file} | npm run csso -- --output `pwd`/../generated/static/base.css
|
||||
cat "${target_file}" | npm run csso -- --output "$(pwd)/../generated/static/base.css"
|
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR"
|
||||
source ../scripts/resolve_commands.sh
|
||||
# The app loader
|
||||
execute_ttsc -p tsconfig/tsconfig_packed_loader_app.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate packed loader file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm run minify-web-rel-file `pwd`/generated/loader_app.min.js `pwd`/generated/loader_app.js
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to minimize packed loader file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The popup certaccept loader
|
||||
execute_ttsc -p tsconfig/tsconfig_packed_loader_certaccept.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate packed loader file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm run minify-web-rel-file `pwd`/generated/loader_certaccept.min.js `pwd`/generated/loader_certaccept.js
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to minimize packed loader file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The main shared source
|
||||
execute_ttsc -p tsconfig/tsconfig_packed.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate packed file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The certaccept source
|
||||
execute_ttsc -p tsconfig/tsconfig_packed_certaccept.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate packed certaccept file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm run minify-web-rel-file `pwd`/generated/certaccept.min.js `pwd`/generated/certaccept.js
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to minimize the certaccept file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create packed CSS file
|
||||
./css/generate_packed.sh
|
||||
|
||||
echo "Packed file generated!"
|
||||
exit 0
|
|
@ -0,0 +1,24 @@
|
|||
/* TSC config for the core files of the application, like the file manager and webpack */
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"removeComments": false,
|
||||
},
|
||||
"include": [
|
||||
"webpack.config.ts",
|
||||
"webpack-client.config.ts",
|
||||
"webpack-web.config.ts",
|
||||
|
||||
"webpack/build-definitions.d.ts",
|
||||
"webpack/ManifestPlugin.ts",
|
||||
"webpack/WatLoader.ts",
|
||||
|
||||
"file.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import * as path from "path";
|
||||
import * as config_base from "./webpack.config";
|
||||
|
||||
const config = config_base.config();
|
||||
const config = config_base.config("client");
|
||||
Object.assign(config.entry, {
|
||||
"client-app": "./client/js/index.ts"
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as path from "path";
|
||||
import * as config_base from "./webpack.config";
|
||||
|
||||
const config = config_base.config();
|
||||
const config = config_base.config("web");
|
||||
Object.assign(config.entry, {
|
||||
"shared-app": "./web/js/index.ts"
|
||||
});
|
||||
|
|
|
@ -12,9 +12,8 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
|
||||
export let isDevelopment = process.env.NODE_ENV === 'development';
|
||||
isDevelopment = true;
|
||||
|
||||
const generate_definitions = () => {
|
||||
console.log("Webpacking for %s (%s)", isDevelopment ? "development" : "production", process.env.NODE_ENV || "NODE_ENV not specified");
|
||||
const generate_definitions = (target: string) => {
|
||||
const git_rev = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
|
||||
let version;
|
||||
if(git_rev.indexOf("/") === -1)
|
||||
|
@ -24,16 +23,16 @@ const generate_definitions = () => {
|
|||
|
||||
return {
|
||||
"__build": {
|
||||
target: JSON.stringify("web"),
|
||||
target: JSON.stringify(target),
|
||||
mode: JSON.stringify(isDevelopment ? "debug" : "release"),
|
||||
version: JSON.stringify(version),
|
||||
timestamp: Date.now(),
|
||||
entry_chunk_name: JSON.stringify("shared-app")
|
||||
entry_chunk_name: JSON.stringify(target === "web" ? "shared-app" : "client-app")
|
||||
} as BuildDefinitions
|
||||
} as any;
|
||||
};
|
||||
|
||||
export const config = () => { return {
|
||||
export const config = (target: "web" | "client") => { return {
|
||||
entry: {
|
||||
"loader": "./loader/app/index.ts"
|
||||
},
|
||||
|
@ -64,7 +63,7 @@ export const config = () => { return {
|
|||
minSize: 1024 * 8,
|
||||
maxSize: 1024 * 128
|
||||
}),
|
||||
new webpack.DefinePlugin(generate_definitions())
|
||||
new webpack.DefinePlugin(generate_definitions(target))
|
||||
].filter(e => !!e),
|
||||
module: {
|
||||
rules: [
|
||||
|
@ -123,7 +122,11 @@ export const config = () => { return {
|
|||
{"tc-loader": "window loader"}
|
||||
] as any[],
|
||||
output: {
|
||||
filename: isDevelopment ? '[name].js' : '[contenthash].js',
|
||||
filename: (chunkData) => {
|
||||
if(chunkData.chunk.name === "loader")
|
||||
return "loader.js";
|
||||
return isDevelopment ? '[name].js' : '[contenthash].js';
|
||||
},
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
publicPath: "js/"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue