add documentation gen script to actor
This commit is contained in:
51
lib/baobab/generator/templates/docs.vsh.template
Executable file
51
lib/baobab/generator/templates/docs.vsh.template
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env -S v -n -w -gc none -no-retry-compilation -cc tcc -d use_openssl -enable-globals run
|
||||
|
||||
import os
|
||||
|
||||
abs_dir_of_script := dir(@@FILE)
|
||||
|
||||
// Format code
|
||||
println('Formatting code...')
|
||||
if os.system('v fmt -w @{dollar}{abs_dir_of_script}/examples') != 0 {
|
||||
eprintln('Warning: Failed to format examples')
|
||||
}
|
||||
|
||||
if os.system('v fmt -w @{dollar}{abs_dir_of_script}/src') != 0 {
|
||||
eprintln('Warning: Failed to format actor')
|
||||
}
|
||||
|
||||
// Clean existing docs
|
||||
println('Cleaning existing documentation...')
|
||||
|
||||
os.rmdir_all('_docs') or {}
|
||||
os.rmdir_all('docs') or {}
|
||||
os.rmdir_all('vdocs') or {}
|
||||
|
||||
herolib_path := os.join_path(abs_dir_of_script, 'lib')
|
||||
os.chdir(herolib_path) or {
|
||||
panic('Failed to change directory to herolib: @{dollar}{err}')
|
||||
}
|
||||
|
||||
os.rmdir_all('_docs') or {}
|
||||
os.rmdir_all('docs') or {}
|
||||
os.rmdir_all('vdocs') or {}
|
||||
|
||||
// Generate HTML documentation
|
||||
println('Generating HTML documentation...')
|
||||
if os.system('v doc -m -f html . -readme -comments -no-timestamp -o ../docs') != 0 {
|
||||
panic('Failed to generate HTML documentation')
|
||||
}
|
||||
|
||||
os.chdir(abs_dir_of_script) or {
|
||||
panic('Failed to change directory to abs_dir_of_script: @{dollar}{err}')
|
||||
}
|
||||
|
||||
// Generate Markdown documentation
|
||||
println('Generating Markdown documentation...')
|
||||
os.rmdir_all('vdocs') or {}
|
||||
|
||||
if os.system('v doc -m -no-color -f md -o vdocs/herolib/') != 0 {
|
||||
panic('Failed to generate Hero markdown documentation')
|
||||
}
|
||||
|
||||
println('Documentation generation completed successfully!')
|
||||
Reference in New Issue
Block a user