From 2d5d1befaefb13d81ea42e68a145c3556717d538 Mon Sep 17 00:00:00 2001 From: despiegk Date: Tue, 20 May 2025 09:48:56 +0400 Subject: [PATCH] ... --- cli/config.heroscript | 59 ++++++++++++++++++++ lib/core/herocmds/docusaurus.v | 42 +++++++------- lib/web/docusaurus/{cfg => cfg_}/footer.json | 0 lib/web/docusaurus/{cfg => cfg_}/main.json | 0 lib/web/docusaurus/{cfg => cfg_}/navbar.json | 0 lib/web/docusaurus/dsite.v | 8 +-- lib/web/docusaurus/dsite_get.v | 23 ++++---- lib/web/docusaurus/factory.v | 4 +- 8 files changed, 98 insertions(+), 38 deletions(-) create mode 100644 cli/config.heroscript rename lib/web/docusaurus/{cfg => cfg_}/footer.json (100%) rename lib/web/docusaurus/{cfg => cfg_}/main.json (100%) rename lib/web/docusaurus/{cfg => cfg_}/navbar.json (100%) diff --git a/cli/config.heroscript b/cli/config.heroscript new file mode 100644 index 00000000..bf547831 --- /dev/null +++ b/cli/config.heroscript @@ -0,0 +1,59 @@ + +!!docusaurus.config + name:"superbrain" + title:"Geomind" + tagline:"Sovereign Neuromorphic AI & Compute" + url:"https://info.ourworld.tf" + base_url:"/superbrain/" + url_home:"docs/" + favicon:"img/ourworld_favicon.png" + image:"img/geomind.png" + +!!docusaurus.config_meta + description:"Geomind Ebook" + image:"https://info.ourworld.tf/img/logo.svg" + title:"Sovereign Neuromorphic AI & Compute" + +!!docusaurus.navbar + title:"" + logo_alt:"ThreeFold Logo" + logo_src:"img/geomind.png" + +!!docusaurus.navbar_item + label:"OurWorld Intro" + href:"https://info.ourworld.tf/intro/" + position:"right" + +!!docusaurus.navbar_item + label:"ThreeFold.io" + href:"https://threefold.io" + position:"right" + +!!docusaurus.navbar_item + label:"Mycelium Network" + href:"https://mycelium.threefold.io/" + position:"right" + +!!docusaurus.navbar_item + label:"AI Box" + href:"https://aibox.threefold.io/" + position:"right" + +!!docusaurus.footer + style:"dark" + +!!docusaurus.footer_item + title:"Web" + label:"ThreeFold.io" + href:"https://threefold.io" + +!!docusaurus.footer_item + title:"Web" + label:"OurWorld" + href:"https://ourworld.tf" + +!!docusaurus.build_dest + path:"root@info.ourworld.tf:/root/hero/www/info/superbrain" + +!!docusaurus.build_dest_dev + path:"root@info.ourworld.tf:/root/hero/www/infodev/superbrain" diff --git a/lib/core/herocmds/docusaurus.v b/lib/core/herocmds/docusaurus.v index 37cc846f..d5ffdac4 100644 --- a/lib/core/herocmds/docusaurus.v +++ b/lib/core/herocmds/docusaurus.v @@ -138,16 +138,16 @@ fn cmd_docusaurus_execute(cmd Command) ! { mut provided_path := cmd.flags.get_string('path') or { '' } mut heroscript_source_path := '' build_cfg_dir := os.join_path(build_path, 'cfg') - target_heroscript_path := os.join_path(build_cfg_dir, 'config.heroscript') + // target_heroscript_path := os.join_path(build_cfg_dir, 'config.heroscript') if provided_path != '' { if !os.exists(provided_path) || !os.is_file(provided_path) { return error('Provided path "${provided_path}" does not exist or is not a file.') } - heroscript_source_path = provided_path - // --- Copy Heroscript to Build Location --- - os.mkdir_all(build_cfg_dir)! - os.cp(heroscript_source_path, target_heroscript_path)! + // heroscript_source_path = provided_path + // // --- Copy Heroscript to Build Location --- + // os.mkdir_all(build_cfg_dir)! + // os.cp(heroscript_source_path, target_heroscript_path)! } else { // Path not provided, look in ./cfg/ mut cwd := os.getwd() @@ -155,21 +155,21 @@ fn cmd_docusaurus_execute(cmd Command) ! { if !os.exists(cfg_dir) || !os.is_dir(cfg_dir) { return error('Flag -path not provided and directory "./cfg" not found in the current working directory.') } - mut found_files := []string - for file in os.ls(cfg_dir) or { []string{} } { - if file.ends_with('.heroscript') { - found_files << os.join_path(cfg_dir, file) - } - } - if found_files.len == 1 { - heroscript_source_path = found_files[0] - os.mkdir_all(build_cfg_dir)! - os.cp(heroscript_source_path, target_heroscript_path)! - } else if found_files.len == 0 { - return error('Flag -path not provided and no *.heroscript file found in "./cfg".') - } else { - return error('Flag -path not provided and multiple *.heroscript files found in "./cfg". Please specify one using -path.') - } + // mut found_files := []string + // for file in os.ls(cfg_dir) or { []string{} } { + // if file.ends_with('.heroscript') { + // found_files << os.join_path(cfg_dir, file) + // } + // } + // if found_files.len == 1 { + // heroscript_source_path = found_files[0] + // os.mkdir_all(build_cfg_dir)! + // os.cp(heroscript_source_path, target_heroscript_path)! + // } else if found_files.len == 0 { + // return error('Flag -path not provided and no *.heroscript file found in "./cfg".') + // } else { + // return error('Flag -path not provided and multiple *.heroscript files found in "./cfg". Please specify one using -path.') + // } } @@ -181,7 +181,7 @@ fn cmd_docusaurus_execute(cmd Command) ! { mut docs := docusaurus.new( update: update build_path: build_path - heroscript: os.read_file(target_heroscript_path)! // Read the copied heroscript + // heroscript: os.read_file(target_heroscript_path)! // Read the copied heroscript )! mut site := docs.get( diff --git a/lib/web/docusaurus/cfg/footer.json b/lib/web/docusaurus/cfg_/footer.json similarity index 100% rename from lib/web/docusaurus/cfg/footer.json rename to lib/web/docusaurus/cfg_/footer.json diff --git a/lib/web/docusaurus/cfg/main.json b/lib/web/docusaurus/cfg_/main.json similarity index 100% rename from lib/web/docusaurus/cfg/main.json rename to lib/web/docusaurus/cfg_/main.json diff --git a/lib/web/docusaurus/cfg/navbar.json b/lib/web/docusaurus/cfg_/navbar.json similarity index 100% rename from lib/web/docusaurus/cfg/navbar.json rename to lib/web/docusaurus/cfg_/navbar.json diff --git a/lib/web/docusaurus/dsite.v b/lib/web/docusaurus/dsite.v index 02292645..9e63622a 100644 --- a/lib/web/docusaurus/dsite.v +++ b/lib/web/docusaurus/dsite.v @@ -95,10 +95,10 @@ pub fn (mut s DocSite) dev() ! { console.print_item(' 3. To list all screens: screen -ls') console.print_item('The site content is on::') console.print_item(' 1. location of documents: ${s.path_src.path}/docs') - if osal.cmd_exists('code') { - console.print_item(' 2. We opened above dir in vscode.') - osal.exec(cmd: 'code ${s.path_src.path}/docs')! - } + // if osal.cmd_exists('code') { + // console.print_item(' 2. We opened above dir in vscode.') + // osal.exec(cmd: 'code ${s.path_src.path}/docs')! + // } // Start the watcher in a separate thread // mut tf:=spawn watch_docs(docs_path, s.path_src.path, s.path_build.path) diff --git a/lib/web/docusaurus/dsite_get.v b/lib/web/docusaurus/dsite_get.v index 34246f72..af7b6485 100644 --- a/lib/web/docusaurus/dsite_get.v +++ b/lib/web/docusaurus/dsite_get.v @@ -48,6 +48,7 @@ pub fn (mut f DocusaurusFactory) get(args_ DSiteGetArgs) !&DocSite { mut r := gs.get_repo( url: 'https://github.com/freeflowuniverse/docusaurus_template.git' + reset: args.update )! mut template_path := r.patho()! @@ -58,17 +59,17 @@ pub fn (mut f DocusaurusFactory) get(args_ DSiteGetArgs) !&DocSite { } else if f.config.main.title != '' { // Use the factory's config from heroscript if available generate_configuration(args.path, f.config)! - } else { - // Then ensure cfg directory exists in src, - if !os.exists('${args.path}/cfg') { - if args.init { - // else copy config from template - mut template_cfg := template_path.dir_get('cfg')! - template_cfg.copy(dest: '${args.path}/cfg')! - } else { - return error("Can't find cfg dir in chosen docusaurus location: ${args.path}") - } - } + // } else { + // // Then ensure cfg directory exists in src, + // if !os.exists('${args.path}/cfg') { + // if args.init { + // // else copy config from template + // mut template_cfg := template_path.dir_get('cfg')! + // template_cfg.copy(dest: '${args.path}/cfg')! + // } else { + // return error("Can't find cfg dir in chosen docusaurus location: ${args.path}") + // } + // } } if !os.exists('${args.path}/docs') { if args.init { diff --git a/lib/web/docusaurus/factory.v b/lib/web/docusaurus/factory.v index ddf9e7e7..701919e6 100644 --- a/lib/web/docusaurus/factory.v +++ b/lib/web/docusaurus/factory.v @@ -25,8 +25,8 @@ pub mut: build_path string production bool update bool - heroscript string - heroscript_path string + // heroscript string + // heroscript_path string } pub fn new(args_ DocusaurusArgs) !&DocusaurusFactory {