forked from webstudio-is/webstudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostinstall.sh
More file actions
executable file
·46 lines (34 loc) · 1.42 KB
/
postinstall.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.42 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
#!/bin/bash
echo "Running postinstall.sh"
# Aggressively clean npm and corepack caches
npm cache clean -f
sudo rm -rf /tmp/corepack-cache
sudo rm -rf /usr/local/lib/node_modules/corepack # Manually remove global corepack
# Reinstall corepack globally via npm
npm install -g corepack@latest --force # Install latest corepack version
sudo corepack enable # Re-enable corepack
# Check corepack version after reinstall
corepack --version
# Prepare pnpm (again, after corepack reinstall)
corepack prepare pnpm@9.14.4 --activate
# Go to workspace directory
cd /workspaces/webstudio
# Configure pnpm store directory
pnpm config set store-dir $HOME/.pnpm-store
# Clean up directories (optional)
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
find . -name 'lib' -type d -prune -exec rm -rf '{}' +
find . -name 'build' -type d -prune -exec rm -rf '{}' +
find . -name 'dist' -type d -prune -exec rm -rf '{}' +
find . -name '.cache' -type d -prune -exec rm -rf '{}' +
find . -name '.pnpm-store' -type d -prune -exec rm -rf '{}' +
# Install dependencies, build, and migrate
pnpm install
pnpm build
pnpm migrations migrate
# Add git aliases
cat << 'EOF' >> /home/node/.bashrc
alias gitclean="(git remote | xargs git remote prune) && git branch -vv | egrep '('\$(git remote | xargs | sed -e 's/ /|/g')')/.*: gone]' | awk '{print \$1}' | xargs -r git branch -D"
alias gitrebase="git rebase --interactive main"
EOF
echo "postinstall.sh finished"