refactor: improve docusaurus site creation and handling
- Change site.new to always create/overwrite a site - Add early exit to site.play if no config exists - Use explicit sitename from docusaurus.config - Enable openai.play action processing - Remove debug code and improve struct initialization
This commit is contained in:
@@ -6,6 +6,7 @@ playcmds.run(
|
|||||||
heroscript: '
|
heroscript: '
|
||||||
|
|
||||||
!!docusaurus.config
|
!!docusaurus.config
|
||||||
|
name: "tfgrid_tech"
|
||||||
title: "TFGrid Tech Docs"
|
title: "TFGrid Tech Docs"
|
||||||
|
|
||||||
!!docusaurus.define
|
!!docusaurus.define
|
||||||
@@ -15,7 +16,7 @@ playcmds.run(
|
|||||||
install: 1
|
install: 1
|
||||||
template_update: 1
|
template_update: 1
|
||||||
|
|
||||||
!!docusaurus.add sitename:"default"
|
!!docusaurus.add sitename:"tfgrid_tech"
|
||||||
git_url:"https://git.threefold.info/tfgrid/docs_tfgrid4/src/branch/main/ebooks/tech"
|
git_url:"https://git.threefold.info/tfgrid/docs_tfgrid4/src/branch/main/ebooks/tech"
|
||||||
git_root:"/tmp/code"
|
git_root:"/tmp/code"
|
||||||
git_reset:1
|
git_reset:1
|
||||||
@@ -23,6 +24,6 @@ playcmds.run(
|
|||||||
|
|
||||||
!!docusaurus.build
|
!!docusaurus.build
|
||||||
|
|
||||||
!!docusaurus.dev site:"default" open:true watch_changes:true
|
!!docusaurus.dev site:"tfgrid_tech" open:true watch_changes:true
|
||||||
'
|
'
|
||||||
)!
|
)!
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import crypto.blake2b
|
|||||||
@[heap]
|
@[heap]
|
||||||
pub struct PlayBook {
|
pub struct PlayBook {
|
||||||
pub mut:
|
pub mut:
|
||||||
actions []&Action @[skip; str: skip]
|
actions []&Action
|
||||||
priorities map[int][]int // first key is the priority, the list of int's is position in list self.actions
|
priorities map[int][]int // first key is the priority, the list of int's is position in list self.actions
|
||||||
othertext string // in case there is text outside of the actions
|
othertext string // in case there is text outside of the actions
|
||||||
result string // if any result
|
result string // if any result
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ pub fn run(args_ PlayArgs) ! {
|
|||||||
bizmodel.play(mut plbook)!
|
bizmodel.play(mut plbook)!
|
||||||
doctree.play(mut plbook)!
|
doctree.play(mut plbook)!
|
||||||
docusaurus.play(mut plbook)!
|
docusaurus.play(mut plbook)!
|
||||||
// openai.play(mut plbook)!
|
openai.play(mut plbook)!
|
||||||
|
|
||||||
// slides.play(mut plbook)!
|
// slides.play(mut plbook)!
|
||||||
// base_install(play(mut plbook)!
|
// base_install(play(mut plbook)!
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
|
|||||||
path_build_ := '${f.path_build.path}/${args.sitename}'
|
path_build_ := '${f.path_build.path}/${args.sitename}'
|
||||||
|
|
||||||
// get our website
|
// get our website
|
||||||
mut mysite := &site.Site(unsafe { nil })
|
mut mysite := &site.Site{}
|
||||||
if site.exists(name: args.sitename) {
|
if site.exists(name: args.sitename) {
|
||||||
// Site already exists (likely processed by hero command), use existing site
|
// Site already exists (likely processed by hero command), use existing site
|
||||||
mysite = site.get(name: args.sitename)!
|
mysite = site.get(name: args.sitename)!
|
||||||
@@ -88,9 +88,6 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println(mysite)
|
|
||||||
if true{panic("ss8")}
|
|
||||||
|
|
||||||
// Create the DocSite instance
|
// Create the DocSite instance
|
||||||
mut dsite := &DocSite{
|
mut dsite := &DocSite{
|
||||||
name: args.sitename
|
name: args.sitename
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ pub mut:
|
|||||||
pub fn new(args FactoryArgs) !&Site {
|
pub fn new(args FactoryArgs) !&Site {
|
||||||
name := texttools.name_fix(args.name)
|
name := texttools.name_fix(args.name)
|
||||||
|
|
||||||
// Check if a site with this name already exists
|
|
||||||
if name in websites {
|
|
||||||
// Return the existing site instead of creating a new one
|
|
||||||
return get(name: name)!
|
|
||||||
}
|
|
||||||
|
|
||||||
websites[name] = &Site{
|
websites[name] = &Site{
|
||||||
siteconfig: SiteConfig{
|
siteconfig: SiteConfig{
|
||||||
name: name
|
name: name
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import freeflowuniverse.herolib.core.texttools
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
pub fn play(mut plbook PlayBook) ! {
|
pub fn play(mut plbook PlayBook) ! {
|
||||||
|
if !plbook.exists(filter: 'site.') && !plbook.exists(filter: 'docusaurus.config') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Handle multiple site configurations - look for both site.config and docusaurus.config
|
// Handle multiple site configurations - look for both site.config and docusaurus.config
|
||||||
mut config_actions := plbook.find(filter: 'site.config')!
|
mut config_actions := plbook.find(filter: 'site.config')!
|
||||||
if config_actions.len == 0 {
|
if config_actions.len == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user