forked from Crownicles/Crownicles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstConfig.sh
More file actions
54 lines (44 loc) · 1.36 KB
/
Copy pathfirstConfig.sh
File metadata and controls
54 lines (44 loc) · 1.36 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
#!/bin/bash
# Set path to the root of the project
cd "$(dirname "$0")/.." || exit
# Define paths to be used
LIB_PATH="./Lib"
DISCORD_PATH="./Discord"
CORE_PATH="./Core"
# Step 1: Remove node_modules and dist folders if they exist
echo "Removing node_modules and dist directories if they exist..."
for dir in "$CORE_PATH" "$DISCORD_PATH" "$LIB_PATH"; do
if [ -d "$dir/node_modules" ]; then
rm -rf "$dir/node_modules"
echo "Removed $dir/node_modules"
fi
if [ -d "$dir/dist" ]; then
rm -rf "$dir/dist"
echo "Removed $dir/dist"
fi
done
# Step 2: Enable corepack
corepack enable
# Step 3: Set Yarn version to stable if not already set
echo "Setting Yarn version to stable..."
YARN_VERSION=$(yarn -v)
yarn set version stable
YARN_NEW_VERSION=$(yarn -v)
if [ "$YARN_VERSION" != "$YARN_NEW_VERSION" ]; then
echo "Yarn version switched from $YARN_VERSION to $YARN_NEW_VERSION"
else
echo "Yarn version is already stable. ($YARN_VERSION)"
fi
# Step 4: Remove package.json at the project root if it exists
if [ -f "./package.json" ]; then
rm "./package.json"
echo "Removed root package.json"
fi
# Step 5: Install dependencies in Core, Discord, and Lib directories
for dir in "$CORE_PATH" "$DISCORD_PATH" "$LIB_PATH"; do
if [ -d "$dir" ]; then
echo "Installing dependencies in $dir..."
(cd "$dir" && yarn install)
fi
done
echo "First-time setup completed successfully!"