-
Notifications
You must be signed in to change notification settings - Fork 215
Expand file tree
/
Copy pathpreview.sh
More file actions
executable file
·58 lines (51 loc) · 2.08 KB
/
Copy pathpreview.sh
File metadata and controls
executable file
·58 lines (51 loc) · 2.08 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/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() {
local brew_prefix
brew_prefix="$(brew --prefix 2>/dev/null || echo "/opt/homebrew")"
echo "*** yarn / Corepack is not working. ***"
echo
echo "If you see any of the following errors, the fix is almost always to run 'corepack enable':"
echo " - 'command not found: yarn'"
echo " - 'Internal Error: ... does not match the signature' / 'Cannot find matching keyid' (Corepack signature errors)"
echo " - 'Cannot find module' errors when yarn starts"
echo " - any other unexpected error from the Node.js package manager on a fresh machine"
echo
echo "Run this first:"
echo " corepack enable"
echo
echo "Background: yarn is distributed via Corepack, which is bundled with the Node runtime."
echo "Corepack must be activated once per Node installation before yarn can be used."
echo
echo "Install Node.js 24 LTS either with fnm (https://github.com/Schniz/fnm) or with Homebrew."
echo "Don't install yarn separately from a package manager. With Homebrew, uninstall any existing yarn installation with 'brew uninstall yarn'"
echo "If 'corepack enable' still fails, delete the broken symlinks in Homebrew's bin and run it again:"
echo " find ${brew_prefix}/bin -type l ! -exec test -e {} \; -delete && corepack enable"
echo "If it still fails due to file conflicts, remove the conflicting files manually from ${brew_prefix}/bin and try again."
}
if ! command -v yarn &>/dev/null; then
show_yarn_installation_help
exit 1
fi
yarn help >/dev/null 2>&1 || {
show_yarn_installation_help
exit 1
}
yarn install
if [[ "$CLEAN" == true ]]; then
yarn run docusaurus clear
fi
yarn start