aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--action.yml2
-rw-r--r--generate_graphdata.js (renamed from generate_json.js)1
-rwxr-xr-xlocal.sh31
-rw-r--r--package.json2
5 files changed, 36 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index d22afe2..b63e158 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@ DS_Store
graphdata.json
searchdata.json
notes/
+org-roam-ui/
+out/ \ No newline at end of file
diff --git a/action.yml b/action.yml
index 36778ea..af51b3b 100644
--- a/action.yml
+++ b/action.yml
@@ -58,7 +58,7 @@ runs:
shell: bash
- name: Generate graphdata.json
working-directory: action
- run: npm run generate --script_params='../orgs/${{ inputs.org-roam-directory }}/${{ inputs.org-roam-db-filename }}'
+ run: npm run generate:graphdata --script_params='../orgs/${{ inputs.org-roam-directory }}/${{ inputs.org-roam-db-filename }}'
shell: bash
- name: Create Notes
working-directory: action
diff --git a/generate_json.js b/generate_graphdata.js
index 9649443..0a627a8 100644
--- a/generate_json.js
+++ b/generate_graphdata.js
@@ -1,4 +1,5 @@
console.log("db file", process.argv[2]);
+
const sqlite3 = require('sqlite3').verbose();
const dbFile = process.argv[2];
const db = new sqlite3.Database(dbFile);
diff --git a/local.sh b/local.sh
new file mode 100755
index 0000000..c27632b
--- /dev/null
+++ b/local.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+read -p "Enter the ROAM_PATH: " ROAM_PATH
+read -p "Enter the ROAM_DB_FILE: " ROAM_DB_FILE
+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 ../..
+mv out ../../
+popd
+popd \ No newline at end of file
diff --git a/package.json b/package.json
index 53796a3..44e9bf3 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"version": "1.0.0",
"description": "",
"scripts": {
- "generate": "node ./generate_json.js $npm_config_script_params",
+ "generate:graphdata": "node ./generate_graphdata.js $npm_config_script_params",
"generate:search": "node ./generate_searchdata.mjs"
},
"keywords": [],