-
Notifications
You must be signed in to change notification settings - Fork 172
/
preview.sh
executable file
·43 lines (36 loc) · 1.33 KB
/
preview.sh
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
43
#!/bin/bash
if [[ "$1" == "help" || "$1" == "--help" ]]; then
echo "Usage: ./preview.sh [--clean] [version1] [version2] [version3]"
exit 0
fi
if [[ "$1" == "--clean" || "$1" == "-c" ]]; then
shift
CLEAN=true
fi
BUILD_VERSIONS="[\"current\""
for version in $@; do
BUILD_VERSIONS=$BUILD_VERSIONS", \""$version"\""
done
BUILD_VERSIONS=$BUILD_VERSIONS"]"
echo $BUILD_VERSIONS >.build-versions.json
show_yarn_installation_help() {
echo "yarn is not available. yarn comes with corepack. corepack is part of the node runtime package in Homebrew."
echo "You will need to activate corepack by running:"
echo "corepack enable"
echo "Don't install yarn separately from a package manager. With Homebrew, uninstall any existing yarn installation with 'brew uninstall yarn'"
echo "You might have to run 'brew unlink node; brew link node; find /opt/homebrew/bin -type l ! -exec test -e {} \; -delete; corepack enable' to fix the installation."
echo "If 'corepack enable' fails due to file conflicts, remove the conflictings files manually from /opt/homebrew/bin and try again."
}
if ! command -v yarn &>/dev/null; then
show_yarn_installation_help
exit 1
fi
yarn help 2>&1 >/dev/null || {
show_yarn_installation_help
exit 1
}
yarn install
if [[ "$CLEAN" == true ]]; then
yarn run docusaurus clear
fi
yarn start