-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·164 lines (143 loc) · 5.53 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·164 lines (143 loc) · 5.53 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
# curl -so- https://raw.githubusercontent.com/LivelyKernel/lively.installer/main/web-install.sh | bash
lv_next_dir=$PWD
# ── Logging helpers ──
ORANGE='\033[1;38;5;208m'
NC='\033[0m'
section() { echo ""; echo -e "${ORANGE}── $1 ──${NC}"; }
step() { echo " $1"; }
info() { echo " $1"; }
success() { echo " $1 done"; }
warn() { echo " [!] $1"; }
error() { echo " [ERROR] $1"; }
print_bun_install_instructions() {
info " Bun is required for supported installs."
info " Install Bun with:"
info " curl -fsSL https://bun.sh/install | bash"
info " Then restart your terminal and verify with:"
info " bun --version"
}
print_rust_install_instructions() {
info " Rust is required for supported installs."
if [ "$(uname -s)" = "Darwin" ]; then
info " On macOS, install the Apple command line tools first:"
info " xcode-select --install"
fi
info " Install Rust with:"
info " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
info " Then restart your terminal and verify with:"
info " rustc --version"
info " cargo --version"
}
echo ""
echo "lively.next installer"
echo "====================="
# ── Check node version ──
./scripts/node_version_checker.sh || exit 1
section "Checking dependencies"
step "node: $(node --version)"
# Check for bun (required for supported package install)
if command -v bun >/dev/null 2>&1; then
export BUN_PATH=$(command -v bun)
step "bun: $(bun --version)"
elif [ -x "$HOME/.bun/bin/bun" ]; then
export BUN_PATH="$HOME/.bun/bin/bun"
export PATH="$HOME/.bun/bin:$PATH"
step "bun: $($BUN_PATH --version)"
else
error "bun not found"
print_bun_install_instructions
exit 1
fi
# Check for Rust toolchain (needed to build SWC plugin)
if command -v cargo >/dev/null 2>&1 && command -v rustc >/dev/null 2>&1 && command -v rustup >/dev/null 2>&1; then
step "rust: $(rustc --version 2>/dev/null | sed 's/rustc //')"
if ! rustup target list --installed 2>/dev/null | grep -q "^wasm32-wasip1$"; then
info " wasm32-wasip1 target will be added during build"
fi
else
error "Rust toolchain not found"
print_rust_install_instructions
exit 1
fi
export PATH=$lv_next_dir:$lv_next_dir/flatn/bin:$PATH
export PUPPETEER_CACHE_DIR=$lv_next_dir/.puppeteer-browser-cache
export FLATN_PACKAGE_DIRS=
export FLATN_PACKAGE_COLLECTION_DIRS=$lv_next_dir/lively.next-node_modules
eval $(node -p 'let PWD=process.cwd();let packages = JSON.parse(require("fs").readFileSync(PWD+"/lively.installer/packages-config.json")).map(ea => require("path").join(PWD, ea.name));`export FLATN_DEV_PACKAGE_DIRS=${packages.join(":")}`')
section "Preparing directories"
mkdir -p lively.next-node_modules snapshots esm_cache local_projects .puppeteer-browser-cache 2>/dev/null
# Partsbin setup
if [ ! -d "local_projects/LivelyKernel--partsbin" ]; then
step "Cloning partsbin..."
git clone --quiet https://github.com/LivelyKernel/partsbin ./local_projects/LivelyKernel--partsbin
step "Partsbin downloaded"
else
step "Updating partsbin..."
cd local_projects/LivelyKernel--partsbin
currentBranchName=$(git rev-parse --abbrev-ref HEAD)
stashOutput=$(git stash 2>/dev/null)
git checkout main --quiet 2>/dev/null
git pull origin main --ff-only --quiet 2>/dev/null
git checkout "$currentBranchName" --quiet 2>/dev/null
stashOutputWithoutWhiteSpace=$(echo "$stashOutput" | xargs)
if [ "$stashOutputWithoutWhiteSpace" != "No local changes to save" ]; then
git stash pop --quiet 2>/dev/null
fi
cd ../..
step "Partsbin up to date"
fi
# set the options for all of the following node invocations
export NODE_OPTIONS="--no-warnings --experimental-modules --loader $lv_next_dir/flatn/resolver.mjs";
section "Installing packages"
if ! node lively.installer/install-with-node.js "$PWD"; then
error "Package installation failed"
exit 1
fi
section "Building class runtime"
step "Compiling lively.classes runtime..."
if ! env CI=true npm --silent --prefix "$lv_next_dir/lively.classes/" run build; then
error "Class runtime build failed"
exit 1
fi
step "Class runtime built"
if [ "$1" = "--freezer-only" ];
then
exit
fi
section "Building SWC plugin"
if ! rustup target list --installed | grep -q "^wasm32-wasip1$"; then
step "Adding Rust target wasm32-wasip1..."
rustup target add wasm32-wasip1 || exit 1
fi
step "Compiling WASM plugin..."
env CI=true npm --silent --prefix $lv_next_dir/lively.freezer/ run build-swc-plugin || exit 1
step "SWC plugin built"
section "Building freezer bundles"
if [ -z "${CI}" ]; then
step "Building unified bundle (landing page + loading screen)..."
if ! env CI=true npm --silent --prefix "$lv_next_dir/lively.freezer/" run build-unified; then
error "Freezer bundle build failed"
exit 1
fi
else
step "Building loading screen..."
if ! env CI=true npm --silent --prefix "$lv_next_dir/lively.freezer/" run build-loading-screen; then
error "Loading screen build failed"
exit 1
fi
fi
if [ -d "$lv_next_dir/lively.app" ] && [ "$1" != "--no-desktop" ]; then
section "Setting up lively.app desktop binary"
# The `nw` npm package's postinstall can't decompress through flatn's flat
# layout, so we download the NW.js SDK directly.
if bash "$lv_next_dir/lively.app/setup.sh"; then
step "NW.js SDK ready (launch the desktop app with: bash lively.app/start.sh)"
else
warn "lively.app setup failed — the web server still works, but the desktop app won't launch"
fi
fi
echo ""
echo "Done! Start the server with ./start-server.sh"
echo "Or launch the desktop app with ./lively.app/start.sh"
echo ""