From 2e242431ecee4cad3513931bcecec7045cedccab Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Wed, 9 May 2018 01:15:31 +0900
Subject: [PATCH] fixes #287 Add asar unpacked resource for sounds in electron
packager
---
appStore.sh | 7 ++++++-
package.json | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/appStore.sh b/appStore.sh
index 1f0cbdb1..de07d0d4 100755
--- a/appStore.sh
+++ b/appStore.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/zsh -f
# Name of your app.
APP="Whalebird for Mastodon"
@@ -16,6 +16,11 @@ LOGINHELPER_PLIST="./plist/loginhelper.plist"
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"
+# At first, rename app.asar.unpacked directory.
+# Because electron-builder does not store app.asar.unpacked directory.
+# I want to store unpacked files at the same directory as electron-builder.
+mv $APP_PATH/Contents/Resources/app.asar.unpacked/* $APP_PATH/Contents/Resources/
+
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib"
diff --git a/package.json b/package.json
index 817ee70e..aa25787d 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"build:mac": "node .electron-vue/build.js && electron-builder --mac --x64",
"build:linux": "node .electron-vue/build.js && electron-builder --linux --x64",
"build:windows": "node .electron-vue/build.js && electron-builder --win --x64",
- "build:mas": "npm run pack && electron-packager ./ 'Whalebird for Mastodon' --platform=mas --arch=x64 --electron-version=1.8.3 --asar --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/build' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign",
+ "build:mas": "npm run pack && electron-packager ./ 'Whalebird for Mastodon' --platform=mas --arch=x64 --electron-version=1.8.3 --asar.unpackDir='build/sounds' --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign --app-category-type=public.app-category.social-networking",
"dev": "node .electron-vue/dev-runner.js",
"e2e": "npm run pack && mocha test/e2e",
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",