-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-openapply.command
More file actions
executable file
·42 lines (36 loc) · 1.18 KB
/
Copy pathstart-openapply.command
File metadata and controls
executable file
·42 lines (36 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -u
APP_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
export PATH
OPENAPPLY_NODE=""
for OPENAPPLY_CANDIDATE in \
"${NODE_BIN:-}" \
"$(command -v node 2>/dev/null || true)" \
/opt/homebrew/bin/node \
/usr/local/bin/node \
"${HOME:-}/.volta/bin/node" \
"${HOME:-}"/.nvm/versions/node/*/bin/node \
"${HOME:-}"/.local/share/fnm/node-versions/*/installation/bin/node \
"${HOME:-}/Library/Application Support/fnm"/node-versions/*/installation/bin/node
do
if [ -x "${OPENAPPLY_CANDIDATE}" ] && "${OPENAPPLY_CANDIDATE}" -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 20 ? 0 : 1)' >/dev/null 2>&1; then
OPENAPPLY_NODE="${OPENAPPLY_CANDIDATE}"
break
fi
done
if [ -z "${OPENAPPLY_NODE}" ]; then
echo "Node.js 20 ou plus récent est nécessaire pour lancer OpenApply."
echo "Installation : https://nodejs.org/"
printf "Appuie sur Entrée pour fermer..."
read -r _answer
exit 1
fi
cd "${APP_ROOT}" || exit 1
"${OPENAPPLY_NODE}" scripts/start.mjs
OPENAPPLY_STATUS=$?
if [ "${OPENAPPLY_STATUS}" -ne 0 ]; then
printf "Appuie sur Entrée pour fermer..."
read -r _answer
fi
exit "${OPENAPPLY_STATUS}"