diff --git a/examples/web/docusaurus_example_complete.vsh b/examples/web/docusaurus_example_complete.vsh index 122a2309..81ccc3f6 100755 --- a/examples/web/docusaurus_example_complete.vsh +++ b/examples/web/docusaurus_example_complete.vsh @@ -211,7 +211,7 @@ console.log(result); // Option 1: Run in development mode // This will start a development server in a screen session println('Starting development server...') - site.dev() or { + site.dev(host: 'localhost', port: 3000) or { eprintln('Error starting development server: ${err}') exit(1) } diff --git a/examples/web/starllight_example.vsh b/examples/web/starllight_example.vsh index d5195dde..b680cb01 100755 --- a/examples/web/starllight_example.vsh +++ b/examples/web/starllight_example.vsh @@ -14,4 +14,4 @@ mut site := docs.get( init: true // init means we put config files if not there )! -site.dev()! +site.dev(host: 'localhost', port: 3000)! diff --git a/lib/core/herocmds/docusaurus.v b/lib/core/herocmds/docusaurus.v index e989d93f..50b227d8 100644 --- a/lib/core/herocmds/docusaurus.v +++ b/lib/core/herocmds/docusaurus.v @@ -206,7 +206,7 @@ fn cmd_docusaurus_execute(cmd Command) ! { } if dev { - site.dev()! + site.dev(host: 'localhost', port: 3000)! } if open { diff --git a/lib/core/herocmds/starlight.v b/lib/core/herocmds/starlight.v index 9e69693d..ec6b01bf 100644 --- a/lib/core/herocmds/starlight.v +++ b/lib/core/herocmds/starlight.v @@ -138,6 +138,6 @@ fn cmd_starlight_execute(cmd Command) ! { } if dev { - site.dev()! + site.dev(host: 'localhost', port: 3000)! } } diff --git a/lib/web/docusaurus/dsite.v b/lib/web/docusaurus/dsite.v index cd60c172..421295cb 100644 --- a/lib/web/docusaurus/dsite.v +++ b/lib/web/docusaurus/dsite.v @@ -3,9 +3,7 @@ module docusaurus import freeflowuniverse.herolib.osal.screen import os import freeflowuniverse.herolib.core.pathlib -import freeflowuniverse.herolib.core.texttools // import freeflowuniverse.herolib.core.base -import freeflowuniverse.herolib.data.markdownparser import freeflowuniverse.herolib.develop.gittools // import json import freeflowuniverse.herolib.osal @@ -58,13 +56,20 @@ pub fn (mut s DocSite) build_publish() ! { )! } -pub fn (mut s DocSite) open() ! { - // Print instructions for user - console.print_item('open browser: ${s.url}') - osal.exec(cmd: 'open https://localhost:3000')! +@[params] +pub struct DevArgs { +pub mut: + host string = 'localhost' + port int = 3000 } -pub fn (mut s DocSite) dev() ! { +pub fn (mut s DocSite) open(args DevArgs) ! { + // Print instructions for user + console.print_item('open browser: https://${args.host}:${args.port}') + osal.exec(cmd: 'open https://${args.host}:${args.port}')! +} + +pub fn (mut s DocSite) dev(args DevArgs) ! { s.generate()! // Create screen session for docusaurus development server @@ -83,11 +88,12 @@ pub fn (mut s DocSite) dev() ! { // Send commands to the screen session console.print_item('To view the server output:: cd ${s.path_build.path}') scr.cmd_send('cd ${s.path_build.path}')! - scr.cmd_send('bun start')! + scr.cmd_send('bun start -p ${args.port} -h ${args.host}')! // Print instructions for user console.print_header(' Docusaurus Development Server') console.print_item('Development server is running in a screen session.') + console.print_item('Server is running on: https://${args.host}:${args.port}') console.print_item('To view the server output:') console.print_item(' 1. Attach to screen: screen -r ${screen_name}') console.print_item(' 2. To detach from screen: Press Ctrl+A then D') diff --git a/lib/web/starlight/factory.v b/lib/web/starlight/factory.v index fe526d61..18940fc7 100644 --- a/lib/web/starlight/factory.v +++ b/lib/web/starlight/factory.v @@ -2,7 +2,6 @@ module starlight import os import freeflowuniverse.herolib.core.pathlib -import freeflowuniverse.herolib.develop.gittools @[heap] pub struct StarlightFactory { diff --git a/lib/web/starlight/site.v b/lib/web/starlight/site.v index 58bd939a..25a44abc 100644 --- a/lib/web/starlight/site.v +++ b/lib/web/starlight/site.v @@ -3,10 +3,6 @@ module starlight import freeflowuniverse.herolib.osal.screen import os import freeflowuniverse.herolib.core.pathlib -import freeflowuniverse.herolib.core.texttools -import freeflowuniverse.herolib.core.base -import freeflowuniverse.herolib.develop.gittools -import json import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.ui.console @@ -57,7 +53,14 @@ pub fn (mut s DocSite) build_publish() ! { )! } -pub fn (mut s DocSite) dev() ! { +@[params] +pub struct DevArgs { +pub mut: + host string = 'localhost' + port int = 3000 +} + +pub fn (mut s DocSite) dev(args DevArgs) ! { s.clean()! s.generate()! @@ -76,11 +79,12 @@ pub fn (mut s DocSite) dev() ! { // Send commands to the screen session scr.cmd_send('cd ${s.path_build.path}')! - scr.cmd_send('bash develop.sh')! + scr.cmd_send('bun start -p ${args.port} -h ${args.host}')! // Print instructions for user console.print_header(' Starlight Development Server') console.print_item('Development server is running in a screen session.') + console.print_item('Server is running on: https://${args.host}:${args.port}') console.print_item('To view the server output:') console.print_item(' 1. Attach to screen: screen -r ${screen_name}') console.print_item(' 2. To detach from screen: Press Ctrl+A then D') @@ -160,8 +164,6 @@ pub fn (mut site DocSite) generate() ! { } fn (mut site DocSite) template_install() ! { - mut gs := gittools.new()! - site.factory.template_install(template_update: false, install: false, delete: false)! cfg := site.config