refactor: Remove docusaurus dev server and path_meta flag
- Remove 'dev' flag from run command - Remove 'path_meta' flag from run command - Remove docusaurus integration from playcmds - Add `validate_links` and `fix_links` to Atlas - Refactor page link processing for clarity and export mode
This commit is contained in:
@@ -4,7 +4,6 @@ import incubaid.herolib.ui.console
|
||||
import incubaid.herolib.data.atlas
|
||||
import incubaid.herolib.core.playcmds
|
||||
import incubaid.herolib.develop.gittools
|
||||
import incubaid.herolib.web.docusaurus
|
||||
import os
|
||||
import cli { Command, Flag }
|
||||
|
||||
@@ -40,14 +39,6 @@ pub fn cmd_atlas(mut cmdroot Command) Command {
|
||||
description: 'Path where atlas collections are located.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
name: 'path_meta'
|
||||
abbrev: 'pm'
|
||||
description: 'Path where collection.json... will be saved too.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
@@ -61,6 +52,7 @@ pub fn cmd_atlas(mut cmdroot Command) Command {
|
||||
required: false
|
||||
name: 'destination'
|
||||
description: 'Export destination path.'
|
||||
abbrev: 'd'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
@@ -71,14 +63,6 @@ pub fn cmd_atlas(mut cmdroot Command) Command {
|
||||
description: 'Scan directories for collections.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'dev'
|
||||
abbrev: 'd'
|
||||
description: 'Run development server after export.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
@@ -118,7 +102,6 @@ fn cmd_atlas_execute(cmd Command) ! {
|
||||
mut update := cmd.flags.get_bool('update') or { false }
|
||||
mut scan := cmd.flags.get_bool('scan') or { false }
|
||||
mut export := cmd.flags.get_bool('export') or { false }
|
||||
mut dev := cmd.flags.get_bool('dev') or { false }
|
||||
|
||||
// Include and redis default to true unless explicitly disabled
|
||||
mut no_include := cmd.flags.get_bool('no-include') or { false }
|
||||
@@ -128,9 +111,9 @@ fn cmd_atlas_execute(cmd Command) ! {
|
||||
|
||||
// ---------- PATH LOGIC ----------
|
||||
mut path := cmd.flags.get_string('path') or { '' }
|
||||
mut path_meta := cmd.flags.get_string('path_meta') or { '' }
|
||||
mut url := cmd.flags.get_string('url') or { '' }
|
||||
mut name := cmd.flags.get_string('name') or { 'default' }
|
||||
|
||||
mut destination := cmd.flags.get_string('destination') or { '' }
|
||||
|
||||
if path == '' && url == '' {
|
||||
@@ -166,12 +149,6 @@ fn cmd_atlas_execute(cmd Command) ! {
|
||||
export = true
|
||||
}
|
||||
|
||||
// If dev server is requested, ensure we scan and export first
|
||||
if dev {
|
||||
scan = true
|
||||
export = true
|
||||
}
|
||||
|
||||
// Execute operations
|
||||
if scan {
|
||||
console.print_header('Scanning collections...')
|
||||
@@ -205,30 +182,4 @@ fn cmd_atlas_execute(cmd Command) ! {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run development server if requested - always run even if there were export errors
|
||||
if dev {
|
||||
if destination == '' {
|
||||
return error('Cannot run dev server: no destination specified. Use -destination flag.')
|
||||
}
|
||||
|
||||
console.print_header('Starting Docusaurus development server')
|
||||
console.print_item('Atlas content exported to: ${destination}')
|
||||
|
||||
// Get the docusaurus site that was configured via heroscript
|
||||
// The heroscript should have been processed by playcmds.run() above
|
||||
mut dsite := docusaurus.dsite_get('') or {
|
||||
console.print_item('Warning: No Docusaurus site configured')
|
||||
console.print_item('Make sure your atlas source directory contains a heroscript file with Docusaurus configuration')
|
||||
return error('Cannot start dev server: ${err}')
|
||||
}
|
||||
|
||||
// Run the docusaurus dev server - this will block until Ctrl+C
|
||||
dsite.dev(
|
||||
host: 'localhost'
|
||||
port: 3000
|
||||
open: true
|
||||
watch_changes: false
|
||||
)!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user