|
17 | 17 |
|
18 | 18 | set -e
|
19 | 19 |
|
20 |
| -SCRIPT_DIR=`dirname $( readlink -m $( type -p ${0} ))` |
| 20 | +SHORT_NAME="$(uname -s)" |
| 21 | +if [ "$(uname)" == "Darwin" ]; then |
| 22 | + SCRIPT_DIR=`dirname $( realpath $( type -p ${0} ))` |
| 23 | +else |
| 24 | + SCRIPT_DIR=`dirname $( readlink -m $( type -p ${0} ))` |
| 25 | +fi |
21 | 26 | WORK_DIR=${SCRIPT_DIR}/workdir
|
22 | 27 | echo "[INFO] Using the following folder to store all build files ${SCRIPT_DIR}/workdir"
|
23 | 28 | mkdir -p $WORK_DIR
|
|
48 | 53 | export OPENAPI_GENERATOR_COMMIT="v6.3.0"
|
49 | 54 | bash $WORK_DIR/gen/openapi/typescript.sh $WORK_DIR/typescript-models $WORK_DIR/config.sh
|
50 | 55 |
|
51 |
| - sed -i 's/\"name\": \".*\"/"name": "@devfile\/api"/g' $WORK_DIR/typescript-models/package.json |
52 |
| - sed -i 's/\"description\": \".*\"/"description": "Typescript types for devfile api"/g' $WORK_DIR/typescript-models/package.json |
53 |
| - sed -i 's/\"repository\": \".*\"/"repository": "devfile\/api"/g' $WORK_DIR/typescript-models/package.json |
54 |
| - sed -i 's/\"license\": \".*\"/"license": "Apache-2.0"/g' $WORK_DIR/typescript-models/package.json |
55 |
| - sed -i 's/\"@types\/bluebird\": \".*\"/"@types\/bluebird": "3.5.21"/g' $WORK_DIR/typescript-models/package.json |
| 56 | + apply_sed 's/\"name\": \".*\"/"name": "@devfile\/api"/g' $WORK_DIR/typescript-models/package.json |
| 57 | + apply_sed 's/\"description\": \".*\"/"description": "Typescript types for devfile api"/g' $WORK_DIR/typescript-models/package.json |
| 58 | + apply_sed 's/\"repository\": \".*\"/"repository": "devfile\/api"/g' $WORK_DIR/typescript-models/package.json |
| 59 | + apply_sed 's/\"license\": \".*\"/"license": "Apache-2.0"/g' $WORK_DIR/typescript-models/package.json |
| 60 | + apply_sed 's/\"@types\/bluebird\": \".*\"/"@types\/bluebird": "3.5.21"/g' $WORK_DIR/typescript-models/package.json |
| 61 | + |
56 | 62 | echo "" > $WORK_DIR/typescript-models/.npmignore
|
57 | 63 | echo "[INFO] Generated typescript model which now is available in $WORK_DIR/typescript-models"
|
58 | 64 | }
|
@@ -80,6 +86,14 @@ build_typescript_model() {
|
80 | 86 | echo "[INFO] Done."
|
81 | 87 | }
|
82 | 88 |
|
| 89 | +apply_sed(){ |
| 90 | + if [ "$(uname)" == "Darwin" ]; then |
| 91 | + sed -i '' "$@" |
| 92 | + else |
| 93 | + sed -i "$@" |
| 94 | + fi |
| 95 | +} |
| 96 | + |
83 | 97 | generate_swagger_json
|
84 | 98 | k8s_client_gen
|
85 | 99 | generate_typescript_metadata
|
|
0 commit comments