Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 50dfebd

Browse files
committed
remove hard-coded product name from dist/build.sh
Fixes #758
1 parent ad6a67b commit 50dfebd

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

app/config/envs/ibm.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
"userAgent": "IBM Cloud Functions Shell",
77
"cssTheme": "ibm.css",
88
"appIcon": "../assets/icons/png/blue-dolphin-transparent.png",
9-
"largeIcon": "content/icons/svg/blue-dolphin.svg"
9+
"largeIcon": "content/icons/svg/blue-dolphin.svg",
10+
"filesystemIcons": {
11+
"darwin": "../assets/icons/icns/blue-dolphin-transparent.icns",
12+
"win32": "../assets/icons/ico/blue-dolphin-transparent.ico",
13+
"linux": "../assets/icons/png/blue-dolphin-transparent.png"
14+
}
1015
}

dist/build.sh

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22

33
#
44
# input params: choose a platform to build for (default: all)
5-
# and choose a name for the app (default: IBM Cloud Functions Shell)
65
#
76
PLATFORM=${1-all}
8-
APP_NAME="${APP_NAME-IBM Cloud Functions Shell}"
97

10-
VERSION=`git rev-parse master`
11-
BUILDDIR=build
8+
# product name
9+
PRODUCT_NAME="${PRODUCT_NAME-`cat ../build/config.json | jq --raw-output .productName`"
1210
13-
# openwhisk icons
14-
#ICON_MAC=../assets/icons/icns/OpenWhisk-512x512.icns
15-
#ICON_WIN32=../assets/icons/ico/openwhisk_512x512_jnb_icon.ico
11+
# filesystem icons
12+
ICON_MAC=`cat ../build/config.json | jq --raw-output .filesystemIcons.darwin`
13+
ICON_WIN32=`cat ../build/config.json | jq --raw-output .filesystemIcons.win32`
14+
ICON_LINUX=`cat ../build/config.json | jq --raw-output .filesystemIcons.linux`
1615
17-
# dolphin icons
18-
ICON_MAC=../assets/icons/icns/blue-dolphin-transparent.icns
19-
ICON_WIN32=../assets/icons/ico/blue-dolphin-transparent.ico
20-
ICON_LINUX=../assets/icons/png/blue-dolphin-transparent.png
16+
VERSION=`git rev-parse master`
17+
BUILDDIR=build
2118
2219
function init {
2320
# make the build directory
@@ -58,26 +55,26 @@ function win32 {
5855
# create the bundles
5956
./node_modules/.bin/electron-packager \
6057
../app \
61-
"$APP_NAME" \
58+
"$PRODUCT_NAME" \
6259
--asar=true \
6360
--build-version=$VERSION \
6461
--out=$BUILDDIR \
6562
--platform=win32 \
6663
--icon=$ICON_WIN32 \
67-
--protocol=wsk --protocol-name="Execute ${APP_NAME} commands" \
64+
--protocol=wsk --protocol-name="Execute ${PRODUCT_NAME} commands" \
6865
--overwrite \
6966
--win32metadata.CompanyName="Apache" \
70-
--win32metadata.ProductName="${APP_NAME}"
67+
--win32metadata.ProductName="${PRODUCT_NAME}"
7168
7269
# CLI scripts
73-
cp ../app/bin/fsh "$BUILDDIR/${APP_NAME}-win32-x64/fsh"
74-
cp ../app/bin/fsh.bat "$BUILDDIR/${APP_NAME}-win32-x64"
70+
cp ../app/bin/fsh "$BUILDDIR/${PRODUCT_NAME}-win32-x64/fsh"
71+
cp ../app/bin/fsh.bat "$BUILDDIR/${PRODUCT_NAME}-win32-x64"
7572
7673
#
7774
# deal with win32 packaging
7875
#
7976
if [ -z "$NO_INSTALLER" ]; then
80-
(cd $BUILDDIR && zip -q -r "${APP_NAME}-win32-x64" "${APP_NAME}-win32-x64" -x \*~)
77+
(cd $BUILDDIR && zip -q -r "${PRODUCT_NAME}-win32-x64" "${PRODUCT_NAME}-win32-x64" -x \*~)
8178
fi
8279
fi
8380
}
@@ -90,30 +87,30 @@ function mac {
9087
if [ "$PLATFORM" == "all" ] || [ "$PLATFORM" == "mac" ] || [ "$PLATFORM" == "macos" ] || [ "$PLATFORM" == "darwin" ]; then
9188
./node_modules/.bin/electron-packager \
9289
../app \
93-
"${APP_NAME}" \
90+
"${PRODUCT_NAME}" \
9491
--asar=true \
9592
--build-version=$VERSION \
9693
--ignore='~$' \
9794
--out=$BUILDDIR \
9895
--platform=darwin \
9996
--icon=$ICON_MAC \
100-
--protocol=wsk --protocol-name="Execute ${APP_NAME} commands" \
97+
--protocol=wsk --protocol-name="Execute ${PRODUCT_NAME} commands" \
10198
--overwrite
10299
103100
# use a custom icon for mac
104-
cp $ICON_MAC "$BUILDDIR/${APP_NAME}-darwin-x64/${APP_NAME}.app/Contents/Resources/electron.icns"
101+
cp $ICON_MAC "$BUILDDIR/${PRODUCT_NAME}-darwin-x64/${PRODUCT_NAME}.app/Contents/Resources/electron.icns"
105102
106103
# CLI script
107-
cp ../app/bin/fsh "$BUILDDIR/${APP_NAME}-darwin-x64/${APP_NAME}.app/Contents/MacOS/"
104+
cp ../app/bin/fsh "$BUILDDIR/${PRODUCT_NAME}-darwin-x64/${PRODUCT_NAME}.app/Contents/MacOS/"
108105
109106
# create the installers
110107
if [ -n "$ZIP_INSTALLER" ]; then
111-
(cd $BUILDDIR && zip -q -r "${APP_NAME}-darwin-x64" "${APP_NAME}-darwin-x64" -x \*~)
108+
(cd $BUILDDIR && zip -q -r "${PRODUCT_NAME}-darwin-x64" "${PRODUCT_NAME}-darwin-x64" -x \*~)
112109
113110
elif [ -z "$NO_INSTALLER" ]; then
114111
./node_modules/.bin/electron-installer-dmg \
115-
"$BUILDDIR/${APP_NAME}-darwin-x64/${APP_NAME}.app" \
116-
"${APP_NAME}" \
112+
"$BUILDDIR/${PRODUCT_NAME}-darwin-x64/${PRODUCT_NAME}.app" \
113+
"${PRODUCT_NAME}" \
117114
--out=$BUILDDIR \
118115
--icon=$ICON_MAC \
119116
--icon-size=128 \
@@ -129,20 +126,20 @@ function linux {
129126
if [ "$PLATFORM" == "all" ] || [ "$PLATFORM" == "linux" ]; then
130127
./node_modules/.bin/electron-packager \
131128
../app \
132-
"${APP_NAME}" \
129+
"${PRODUCT_NAME}" \
133130
--asar=true \
134131
--build-version=$VERSION \
135132
--out=$BUILDDIR \
136133
--platform=linux \
137-
--protocol=wsk --protocol-name="Execute ${APP_NAME} commands" \
134+
--protocol=wsk --protocol-name="Execute ${PRODUCT_NAME} commands" \
138135
--icon=$ICON_LINUX \
139136
--overwrite
140137
141138
# CLI script
142-
cp ../app/bin/fsh "$BUILDDIR/${APP_NAME}-linux-x64"
139+
cp ../app/bin/fsh "$BUILDDIR/${PRODUCT_NAME}-linux-x64"
143140
144141
if [ -z "$NO_INSTALLER" ]; then
145-
(cd $BUILDDIR && zip -q -r "${APP_NAME}-linux-x64" "${APP_NAME}-linux-x64" -x \*~)
142+
(cd $BUILDDIR && zip -q -r "${PRODUCT_NAME}-linux-x64" "${PRODUCT_NAME}-linux-x64" -x \*~)
146143
fi
147144
fi
148145
}
@@ -154,7 +151,3 @@ win32
154151
mac
155152
linux
156153
cleanup
157-
158-
# TODO:
159-
# upload to OS
160-
# (cd ../prebuilt && npm version publish)

0 commit comments

Comments
 (0)