From 6d2ca3a565496870a9a34de7245f229908d54a55 Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 8 Nov 2017 01:16:04 +0900 Subject: [PATCH] do not install dev dependencies in packaged app --- .npmignore | 1 + .npmrc | 1 + scripts/make-release.sh | 43 +++++++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 .npmrc diff --git a/.npmignore b/.npmignore index 846e77a..aad8b3a 100644 --- a/.npmignore +++ b/.npmignore @@ -7,3 +7,4 @@ npm-debug.log /scripts /app /dist +/.npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/scripts/make-release.sh b/scripts/make-release.sh index 60b4ffe..0e58922 100755 --- a/scripts/make-release.sh +++ b/scripts/make-release.sh @@ -2,13 +2,14 @@ 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 @@ -16,40 +17,44 @@ function prepare-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 }