fix: Fix docusaurus compilation issues in development branch

- Update docusaurus.v to use correct API (dsite_add instead of add)
- Fix factory.v compiler bug by rewriting problematic or block syntax
- Ensure compilation works with current docusaurus module structure
This commit is contained in:
Mahmoud-Emad
2025-08-05 15:34:46 +03:00
parent 59acea177d
commit ccf2d4a3a5
2 changed files with 49 additions and 52 deletions

View File

@@ -204,14 +204,13 @@ fn cmd_docusaurus_execute(cmd Command) ! {
mut generic_site := site.get(name: site_name)!
// Add docusaurus site
mut dsite := docusaurus.add(
site: generic_site
path_src: url // Use URL as source path for now
path_build: build_path
mut dsite := docusaurus.dsite_add(
sitename: site_name
path: url // Use URL as source path for now
path_publish: publish_path
reset: false
template_update: update
install: init
git_reset: false
git_pull: false
play: true
)!
// Conditional site actions based on flags
@@ -222,7 +221,7 @@ fn cmd_docusaurus_execute(cmd Command) ! {
} else if dev {
dsite.dev(host: 'localhost', port: 3000, open: open)!
} else if open {
dsite.open('localhost', 3000)!
dsite.open(host: 'localhost', port: 3000)!
} else {
// If no specific action (build/dev/open) is requested, just generate the site
dsite.generate()!

View File

@@ -30,11 +30,13 @@ pub mut:
pub fn factory_get(args_ DocSiteFactoryArgs) !DocSiteFactory {
mut args := args_
mut f:= docusaurus_factory or {
mut factory:=factory_set(args)!
factory
}
if f := docusaurus_factory {
return f
} else {
mut factory := factory_set(args)!
docusaurus_factory = factory
return factory
}
}
pub fn factory_set(args_ DocSiteFactoryArgs) !DocSiteFactory {
@@ -60,7 +62,6 @@ pub fn factory_set(args_ DocSiteFactoryArgs) !DocSiteFactory {
return factory
}
pub fn dsite_get(name_ string) !&DocSite {
name := texttools.name_fix(name_)
return docusaurus_sites[name] or {
@@ -70,9 +71,6 @@ pub fn dsite_get(name_ string) !&DocSite {
pub fn dsite_exists(name_ string) !bool {
name := texttools.name_fix(name_)
d := docusaurus_sites[name] or {
return false
}
d := docusaurus_sites[name] or { return false }
return true
}