-
Notifications
You must be signed in to change notification settings - Fork 16
/
install.sh
executable file
·70 lines (60 loc) · 2.54 KB
/
install.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
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
#!/bin/bash
# curl -so- https://raw.githubusercontent.com/LivelyKernel/lively.installer/main/web-install.sh | bash
lv_next_dir=$PWD
./scripts/node_version_checker.sh || exit 1
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(":")}`')
mkdir lively.next-node_modules
mkdir snapshots
mkdir esm_cache
mkdir local_projects
mkdir .puppeteer-browser-cache
PROJECT_FOLDER_CREATED=$?
# When we just created the local_projects folder, the partsbin inside cannot exist.
if (( PROJECT_FOLDER_CREATED == 0 ));
then
git clone https://github.com/LivelyKernel/partsbin ./local_projects/LivelyKernel--partsbin
echo "Downloaded up-to-date version of lively.nexts partsbin"
else
cd local_projects
if [ -d "LivelyKernel--partsbin" ];
# `partsbin` exists, we need to update the repository, while preservering its local state.
then
echo "Found an existing lively.next partsbin"
cd LivelyKernel--partsbin
currentBranchName=$(git rev-parse --abbrev-ref HEAD)
stashOutput=$(git stash)
git checkout main
git pull origin main --ff-only
git checkout "$currentBranchName"
# https://stackoverflow.com/a/12973694/4418325
stashOutputWithoutWhiteSpace=$(echo "$stashOutput" | xargs)
if [ "$stashOutputWithoutWhiteSpace" != "No local changes to save" ];
then
git stash pop
fi
echo "Updated existing lively.next partsbin"
cd ..
else
# `partsbin` does not exist yet, we can just clone it.
git clone https://github.com/LivelyKernel/partsbin LivelyKernel--partsbin
echo "Downloaded up-to-date version of lively.nexts partsbin"
fi
cd ..
fi
# set the options for all of the following node invocations
export NODE_OPTIONS="--no-experimental-fetch --no-warnings --experimental-modules --loader $lv_next_dir/flatn/resolver.mjs";
node lively.installer/install-with-node.js $PWD \
env CI=true npm --prefix $lv_next_dir/lively.classes/ run build
if [ "$1" = "--freezer-only" ];
then
exit
fi
if [ -z "${CI}" ];
then
env CI=true npm --prefix $lv_next_dir/lively.freezer/ run build-landing-page
fi
env CI=true npm --prefix $lv_next_dir/lively.freezer/ run build-loading-screen