refactor: Rename docusaurus command to docs
- Change command name from 'docusaurus' to 'docs' - Update path handling for empty Docusaurus paths - Adjust example usage in documentation
This commit is contained in:
@@ -9,7 +9,7 @@ import cli { Command, Flag }
|
||||
|
||||
pub fn cmd_docusaurus(mut cmdroot Command) Command {
|
||||
mut cmd_run := Command{
|
||||
name: 'docusaurus'
|
||||
name: 'docs'
|
||||
description: 'Generate, build, run docusaurus sites.'
|
||||
required_args: 0
|
||||
execute: cmd_docusaurus_execute
|
||||
|
||||
@@ -39,12 +39,24 @@ pub fn (page Page) process_links(paths map[string]string) ![]string {
|
||||
|
||||
// Try to get Docusaurus-specific path from Redis
|
||||
if docusaurus_path := redis.hget('doctree_docusaurus_paths', ptr.str()) {
|
||||
// Use Docusaurus path (already without .md extension)
|
||||
// Ensure it starts with / for absolute path
|
||||
if docusaurus_path.starts_with('/') {
|
||||
path = docusaurus_path
|
||||
// Only use the Docusaurus path if it's not empty
|
||||
if docusaurus_path.trim_space() != '' {
|
||||
// Use Docusaurus path (already without .md extension)
|
||||
// Ensure it starts with / for absolute path
|
||||
if docusaurus_path.starts_with('/') {
|
||||
path = docusaurus_path
|
||||
} else {
|
||||
path = '/' + docusaurus_path
|
||||
}
|
||||
} else {
|
||||
path = '/' + docusaurus_path
|
||||
// Empty Docusaurus path, fall back to default behavior
|
||||
// Fall back to default behavior: relative paths with .md
|
||||
if ptr.collection == page.collection_name {
|
||||
// same directory
|
||||
path = './' + path.all_after_first('/')
|
||||
} else {
|
||||
path = '../${path}'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fall back to default behavior: relative paths with .md
|
||||
|
||||
@@ -15,16 +15,15 @@ For quick setup and development, use the hero command:
|
||||
|
||||
```bash
|
||||
# Start development server
|
||||
hero docusaurus -d -path /path/to/your/site
|
||||
hero docs -d -path /path/to/your/site
|
||||
|
||||
# Build for production
|
||||
hero docusaurus -b -path /path/to/your/site
|
||||
hero docs -b -path /path/to/your/site
|
||||
|
||||
# Build and publish
|
||||
hero docusaurus -bp -path /path/to/your/site
|
||||
hero docs -bp -path /path/to/your/site
|
||||
```
|
||||
|
||||
|
||||
### Example HeroScript
|
||||
|
||||
```heroscript
|
||||
|
||||
Reference in New Issue
Block a user