Skip to content

Commit bccd40e

Browse files
breaking change
Signed-off-by: Nicholas Bucher <[email protected]>
1 parent 0f2c7e5 commit bccd40e

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

.github/workflows/pull_request.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717
- uses: actions/setup-node@v4
1818
with:
1919
node-version-file: ".nvmrc"
20+
- name: Install Yarn
21+
shell: bash
22+
run: |
23+
./ci/circleci/install-yarn.sh
2024
- name: Build
2125
run: |
2226
make build-ui
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
5+
6+
# FUNCTIONS
7+
get_yarn_version () {
8+
if [[ "$NODE_PARAM_YARN_VERSION" == "" ]]; then
9+
YARN_ORB_VERSION=$(curl -s https://cdn.jsdelivr.net/npm/yarn/package.json | sed -n 's/.*version": "\(.*\)".*/\1/p')
10+
echo "Latest version of Yarn is $YARN_ORB_VERSION"
11+
else
12+
YARN_ORB_VERSION="$NODE_PARAM_YARN_VERSION"
13+
14+
echo "Selected version of Yarn is $YARN_ORB_VERSION"
15+
fi
16+
}
17+
18+
installation_check () {
19+
echo "Checking if YARN is already installed..."
20+
if command -v yarn > /dev/null 2>&1; then
21+
if yarn --version | grep "$YARN_ORB_VERSION" > /dev/null 2>&1; then
22+
echo "Yarn $YARN_ORB_VERSION is already installed"
23+
exit 0
24+
else
25+
echo "A different version of Yarn is installed ($(yarn --version)); removing it"
26+
27+
if uname -a | grep Darwin > /dev/null 2>&1; then
28+
brew uninstall yarn > /dev/null 2>&1
29+
elif grep Alpine /etc/issue > /dev/null 2>&1; then
30+
apk del yarn > /dev/null 2>&1
31+
elif grep Debian /etc/issue > /dev/null 2>&1; then
32+
$SUDO apt-get remove yarn > /dev/null 2>&1 && \
33+
$SUDO apt-get purge yarn > /dev/null 2>&1
34+
elif grep Ubuntu /etc/issue > /dev/null 2>&1; then
35+
$SUDO apt-get remove yarn > /dev/null 2>&1 && \
36+
$SUDO apt-get purge yarn > /dev/null 2>&1
37+
elif command -v yum > /dev/null 2>&1; then
38+
yum remove yarn > /dev/null 2>&1
39+
fi
40+
41+
$SUDO rm -rf "$HOME/.yarn" > /dev/null 2>&1
42+
$SUDO rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg > /dev/null 2>&1
43+
fi
44+
fi
45+
}
46+
47+
# cd to home so that yarn --version will not use relative installed yarn from .yarn/releases
48+
cd ~ || echo "Cannot change directory to home directory, yarn version may be mismatched."
49+
50+
get_yarn_version
51+
installation_check
52+
53+
# install yarn
54+
echo "Installing YARN v$YARN_ORB_VERSION"
55+
curl --retry 5 -L -o yarn.tar.gz --silent "https://yarnpkg.com/downloads/$YARN_ORB_VERSION/yarn-v$YARN_ORB_VERSION.tar.gz"
56+
57+
$SUDO tar -xzf yarn.tar.gz && rm yarn.tar.gz
58+
59+
$SUDO mkdir -p /opt/yarn
60+
$SUDO mv yarn-v"${YARN_ORB_VERSION}"/* /opt/yarn
61+
62+
$SUDO rm -rf "yarn-v${YARN_ORB_VERSION}"
63+
64+
$SUDO chmod 777 "/opt/yarn"
65+
66+
$SUDO ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn
67+
$SUDO ln -s /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg
68+
$SUDO ln -s /opt/yarn/bin/yarn.js /usr/local/bin/yarn.js
69+
70+
$SUDO mkdir -p ~/.config
71+
72+
if uname -a | grep Darwin; then
73+
$SUDO chown -R "$USER:$GROUP" ~/.config
74+
$SUDO chown -R "$USER:$GROUP" /opt/yarn
75+
else
76+
$SUDO chown -R "$(whoami):$(whoami)" /opt/yarn
77+
$SUDO chown -R "$(whoami):$(whoami)" ~/.config
78+
fi
79+
80+
# test/verify version
81+
echo "Verifying YARN install"
82+
if yarn --version | grep "$YARN_ORB_VERSION" > /dev/null 2>&1; then
83+
echo "Success! Yarn $(yarn --version) has been installed to $(command -v yarn)"
84+
else
85+
echo "Something went wrong; the specified version of Yarn could not be installed"
86+
exit 1
87+
fi

projects/ui/src/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { App } from "./Components/App";
44
import { ToasterWithOptions } from "./Components/Common/ToasterWithOptions";
55
import { AuthContextProvider } from "./Context/AuthContext";
66

7-
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
7+
ReactDM.createRoot(document.getElementById("root") as HTMLElement).render(
88
<RouterProvider
99
router={createBrowserRouter([
1010
{

0 commit comments

Comments
 (0)