From ab8cc193cece1bd7725fcd31b98aa67e44524430 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Tue, 27 Feb 2024 12:51:57 -0500 Subject: [PATCH 1/2] add mac os support for build Signed-off-by: Jordan Dubrick --- build/typescript-model/generate.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/build/typescript-model/generate.sh b/build/typescript-model/generate.sh index 23504c9f6..f9520cdaf 100755 --- a/build/typescript-model/generate.sh +++ b/build/typescript-model/generate.sh @@ -17,7 +17,12 @@ set -e -SCRIPT_DIR=`dirname $( readlink -m $( type -p ${0} ))` +SHORT_NAME="$(uname -s)" +if [ "$(uname)" == "Darwin" ]; then + SCRIPT_DIR=`dirname $( realpath $( type -p ${0} ))` +else + SCRIPT_DIR=`dirname $( readLink -m $( type -p ${0} ))` +fi WORK_DIR=${SCRIPT_DIR}/workdir echo "[INFO] Using the following folder to store all build files ${SCRIPT_DIR}/workdir" mkdir -p $WORK_DIR @@ -48,11 +53,12 @@ EOF export OPENAPI_GENERATOR_COMMIT="v6.3.0" bash $WORK_DIR/gen/openapi/typescript.sh $WORK_DIR/typescript-models $WORK_DIR/config.sh - sed -i 's/\"name\": \".*\"/"name": "@devfile\/api"/g' $WORK_DIR/typescript-models/package.json - sed -i 's/\"description\": \".*\"/"description": "Typescript types for devfile api"/g' $WORK_DIR/typescript-models/package.json - sed -i 's/\"repository\": \".*\"/"repository": "devfile\/api"/g' $WORK_DIR/typescript-models/package.json - sed -i 's/\"license\": \".*\"/"license": "Apache-2.0"/g' $WORK_DIR/typescript-models/package.json - sed -i 's/\"@types\/bluebird\": \".*\"/"@types\/bluebird": "3.5.21"/g' $WORK_DIR/typescript-models/package.json + apply_sed 's/\"name\": \".*\"/"name": "@devfile\/api"/g' $WORK_DIR/typescript-models/package.json + apply_sed 's/\"description\": \".*\"/"description": "Typescript types for devfile api"/g' $WORK_DIR/typescript-models/package.json + apply_sed 's/\"repository\": \".*\"/"repository": "devfile\/api"/g' $WORK_DIR/typescript-models/package.json + apply_sed 's/\"license\": \".*\"/"license": "Apache-2.0"/g' $WORK_DIR/typescript-models/package.json + apply_sed 's/\"@types\/bluebird\": \".*\"/"@types\/bluebird": "3.5.21"/g' $WORK_DIR/typescript-models/package.json + echo "" > $WORK_DIR/typescript-models/.npmignore echo "[INFO] Generated typescript model which now is available in $WORK_DIR/typescript-models" } @@ -80,6 +86,14 @@ build_typescript_model() { echo "[INFO] Done." } +apply_sed(){ + if [ "$(uname)" == "Darwin" ]; then + sed -i '' "$@" + else + sed -i "$@" + fi +} + generate_swagger_json k8s_client_gen generate_typescript_metadata From 6b9cfed7641d1b04c34c88e079ae7b49bade8d5e Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Tue, 27 Feb 2024 12:55:58 -0500 Subject: [PATCH 2/2] update readlink typo Signed-off-by: Jordan Dubrick --- build/typescript-model/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/typescript-model/generate.sh b/build/typescript-model/generate.sh index f9520cdaf..79f42022b 100755 --- a/build/typescript-model/generate.sh +++ b/build/typescript-model/generate.sh @@ -21,7 +21,7 @@ SHORT_NAME="$(uname -s)" if [ "$(uname)" == "Darwin" ]; then SCRIPT_DIR=`dirname $( realpath $( type -p ${0} ))` else - SCRIPT_DIR=`dirname $( readLink -m $( type -p ${0} ))` + SCRIPT_DIR=`dirname $( readlink -m $( type -p ${0} ))` fi WORK_DIR=${SCRIPT_DIR}/workdir echo "[INFO] Using the following folder to store all build files ${SCRIPT_DIR}/workdir"