Bushido CLI, extracts from bookmarks folder all the information (JSON files) and then import it, in a the graph database.
The console application, analises the bookmarks folder and creates objets to generate the JSON files (located in cli/export). That files would be transformed form tree data structure to object type.
First, the application finds in the bookmarks folder, two type of nodes to add in the topic.json file:
- BRANCH: These generic nodes, can have as a children, a branch or a leaf. This type of objects will never have domains nodes.
- LEAF: The last node before access to the domains
These node types will be named in general as a topic and would be stored as we said in topic.json.
Once the topic.json is populated, all the nodes types that does not have any child, would be named as domain and are going to be stored in domain.json file. That nodes contain the information of the domain as name, URL,...
Install the application modules to spin up the app and run it. The last command will force to restart the server each time a file is changed.
npm install
npm run start:devIn other tab of the terminal run the commands, for example:
npm run bushido-cli import domainBefore run the commands the project has to be compiled from TypeScript to JavaScript, execute or be in the develpment mode as above:
npm run buildOnce the compilation finish, we are ready to run our commands:
Create the topic.json and domain.json files from the bookmarks folder.
NOTE: If export folder is not created in the cli folder, it throws error. So, before run the script, create export folder.
npm run bushido-cli generateIf the command is succesful, import the files as nodes in the graph database:
# First import the topics
npm run bushido-cli import topic
# After the domains
npm run bushido-cli import domainTidy up the nodes that don't have any child
npm run bushido-cli optimise-graphFor different reasons, it might be a possibility that some domains are not available (404). If we find some of that delete node
npm run bushido-cli domain-url-checkDelete all the database
MATCH (n)
DETACH DELETE nDelete specific node by ID
MATCH (n)
WHERE ID(n)=1
DETACH DELETE n