build(desktop): improve desktop build process, update assets

This commit is contained in:
Jason Dreyzehner 2016-10-19 02:29:42 -04:00
commit 27dc7c595e
75 changed files with 130 additions and 128 deletions

View file

@ -65,6 +65,10 @@ Object.keys(templates).forEach(function(k) {
if(k === 'config-template.xml'){
k = 'config.xml';
}
if (!fs.existsSync('../' + targetDir)){
fs.mkdirSync('../' + targetDir);
}
fs.writeFileSync('../' + targetDir + k, content, 'utf8');
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

View file

@ -17,13 +17,18 @@ fi
# set up your app name, architecture, and background image file name
APP_NAME="*USERVISIBLENAME*"
DMG_BACKGROUND_IMG="Background.png"
rm dmg-background.tiff
ln -s ../resources/*PACKAGENAME*/mac/dmg-background.tiff dmg-background.tiff
rm volume-icon.icns
ln -s ../resources/*PACKAGENAME*/mac/volume-icon.icns volume-icon.icns
DMG_VOLUME_ICON="volume-icon.icns"
DMG_BACKGROUND_IMG="dmg-background.tiff"
PATH_NAME="${APP_NAME}/osx64/"
# you should not need to change these
APP_EXE="${PATH_NAME}${APP_NAME}.app/Contents/MacOS/nwjs"
VOL_NAME="${APP_NAME}-osx"
VOL_NAME="${APP_NAME}"
DMG_TMP="${VOL_NAME}-temp.dmg"
DMG_FINAL="${VOL_NAME}.dmg"
STAGING_DIR="tmp"
@ -95,17 +100,43 @@ DEVICE=$(hdiutil attach -readwrite -noverify "${DMG_TMP}" | \
sleep 2
# add a link to the Applications dir
echo "Add link to /Applications"
echo "Adding link to /Applications"
pushd /Volumes/"${VOL_NAME}"
ln -s /Applications
# We name the symlink with a *non-breaking space* to avoid displaying extra text
ln -s /Applications " " # <- not your ordinary space
popd
# "bless" the folder to open it in Finder automatically when the volume is mounted
echo "Blessing disk image"
bless --folder /Volumes/"${VOL_NAME}" --openfolder /Volumes/"${VOL_NAME}"
# add a background image
echo "Adding background to disk image"
mkdir /Volumes/"${VOL_NAME}"/.background
cp "${DMG_BACKGROUND_IMG}" /Volumes/"${VOL_NAME}"/.background/
echo "Adding volume icon to disk image"
# use fileicon node_module
cp "${DMG_VOLUME_ICON}" /Volumes/"${VOL_NAME}"/.VolumeIcon.icns
`npm bin`/fileicon set /Volumes/"${VOL_NAME}"/ /Volumes/"${VOL_NAME}"/.VolumeIcon.icns
# tell the Finder to resize the window, set the background,
# change the icon size, place the icons in the right position, etc.
echo "Designing the unboxing experience..."
WINDOW_X=400
WINDOW_Y=100
WINDOW_WIDTH=500
WINDOW_HEIGHT=375
ICON_SIZE=100
ICON_LR_PADDING=140
ICON_Y=185
WINDOW_RIGHT=$(expr $WINDOW_X + $WINDOW_WIDTH)
WINDOW_BOTTOM=$(expr $WINDOW_Y + $WINDOW_HEIGHT)
RIGHT_ICON_PADDING_RIGHT=$(expr $WINDOW_WIDTH - $ICON_LR_PADDING)
HIDE_X=100 # no need to exceed WINDOW_WIDTH will only create another scrollbar
HIDE_Y=$(expr $WINDOW_HEIGHT + $ICON_SIZE)
echo '
tell application "Finder"
tell disk "'${VOL_NAME}'"
@ -113,13 +144,17 @@ echo '
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 920, 440}
set the bounds of container window to {'${WINDOW_X}', '${WINDOW_Y}', '${WINDOW_RIGHT}', '${WINDOW_BOTTOM}'}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to 72
set icon size of viewOptions to '${ICON_SIZE}'
set background picture of viewOptions to file ".background:'${DMG_BACKGROUND_IMG}'"
set position of item "'${APP_NAME}'.app" of container window to {160, 205}
set position of item "Applications" of container window to {360, 205}
set position of item "'${APP_NAME}'.app" of container window to {'${ICON_LR_PADDING}', '${ICON_Y}'}
set position of item " " of container window to {'${RIGHT_ICON_PADDING_RIGHT}', '${ICON_Y}'}
set position of item ".background" of container window to {'${HIDE_X}', '${HIDE_Y}'}
set position of item ".VolumeIcon.icns" of container window to {'${HIDE_X}', '${HIDE_Y}'}
set position of item ".fseventsd" of container window to {'${HIDE_X}', '${HIDE_Y}'}
set position of item "Icon?" of container window to {'${HIDE_X}', '${HIDE_Y}'}
close
open
update without registering applications

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

View file

@ -1,4 +1,7 @@
{
"//":"Having trouble with this file? Try `npm run reset`",
"//":"Want git to ignore changes to this file? Run `npm run ignore`",
"name": "*PACKAGENAME*",
"description": "*DESCRIPTION*",
"author": "BitPay",
@ -79,8 +82,7 @@
"shelljs": "^0.3.0"
},
"scripts": {
"preinstall": "bower install && npm install fs-extra",
"postinstall": "echo && echo \"To finish, choose a distribution by running 'npm run apply:copay' or 'npm run apply:bitpay'.\" && echo",
"postinstall": "bower install && echo && echo \"To finish, choose a distribution by running 'npm run apply:copay' or 'npm run apply:bitpay'.\" && echo",
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s",
"start:ios": "npm run build:www && npm run build:ios && npm run open:ios",
"start:android": "npm run build:www && npm run build:android && npm run run:android",
@ -98,21 +100,24 @@
"final:www": "npm run build:www-release",
"final:ios": "npm run final:www && npm run build:ios-release && npm run open:ios",
"final:android": "npm run final:www && npm run build:android-release && npm run run:android",
"final:desktop": "grunt desktop",
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
"final:desktop": "npm run build:desktop && npm run build:macos",
"run:android": "cordova run android --device",
"log:android": "adb logcat | grep chromium",
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
"apply:copay": "cd app-template && node apply.js copay && cordova prepare",
"apply:bitpay": "cd app-template && node apply.js bitpay && cordova prepare",
"test": "./node_modules/.bin/grunt test-coveralls",
"clean": "trash platforms && trash plugins && cordova prepare",
"clean-all": "git clean -dfx && npm install"
"ignore": "git update-index --skip-worktree package.json",
"reset": "git update-index --no-skip-worktree package.json",
"clean-all": "npm run reset && git clean -dfx"
},
"devDependencies": {
"cordova": "^6.3.1",
"grunt": "^1.0.1",
"ionic": "^2.1.0",
"trash-cli": "^1.4.0",
"lodash": "^4.3.0"
"lodash": "^4.3.0",
"fileicon": "^0.1.8"
}
}