This commit is contained in:
2025-07-25 11:05:30 +02:00
parent 9b86f76eaa
commit f2079c7c3d
10 changed files with 57 additions and 75 deletions

View File

@@ -23,6 +23,23 @@ pub mut:
factory &DocusaurusFactory @[skip; str: skip] // Reference to the parent
}
@[params]
pub struct DSiteGetArgs {
pub mut:
name string
nameshort string
path string
git_url string
git_reset bool
git_root string
git_pull bool
open bool // Added
watch_changes bool // Added
path_publish string // Added
init bool // Added
update bool // Added (maps to template_update in DocusaurusArgs)
}
pub fn (mut s DocSite) build() ! {
s.generate()!
osal.exec(

View File

@@ -53,7 +53,7 @@ pub fn new(args_ DocusaurusArgs) !&DocusaurusFactory {
// get site from the docusaurus factory
pub fn (mut self DocusaurusFactory) site_get(name string) ! {
name_:=texttools.name_fix(name: name)!
return self.sites[name_] or {return error('site not found: ${name} in docusaurus factory.')!}
pub fn (mut self DocusaurusFactory) site_get(name string) !&DocSite { // Changed return type to !&DocSite
name_:=texttools.name_fix(name: name) // Removed !
return self.sites[name_] or {return error('site not found: ${name} in docusaurus factory.') } // Removed ! from error()
}

View File

@@ -21,18 +21,18 @@ fn (mut self DocusaurusFactory) install(args_ TemplateInstallArgs) ! {
if args.reset {
osal.rm('${self.path_build.path}')!
osal.mkdir('${self.path_build.path}')!
osal.mkdir_all('${self.path_build.path}')! // Changed mkdir to mkdir_all
}
template_path := gs.get_path(
pull: args.template_update
reset: args.delete
reset: args.reset // Changed args.delete to args.reset
url: 'https://github.com/freeflowuniverse/docusaurus_template/src/branch/main/template'
)!
mut template_path0 := pathlib.get_dir(path: template_path, create: false)!
template_path0.copy(dest: '${self.path_build.path}', delete: args.delete)!
template_path0.copy(dest: '${self.path_build.path}', delete: args.reset)! // Changed args.delete to args.reset
if !os.exists('${self.path_build.path}/node_modules') {
args.install = true

View File

@@ -20,7 +20,7 @@ pub fn play(args_ PlayArgs) ! {
mut ds := new()!
if plbook.if_once(filter: 'docusaurus.define') or {return error("docusarus.define should be there 0 or 1 time.\n${args}")!} {
if plbook.exists_once(filter: 'docusaurus.define') { // Changed if_once to exists_once and removed or block
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
mut p := action.params