aboutsummaryrefslogtreecommitdiff
path: root/local.sh
blob: e6dc7ee2b5e18732d3cfb28c6d5b69d93ba7c43a (plain)
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
#!/bin/bash

# export ROAM_PATH=/path/to/org-roam/src
# export ROAM_DB_FILE=org-roam.db

ROAM_DB_PATH=$ROAM_PATH/$ROAM_DB_FILE
ROAM_IMG_PATH=$ROAM_PATH/img

# If org-roam-ui directory does not exists, clone the org-roam-ui repository.
if [ ! -d "org-roam-ui" ]; then
    git clone -b publish-org-roam-ui https://github.com/ikoamu/org-roam-ui
fi

# Generate data for org-roam-ui
npm install
npm run generate:graphdata --script_params=$ROAM_DB_PATH
./create_notes.sh $ROAM_PATH
npm run generate:search

# Copy files to the org-roam-ui directory
cp -f searchdata.json org-roam-ui/components/Search/
if [ -d $ROAM_IMG_PATH ]; then
    cp -r $ROAM_IMG_PATH org-roam-ui/public
fi

pushd org-roam-ui
yarn install
pushd standalone
./build-standalone-server.sh ../..
if [ -d "../../out" ]; then
    rm -rf ../../out
fi
mv out ../../
popd
popd