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 similarity index 99% rename from generate_json.js rename to 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..1328c78 --- /dev/null +++ b/local.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +ROAM_PATH='/Users/aokisusumutarou/zettelkasten' +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 ../.. +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": [],