Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/scripts/node-electron.sh
5237 views
1
#!/usr/bin/env bash
2
3
if [[ "$OSTYPE" == "darwin"* ]]; then
4
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
5
ROOT=$(dirname $(dirname $(realpath "$0")))
6
else
7
ROOT=$(dirname $(dirname $(readlink -f $0)))
8
fi
9
10
pushd $ROOT
11
12
if [[ "$OSTYPE" == "darwin"* ]]; then
13
NAME=`node -p "require('./product.json').nameLong"`
14
EXE_NAME=`node -p "require('./product.json').nameShort"`
15
CODE="$ROOT/.build/electron/$NAME.app/Contents/MacOS/$EXE_NAME"
16
else
17
NAME=`node -p "require('./product.json').applicationName"`
18
CODE="$ROOT/.build/electron/$NAME"
19
fi
20
21
# Get electron
22
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
23
npm run electron
24
fi
25
26
popd
27
28
export VSCODE_DEV=1
29
if [[ "$OSTYPE" == "darwin"* ]]; then
30
ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
31
"$CODE" \
32
"$@"
33
else
34
ELECTRON_RUN_AS_NODE=1 \
35
"$CODE" \
36
"$@"
37
fi
38
39