forked from thirdweb-dev/js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-pnpm.sh
executable file
·43 lines (37 loc) · 1.26 KB
/
setup-pnpm.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
#!/usr/bin/env bash
set -e
echo "Setting up environment..."
# check if pnpm is installed
if ! command -v pnpm &> /dev/null
then
echo "⌛️ \"pnpm\" seems to not be installed, installing it now..."
# if not, install it using corepack if that is available
if command -v corepack &> /dev/null
then
corepack enable
corepack prepare [email protected] --activate
else
# if not, install it using npm
npm install -g pnpm
fi
else
# if it is, just confirm that to the user
echo "✅ \"pnpm\" is already installed"
fi
# check if there is still a leftover yarn.lock file
if [ -f "yarn.lock" ]
then
echo "⌛️ \"yarn.lock\" file found, removing it..."
rm yarn.lock
echo "✅ \"yarn.lock\" file removed"
# if we had a yarn lock we likely also have to remove all node_modules folders
echo "⌛️ Removing all \"node_modules\" folders in project..."
find ./ -name "node_modules" -type d -exec rm -rf {} \;
echo "✅ Removed all \"node_modules\" folders in project"
fi
# after all of that we'll want to re-install dependencies using pnpm
echo "⌛️ Installing dependencies using \"pnpm\"..."
pnpm install
echo "✅ Installed dependencies using \"pnpm\""
# we're finished
echo "✅ Environment setup complete"