2016-02-18 05:47:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-11-13 13:39:38 +00:00
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
2017-02-21 20:22:01 +00:00
|
|
|
ROOT=$(dirname "$(dirname "$(realpath "$0")")")
|
2018-07-23 14:34:16 +00:00
|
|
|
|
|
|
|
# On Linux with Electron 2.0.x running out of a VM causes
|
|
|
|
# a freeze so we only enable this flag on macOS
|
|
|
|
export ELECTRON_ENABLE_LOGGING=1
|
2015-11-13 13:39:38 +00:00
|
|
|
else
|
2017-02-21 20:22:01 +00:00
|
|
|
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
|
2015-11-13 13:39:38 +00:00
|
|
|
fi
|
|
|
|
|
2015-11-26 08:29:43 +00:00
|
|
|
function code() {
|
2017-02-21 20:22:01 +00:00
|
|
|
cd "$ROOT"
|
2015-11-13 13:39:38 +00:00
|
|
|
|
2016-08-09 15:13:08 +00:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-08-09 15:56:05 +00:00
|
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
2016-08-09 15:13:08 +00:00
|
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
|
|
|
else
|
|
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
2016-08-09 15:57:09 +00:00
|
|
|
CODE=".build/electron/$NAME"
|
2016-08-09 15:13:08 +00:00
|
|
|
fi
|
|
|
|
|
2015-11-26 08:29:43 +00:00
|
|
|
# Node modules
|
2017-11-16 09:47:02 +00:00
|
|
|
test -d node_modules || yarn
|
2015-11-13 13:39:38 +00:00
|
|
|
|
2015-11-26 08:29:43 +00:00
|
|
|
# Get electron
|
2017-11-16 13:43:41 +00:00
|
|
|
node build/lib/electron.js || ./node_modules/.bin/gulp electron
|
2015-11-26 08:29:43 +00:00
|
|
|
|
2018-01-29 21:04:27 +00:00
|
|
|
# Manage built-in extensions
|
|
|
|
if [[ "$1" == "--builtin" ]]; then
|
|
|
|
exec "$CODE" build/builtin
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-01-29 11:23:43 +00:00
|
|
|
# Sync built-in extensions
|
|
|
|
node build/lib/builtInExtensions.js
|
2018-01-23 15:40:41 +00:00
|
|
|
|
2015-11-26 09:07:11 +00:00
|
|
|
# Build
|
2016-03-03 19:49:26 +00:00
|
|
|
test -d out || ./node_modules/.bin/gulp compile
|
2015-11-26 09:07:11 +00:00
|
|
|
|
2015-11-26 08:29:43 +00:00
|
|
|
# Configuration
|
|
|
|
export NODE_ENV=development
|
|
|
|
export VSCODE_DEV=1
|
2016-08-08 14:12:32 +00:00
|
|
|
export VSCODE_CLI=1
|
2015-11-26 08:29:43 +00:00
|
|
|
export ELECTRON_ENABLE_STACK_DUMPING=1
|
|
|
|
|
|
|
|
# Launch Code
|
2016-08-09 15:13:08 +00:00
|
|
|
exec "$CODE" . "$@"
|
2015-11-26 08:29:43 +00:00
|
|
|
}
|
|
|
|
|
2017-04-11 14:05:21 +00:00
|
|
|
# Use the following to get v8 tracing:
|
|
|
|
# code --js-flags="--trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces" "$@"
|
|
|
|
|
2016-02-18 05:47:09 +00:00
|
|
|
code "$@"
|