Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ded4a0b102 | |||
| 6184441706 | |||
| 6492e42358 | |||
| 4aaf1bd6db | |||
| a56a251d7f | |||
| 5263798b11 | |||
| 29c2fccbe5 | |||
| 975c07fc2e |
@@ -51,7 +51,7 @@ fn do() ! {
|
||||
mut cmd := Command{
|
||||
name: 'hero'
|
||||
description: 'Your HERO toolset.'
|
||||
version: '1.0.16'
|
||||
version: '1.0.19'
|
||||
}
|
||||
|
||||
// herocmds.cmd_run_add_flags(mut cmd)
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
|
||||
os_name="$(uname -s)"
|
||||
arch_name="$(uname -m)"
|
||||
version='1.0.16'
|
||||
version='1.0.19'
|
||||
|
||||
|
||||
# Base URL for GitHub releases
|
||||
|
||||
143
lib/core/herocmds/starlight.v
Normal file
143
lib/core/herocmds/starlight.v
Normal file
@@ -0,0 +1,143 @@
|
||||
module herocmds
|
||||
|
||||
import freeflowuniverse.herolib.web.starlight
|
||||
import os
|
||||
import cli { Command, Flag }
|
||||
|
||||
pub fn cmd_starlight(mut cmdroot Command) {
|
||||
mut cmd_run := Command{
|
||||
name: 'starlight'
|
||||
description: 'Generate, build, run starlight sites.'
|
||||
required_args: 0
|
||||
execute: cmd_starlight_execute
|
||||
}
|
||||
|
||||
// cmd_run.add_flag(Flag{
|
||||
// flag: .bool
|
||||
// required: false
|
||||
// name: 'reset'
|
||||
// abbrev: 'r'
|
||||
// description: 'will reset.'
|
||||
// })
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
name: 'url'
|
||||
abbrev: 'u'
|
||||
// default: ''
|
||||
description: 'Url where starlight source is.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
name: 'path'
|
||||
abbrev: 'p'
|
||||
// default: ''
|
||||
description: 'Path where starlight source is.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
name: 'deploykey'
|
||||
abbrev: 'dk'
|
||||
// default: ''
|
||||
description: 'Path of SSH Key used to deploy.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .string
|
||||
required: false
|
||||
name: 'publish'
|
||||
// default: ''
|
||||
description: 'Path where to publish.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'buildpublish'
|
||||
abbrev: 'bp'
|
||||
description: 'build and publish.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'builddevpublish'
|
||||
abbrev: 'bpd'
|
||||
description: 'build dev version and publish.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'update'
|
||||
description: 'update your environment the template and the repo you are working on (git pull).'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'dev'
|
||||
abbrev: 'd'
|
||||
description: 'Run your dev environment on local browser.'
|
||||
})
|
||||
|
||||
cmd_run.add_flag(Flag{
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'new'
|
||||
abbrev: 'n'
|
||||
description: 'create a new starlight site.'
|
||||
})
|
||||
|
||||
cmdroot.add_command(cmd_run)
|
||||
}
|
||||
|
||||
fn cmd_starlight_execute(cmd Command) ! {
|
||||
mut update := cmd.flags.get_bool('update') or { false }
|
||||
mut init := cmd.flags.get_bool('new') or { false }
|
||||
mut url := cmd.flags.get_string('url') or { '' }
|
||||
mut publish_path := cmd.flags.get_string('publish') or { '' }
|
||||
mut deploykey := cmd.flags.get_string('deploykey') or { '' }
|
||||
|
||||
mut path := cmd.flags.get_string('path') or { '' }
|
||||
|
||||
mut buildpublish := cmd.flags.get_bool('buildpublish') or { false }
|
||||
mut builddevpublish := cmd.flags.get_bool('builddevpublish') or { false }
|
||||
mut dev := cmd.flags.get_bool('dev') or { false }
|
||||
|
||||
// if build== false && build== false && build== false {
|
||||
// eprintln("specify build, builddev or dev")
|
||||
// exit(1)
|
||||
// }
|
||||
|
||||
mut docs := starlight.new(update: update)!
|
||||
mut site := docs.get(
|
||||
url: url
|
||||
path: path
|
||||
update: update
|
||||
publish_path: publish_path
|
||||
deploykey: deploykey
|
||||
init: init
|
||||
)!
|
||||
|
||||
if publish_path.len > 0 {
|
||||
site.build()!
|
||||
}
|
||||
|
||||
if buildpublish {
|
||||
site.build_publish()!
|
||||
}
|
||||
|
||||
if builddevpublish {
|
||||
site.build_dev_publish()!
|
||||
}
|
||||
|
||||
if dev {
|
||||
site.dev()!
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,8 @@ fn upload() ! {
|
||||
|
||||
fn install() ! {
|
||||
console.print_header('install bun')
|
||||
osal.exec(cmd: 'curl -fsSL https://bun.sh/install | bash')!
|
||||
destroy()!
|
||||
osal.exec(cmd: 'unset BUN_INSTALL && curl -fsSL https://bun.sh/install | bash')!
|
||||
}
|
||||
|
||||
fn destroy() ! {
|
||||
|
||||
@@ -3,7 +3,7 @@ module bun
|
||||
import freeflowuniverse.herolib.data.paramsparser
|
||||
import os
|
||||
|
||||
pub const version = '1.2.2'
|
||||
pub const version = '1.2.3'
|
||||
const singleton = true
|
||||
const default = true
|
||||
|
||||
|
||||
@@ -78,7 +78,10 @@ pub fn load_config(cfg_dir string) !Config {
|
||||
|
||||
// Load and parse footer config
|
||||
footer_content := os.read_file(os.join_path(cfg_dir, 'footer.json'))!
|
||||
footer := json.decode(Footer, footer_content)!
|
||||
footer := json.decode(Footer, footer_content) or {
|
||||
eprintln('footer.json in ${cfg_dir} is not in the right format please fix.\nError: ${err}')
|
||||
exit(99)
|
||||
}
|
||||
|
||||
// Load and parse main config
|
||||
main_config_path := os.join_path(cfg_dir, 'main.json')
|
||||
@@ -115,7 +118,10 @@ pub fn load_config(cfg_dir string) !Config {
|
||||
|
||||
// Load and parse navbar config
|
||||
navbar_content := os.read_file(os.join_path(cfg_dir, 'navbar.json'))!
|
||||
navbar := json.decode(Navbar, navbar_content)!
|
||||
navbar := json.decode(Navbar, navbar_content) or {
|
||||
eprintln('navbar.json in ${cfg_dir} is not in the right format please fix.\nError: ${err}')
|
||||
exit(99)
|
||||
}
|
||||
|
||||
return Config{
|
||||
footer: footer
|
||||
|
||||
@@ -209,11 +209,13 @@ fn (mut site DocSite) template_install() ! {
|
||||
mut build_dev_publish_ := site.path_build.file_get_new('build_dev_publish.sh')!
|
||||
build_dev_publish_.template_write(build_dev_publish, true)!
|
||||
build_dev_publish_.chmod(0o700)!
|
||||
|
||||
|
||||
develop_templ := $tmpl('templates/develop_src.sh')
|
||||
mut develop2_ := site.path_src.file_get_new('develop.sh')!
|
||||
develop2_.template_write(develop, true)!
|
||||
develop2_.template_write(develop_templ, true)!
|
||||
develop2_.chmod(0o700)!
|
||||
|
||||
|
||||
build_templ := $tmpl('templates/build_src.sh')
|
||||
mut build2_ := site.path_src.file_get_new('build.sh')!
|
||||
build2_.template_write(build, true)!
|
||||
build2_.chmod(0o700)!
|
||||
|
||||
6
lib/web/docusaurus/templates/build_src.sh
Executable file
6
lib/web/docusaurus/templates/build_src.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
hero docusaurus -bp
|
||||
6
lib/web/docusaurus/templates/develop_src.sh
Executable file
6
lib/web/docusaurus/templates/develop_src.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
hero docusaurus -d
|
||||
@@ -87,10 +87,10 @@ pub fn (mut s DocSite) dev()! {
|
||||
console.print_item(' 2. To detach from screen: Press Ctrl+A then D')
|
||||
console.print_item(' 3. To list all screens: screen -ls')
|
||||
console.print_item('The site content is on::')
|
||||
console.print_item(' 1. location of documents: ${s.path_src.path}/docs')
|
||||
console.print_item(' 1. location of documents: ${s.path_src.path}/src')
|
||||
if osal.cmd_exists('code') {
|
||||
console.print_item(' 2. We opened above dir in vscode.')
|
||||
osal.exec(cmd: 'code ${s.path_src.path}/docs')!
|
||||
osal.exec(cmd: 'code ${s.path_src.path}/src')!
|
||||
}
|
||||
|
||||
// Start the watcher in a separate thread
|
||||
@@ -99,7 +99,7 @@ pub fn (mut s DocSite) dev()! {
|
||||
println('\n')
|
||||
|
||||
if s.args.watch_changes {
|
||||
docs_path := '${s.path_src.path}/docs'
|
||||
docs_path := '${s.path_src.path}/src'
|
||||
watch_docs(docs_path, s.path_src.path, s.path_build.path)!
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ pub fn (mut site DocSite) generate() ! {
|
||||
aa.copy(dest: '${site.path_build.path}/${item}')!
|
||||
}
|
||||
}
|
||||
for item in ['docs'] {
|
||||
for item in ['src'] {
|
||||
if os.exists('${site.path_src.path}/${item}') {
|
||||
mut aa := site.path_src.dir_get(item)!
|
||||
aa.copy(dest: '${site.path_build.path}/${item}', delete: true)!
|
||||
|
||||
@@ -39,8 +39,8 @@ fn handle_file_change(event notifier.NotifyEvent, path string, args map[string]s
|
||||
}
|
||||
|
||||
// Get relative path from docs directory
|
||||
rel_path := path.replace('${args['path_src']}/docs/', '')
|
||||
dest_path := '${args['path_build']}/docs/${rel_path}'
|
||||
rel_path := path.replace('${args['path_src']}/src/', '')
|
||||
dest_path := '${args['path_build']}/src/${rel_path}'
|
||||
|
||||
match event {
|
||||
.create, .modify {
|
||||
|
||||
@@ -181,6 +181,10 @@ systemd_process_test.v
|
||||
data/graphdb
|
||||
data/radixtree
|
||||
clients/livekit
|
||||
data/radixtree
|
||||
data/dedupestor
|
||||
core/playcmds
|
||||
|
||||
'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user