Skip to content

Commit

Permalink
do not install dev dependencies in packaged app
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Nov 7, 2017
1 parent 7ed33ea commit 6d2ca3a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ npm-debug.log
/scripts
/app
/dist
/.npmrc
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
43 changes: 24 additions & 19 deletions scripts/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,59 @@

set -e

case $OSTYPE in
darwin*) ;;
*)
echo "This script is only for macOS: ${OSTYPE}"
exit 1
;;
esac
if [[ "$OSTYPE" != darwin* ]]; then
echo "This script is only for macOS: ${OSTYPE}"
exit 1
fi

function app-version() {
./bin/cli.js --version | head -n 1 | cut -d ' ' -f 3
}

function prepare-app() {
if [ -d app ]; then
rm -rf app
fi
mkdir app

npm run lint
npm run build

cp -R bin main renderer resources runtime package.json bower.json bower_components app/
cd app/

npm install --production
npm uninstall electron
npm prune
npm install --production --no-package-lock
npm uninstall electron --production --no-package-lock
npm prune --production --no-package-lock
cd -
}

function pack-app() {
local version="$(./bin/cli.js --version)"
local electron_version="$(electron --version)"
local electron_version=${electron_version#v}
local version electron_version
version="$(app-version)"
electron_version="$(electron --version)"
electron_version=${electron_version#v}

electron-packager ./app --platform=darwin --arch=x64 "--app-copyright=copyright (c) 2017 rhysd" --app-version=$version --build-version=$version --icon=./resources/icon/icon.icns --electron-version=$electron_version --extend-info=./resources/osx_plist/file_associations.plist --app-bundle-id=io.github.rhysd.nyaovim
electron-packager ./app --platform=linux --arch=all "--app-copyright=copyright (c) 2017 rhysd" --app-version=$version --build-version=$version --icon=./resources/icon/icon.ico --electron-version=$electron_version
electron-packager ./app --platform=win32 --arch=all "--app-copyright=copyright (c) 2017 rhysd" --app-version=$version --build-version=$version --icon=./resources/icon/icon.ico --electron-version=$electron_version --version-string=$version
electron-packager ./app --platform=darwin --arch=x64 "--app-copyright=copyright (c) 2017 rhysd" --app-version="$version" --build-version="$version" --icon=./resources/icon/nyaovim-logo.icns --electron-version="$electron_version" --extend-info=./resources/osx_plist/file_associations.plist --app-bundle-id=io.github.rhysd.nyaovim
electron-packager ./app --platform=linux --arch=all "--app-copyright=copyright (c) 2017 rhysd" --app-version="$version" --build-version="$version" --icon=./resources/icon/nyaovim-logo.ico --electron-version="$electron_version"
electron-packager ./app --platform=win32 --arch=all "--app-copyright=copyright (c) 2017 rhysd" --app-version="$version" --build-version="$version" --icon=./resources/icon/nyaovim-logo.ico --electron-version="$electron_version" --version-string="$version"
}

function make-dist() {
local version

if [ -d dist ]; then
rm -rf dist
fi
mkdir dist
local version="$(./bin/cli.js --version | head -n 1 | cut -d ' ' -f 3)"
for dir in `ls -1 | grep '^NyaoVim-'`; do

version="$(app-version)"
for dir in $(ls -1 | grep '^NyaoVim-'); do
mv "$dir/LICENSE" "$dir/LICENSE.electron"
cp -R LICENSE.txt README.md docs "$dir"
zip --symlinks "dist/${dir}-${version}.zip" -r "$dir"
done
rm -rf NyaoVim-*

open dist
}

Expand Down

0 comments on commit 6d2ca3a

Please sign in to comment.