diff options
author | ikoamu <ikoamu@gmail.com> | 2024-06-14 19:40:22 +0900 |
---|---|---|
committer | ikoamu <ikoamu@gmail.com> | 2024-06-14 19:50:54 +0900 |
commit | 716927681898fa154487ffe962f629d7f9483e1b (patch) | |
tree | fcddff04aaf9db2c5b6f671d6e367ebc6d4c4e95 | |
parent | f55aa766f1e97417001ba1d1485b13162d2919f2 (diff) |
Create local shell
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | action.yml | 2 | ||||
-rw-r--r-- | generate_graphdata.js (renamed from generate_json.js) | 1 | ||||
-rwxr-xr-x | local.sh | 31 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 36 insertions, 2 deletions
@@ -3,3 +3,5 @@ DS_Store graphdata.json searchdata.json notes/ +org-roam-ui/ +out/
\ No newline at end of file @@ -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": [], |