...
This commit is contained in:
@@ -1,207 +0,0 @@
|
||||
module docusaurus
|
||||
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import json
|
||||
import os
|
||||
|
||||
// THE FOLLOWING STRUCTS CAN BE SERIALIZED IN
|
||||
// main.json
|
||||
// Main
|
||||
// {
|
||||
// "title": "Internet Geek",
|
||||
// "tagline": "Internet Geek",
|
||||
// "favicon": "img/favicon.png",
|
||||
// "url": "https://friends.threefold.info",
|
||||
// "url_home": "docs/",
|
||||
// "baseUrl": "/kristof/",
|
||||
// "image": "img/tf_graph.png",
|
||||
// "metadata": {
|
||||
// "description": "ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.",
|
||||
// "image": "https://threefold.info/kristof/img/tf_graph.png",
|
||||
// "title": "ThreeFold Technology Vision"
|
||||
// },
|
||||
// "buildDest":"root@info.ourworld.tf:/root/hero/www/info",
|
||||
// "buildDestDev":"root@info.ourworld.tf:/root/hero/www/infodev"
|
||||
// }
|
||||
//
|
||||
// navbar.json
|
||||
// Navbar:
|
||||
// {
|
||||
// "title": "Kristof = Chief Executive Geek",
|
||||
// "items": [
|
||||
// {
|
||||
// "href": "https://threefold.info/kristof/",
|
||||
// "label": "ThreeFold Technology",
|
||||
// "position": "right"
|
||||
// },
|
||||
// {
|
||||
// "href": "https://threefold.io",
|
||||
// "label": "ThreeFold.io",
|
||||
// "position": "right"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
//
|
||||
// footer.json
|
||||
// Footer:
|
||||
// {
|
||||
// "style": "dark",
|
||||
// "links": [
|
||||
// {
|
||||
// "title": "Docs",
|
||||
// "items": [
|
||||
// {
|
||||
// "label": "Introduction",
|
||||
// "to": "/docs"
|
||||
// },
|
||||
// {
|
||||
// "label": "TFGrid V4 Docs",
|
||||
// "href": "https://docs.threefold.io/"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "title": "Community",
|
||||
// "items": [
|
||||
// {
|
||||
// "label": "Telegram",
|
||||
// "href": "https://t.me/threefold"
|
||||
// },
|
||||
// {
|
||||
// "label": "X",
|
||||
// "href": "https://x.com/threefold_io"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "title": "Links",
|
||||
// "items": [
|
||||
// {
|
||||
// "label": "ThreeFold.io",
|
||||
// "href": "https://threefold.io"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
// Combined config structure
|
||||
pub struct Config {
|
||||
pub mut:
|
||||
footer Footer
|
||||
main Main
|
||||
navbar Navbar
|
||||
build_destinations []BuildDest
|
||||
import_sources []ImportSource
|
||||
ssh_connections []SSHConnection
|
||||
}
|
||||
|
||||
// THE SUBELEMENTS
|
||||
|
||||
pub struct Main {
|
||||
pub mut:
|
||||
name string
|
||||
title string = 'Docusaurus'
|
||||
tagline string
|
||||
favicon string = 'img/favicon.png'
|
||||
url string = 'http://localhost'
|
||||
url_home string
|
||||
base_url string = '/' @[json: 'baseUrl']
|
||||
image string = 'img/tf_graph.png' @[required]
|
||||
metadata MainMetadata
|
||||
build_dest []string @[json: 'buildDest']
|
||||
build_dest_dev []string @[json: 'buildDestDev']
|
||||
copyright string = 'someone'
|
||||
}
|
||||
|
||||
// Footer config structures
|
||||
pub struct FooterItem {
|
||||
pub mut:
|
||||
label string
|
||||
to string
|
||||
href string
|
||||
}
|
||||
|
||||
pub struct FooterLink {
|
||||
pub mut:
|
||||
title string
|
||||
items []FooterItem
|
||||
}
|
||||
|
||||
pub struct Footer {
|
||||
pub mut:
|
||||
style string = 'dark'
|
||||
links []FooterLink
|
||||
}
|
||||
|
||||
// Main config structure
|
||||
pub struct MainMetadata {
|
||||
pub mut:
|
||||
description string = 'Docusaurus'
|
||||
image string = 'Docusaurus'
|
||||
title string = 'Docusaurus'
|
||||
}
|
||||
|
||||
|
||||
// Navbar config structures
|
||||
pub struct NavbarItem {
|
||||
pub mut:
|
||||
href string
|
||||
label string
|
||||
position string
|
||||
}
|
||||
|
||||
pub struct Navbar {
|
||||
pub mut:
|
||||
title string
|
||||
items []NavbarItem
|
||||
}
|
||||
|
||||
pub struct SSHConnection {
|
||||
pub mut:
|
||||
name string = 'main'
|
||||
login string = 'root' // e.g. 'root'
|
||||
host string // e.g. info.ourworld.tf
|
||||
port int = 21 // default is std ssh port
|
||||
key string
|
||||
key_path string // location of the key (private ssh key to be able to connect over ssh)
|
||||
}
|
||||
|
||||
pub struct BuildDest {
|
||||
pub mut:
|
||||
ssh_name string = 'main'
|
||||
path string // can be on the ssh root or direct path e.g. /root/hero/www/info
|
||||
}
|
||||
|
||||
pub struct ImportSource {
|
||||
pub mut:
|
||||
url string // http git url can be to specific path
|
||||
path string
|
||||
dest string // location in the docs folder of the place where we will build docusaurus
|
||||
replace map[string]string // will replace ${NAME} in the imported content
|
||||
visible bool
|
||||
}
|
||||
|
||||
// Export config as JSON files (main.json, navbar.json, footer.json)
|
||||
pub fn (config Config) export_json(path string) ! {
|
||||
// Ensure directory exists
|
||||
os.mkdir_all(path)!
|
||||
|
||||
// Export main.json
|
||||
os.write_file('${path}/main.json', json.encode_pretty(config.main))!
|
||||
|
||||
// Export navbar.json
|
||||
os.write_file('${path}/navbar.json', json.encode_pretty(config.navbar))!
|
||||
|
||||
// Export footer.json
|
||||
os.write_file('${path}/footer.json', json.encode_pretty(config.footer))!
|
||||
}
|
||||
|
||||
pub fn (c Config) write(path string) ! {
|
||||
mut footer_file := pathlib.get_file(path: '${path}/footer.json', create: true)!
|
||||
footer_file.write(json.encode(c.footer))!
|
||||
mut main_file := pathlib.get_file(path: '${path}/main.json', create: true)!
|
||||
main_file.write(json.encode(c.main))!
|
||||
mut navbar_file := pathlib.get_file(path: '${path}/navbar.json', create: true)!
|
||||
navbar_file.write(json.encode(c.navbar))!
|
||||
}
|
||||
@@ -78,101 +78,36 @@ fn (mut self DocusaurusFactory) generate_package_json() ! {
|
||||
name = self.config.navbar.title.to_lower().replace(' ', '-')
|
||||
}
|
||||
|
||||
// Create the JSON structure manually
|
||||
package_json := '{
|
||||
"name": "${name}",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.1.0",
|
||||
"@docusaurus/preset-classic": "^3.1.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.1.0",
|
||||
"@docusaurus/tsconfig": "^3.1.0",
|
||||
"@docusaurus/types": "^3.1.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [">0.5%", "not dead", "not op_mini all"],
|
||||
"development": ["last 1 chrome version", "last 1 firefox version", "last 1 safari version"]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}' // Write to file
|
||||
|
||||
// Load package.json from template
|
||||
// The 'name' variable is defined in this function's scope and will be used by $tmpl.
|
||||
content := $tmpl('templates/package.json')
|
||||
mut package_file := pathlib.get_file(
|
||||
path: os.join_path(self.path_build.path, 'package.json')
|
||||
create: true
|
||||
)!
|
||||
package_file.write(package_json)!
|
||||
package_file.write(content)!
|
||||
}
|
||||
|
||||
// Generate tsconfig.json based on the configuration
|
||||
fn (mut self DocusaurusFactory) generate_tsconfig_json() ! {
|
||||
// Create tsconfig.json as a manual JSON string
|
||||
tsconfig_json := '{
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src/**/*", "docusaurus.config.ts"]
|
||||
}'
|
||||
|
||||
// Write to file
|
||||
// Load tsconfig.json from template
|
||||
content := $tmpl('templates/tsconfig.json')
|
||||
mut tsconfig_file := pathlib.get_file(
|
||||
path: os.join_path(self.path_build.path, 'tsconfig.json')
|
||||
create: true
|
||||
)!
|
||||
tsconfig_file.write(tsconfig_json)!
|
||||
tsconfig_file.write(content)!
|
||||
}
|
||||
|
||||
// Generate sidebars.ts based on the configuration
|
||||
fn (mut self DocusaurusFactory) generate_sidebars_ts() ! {
|
||||
// Simple default sidebar structure
|
||||
sidebar_content := "import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
- render a sidebar for each doc of that group
|
||||
- provide next/previous navigation
|
||||
|
||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
*/
|
||||
const sidebars: SidebarsConfig = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
};
|
||||
|
||||
export default sidebars;
|
||||
"
|
||||
// Load sidebars.ts from template
|
||||
content := $tmpl('templates/sidebars.ts')
|
||||
mut sidebars_file := pathlib.get_file(
|
||||
path: os.join_path(self.path_build.path, 'sidebars.ts')
|
||||
create: true
|
||||
)!
|
||||
sidebars_file.write(sidebar_content)!
|
||||
sidebars_file.write(content)!
|
||||
}
|
||||
|
||||
// Generate docusaurus.config.ts based on the configuration
|
||||
@@ -192,135 +127,70 @@ fn (mut self DocusaurusFactory) generate_docusaurus_config_ts() ! {
|
||||
'img/favicon.png'
|
||||
}
|
||||
|
||||
// Define additional variables for the template
|
||||
// Variables `title`, `tagline`, `favicon`, `url`, `base_url` are already defined above (lines 181-193)
|
||||
projectName := self.config.main.name
|
||||
navbarTitle := self.config.navbar.title
|
||||
|
||||
// Format navbar items from config
|
||||
mut navbar_items := []string{}
|
||||
mut navbar_items_list_temp := []string{}
|
||||
for item in self.config.navbar.items {
|
||||
navbar_items << "{
|
||||
navbar_items_list_temp << "{
|
||||
label: '${item.label}',
|
||||
href: '${item.href}',
|
||||
position: '${item.position}'
|
||||
}"
|
||||
}
|
||||
|
||||
navbar_items_str := navbar_items.join(',\n ')
|
||||
navbarItems := navbar_items_list_temp.join(',\n ') // Matches ${navbarItems} in template
|
||||
|
||||
// Generate footer links if available
|
||||
mut footer_links := []string{}
|
||||
mut footer_links_list_temp := []string{}
|
||||
for link in self.config.footer.links {
|
||||
mut items := []string{}
|
||||
mut items_temp := []string{}
|
||||
for item in link.items {
|
||||
mut item_str := '{'
|
||||
if item.label != '' {
|
||||
item_str += "label: '${item.label}', "
|
||||
}
|
||||
|
||||
// Ensure only one of 'to', 'href', or 'html' is used
|
||||
// Priority: href > to > html
|
||||
if item.href != '' {
|
||||
item_str += "href: '${item.href}'"
|
||||
} else if item.to != '' {
|
||||
item_str += "to: '${item.to}'"
|
||||
} else {
|
||||
// Default to linking to docs if nothing specified
|
||||
item_str += "to: '/docs'"
|
||||
item_str += "to: '/docs'" // Default link
|
||||
}
|
||||
|
||||
item_str += '}'
|
||||
items << item_str
|
||||
items_temp << item_str
|
||||
}
|
||||
|
||||
footer_links << "{
|
||||
footer_links_list_temp << "{
|
||||
title: '${link.title}',
|
||||
items: [
|
||||
${items.join(',\n ')}
|
||||
${items_temp.join(',\n ')}
|
||||
]
|
||||
}"
|
||||
}
|
||||
|
||||
footer_links_str := footer_links.join(',\n ')
|
||||
footerLinks := footer_links_list_temp.join(',\n ') // Matches ${footerLinks} in template
|
||||
|
||||
// Year for copyright
|
||||
year := time.now().year.str()
|
||||
|
||||
// Copyright string (variable `copyright` must be in scope for the template)
|
||||
// `title` is defined at line 181, `year` is defined above.
|
||||
copyright := if self.config.main.copyright != '' {
|
||||
self.config.main.copyright
|
||||
} else {
|
||||
'Copyright © ${year} ${title}'
|
||||
}
|
||||
|
||||
// Construct the full config file content
|
||||
config_content := "import {themes as prismThemes} from 'prism-react-renderer';
|
||||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
const config: Config = {
|
||||
title: '${title}',
|
||||
tagline: '${tagline}',
|
||||
favicon: '${favicon}',
|
||||
|
||||
// Set the production url of your site here
|
||||
url: '${url}',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
||||
baseUrl: '${base_url}',
|
||||
|
||||
// GitHub pages deployment config.
|
||||
// If you aren't using GitHub pages, you don't need these.
|
||||
organizationName: 'freeflowuniverse', // Usually your GitHub org/user name.
|
||||
projectName: '${self.config.main.name}', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'warn',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Enable for i18n
|
||||
// i18n: {
|
||||
// defaultLocale: 'en',
|
||||
// locales: ['en'],
|
||||
// },
|
||||
|
||||
presets: [
|
||||
[
|
||||
'classic',
|
||||
{
|
||||
docs: {
|
||||
sidebarPath: './sidebars.ts',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
},
|
||||
} satisfies Preset.Options,
|
||||
],
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
navbar: {
|
||||
title: '${self.config.navbar.title}',
|
||||
items: [
|
||||
${navbar_items_str}
|
||||
],
|
||||
},
|
||||
footer: {
|
||||
style: '${self.config.footer.style}',
|
||||
links: [
|
||||
${footer_links_str}
|
||||
],
|
||||
copyright: '${copyright}',
|
||||
},
|
||||
prism: {
|
||||
theme: prismThemes.github,
|
||||
darkTheme: prismThemes.dracula,
|
||||
},
|
||||
} satisfies Preset.ThemeConfig,
|
||||
};
|
||||
|
||||
export default config;
|
||||
"
|
||||
// Load docusaurus.config.ts from template
|
||||
// All required variables (title, tagline, favicon, url, base_url,
|
||||
// projectName, navbarTitle, navbarItems, footerLinks, copyright)
|
||||
// are in scope for $tmpl.
|
||||
content := $tmpl('templates/docusaurus.config.ts')
|
||||
|
||||
mut config_file := pathlib.get_file(
|
||||
path: os.join_path(self.path_build.path, 'docusaurus.config.ts')
|
||||
create: true
|
||||
)!
|
||||
config_file.write(config_content)!
|
||||
config_file.write(content)!
|
||||
}
|
||||
|
||||
33
lib/web/docusaurus/templates/.gitignore
vendored
33
lib/web/docusaurus/templates/.gitignore
vendored
@@ -1,14 +1,21 @@
|
||||
build_dev_publish.sh
|
||||
build_publish.sh
|
||||
build.sh
|
||||
develop.sh
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
static
|
||||
src
|
||||
package.json
|
||||
package-lock.json
|
||||
cfg/footer.json
|
||||
cfg/main.json
|
||||
cfg/navbar.json
|
||||
cfg/sidebar.json
|
||||
cfg/ssh.json
|
||||
.pnp
|
||||
.pnp.js
|
||||
|
||||
# build output
|
||||
build
|
||||
.docusaurus
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
|
||||
echo "Docs directory: ??script_dir"
|
||||
|
||||
cd "${mydir}"
|
||||
|
||||
export PATH=/tmp/docusaurus_build/node_modules/.bin:??{HOME}/.bun/bin/:??PATH
|
||||
|
||||
rm -rf ${site.path_build.path}/build/
|
||||
|
||||
${profile_include}
|
||||
|
||||
bun docusaurus build
|
||||
|
||||
@for dest in cfg.main.build_dest_dev
|
||||
rsync -rv --delete ${site.path_build.path}/build/ ${dest.trim_right("/")}/
|
||||
@end
|
||||
91
lib/web/docusaurus/templates/docusaurus.config.ts
Normal file
91
lib/web/docusaurus/templates/docusaurus.config.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
const config: Config = {
|
||||
title: '${title}',
|
||||
tagline: '${tagline}',
|
||||
favicon: '${favicon}',
|
||||
|
||||
// Set the production url of your site here
|
||||
url: '${url}',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
||||
baseUrl: '${base_url}',
|
||||
|
||||
// GitHub pages deployment config.
|
||||
// If you aren't using GitHub pages, you don't need these.
|
||||
organizationName: 'freeflowuniverse', // Usually your GitHub org/user name.
|
||||
projectName: '${projectName}', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'warn',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Enable for i18n
|
||||
// i18n: {
|
||||
// defaultLocale: 'en',
|
||||
// locales: ['en'],
|
||||
// },
|
||||
|
||||
presets: [
|
||||
[
|
||||
'classic',
|
||||
{
|
||||
docs: {
|
||||
sidebarPath: './sidebars.ts',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
},
|
||||
} satisfies Preset.Options,
|
||||
],
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
navbar: {
|
||||
title: '${navbarTitle}',
|
||||
items: [
|
||||
@for item in navbar_items {
|
||||
{
|
||||
label: '${item.label}',
|
||||
href: '${item.href}',
|
||||
position: '${item.position}'
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
footer: {
|
||||
style: '${footerStyle}',
|
||||
links: [
|
||||
@for link_group in footer_links {
|
||||
{
|
||||
title: '${link_group.title}',
|
||||
items: [
|
||||
@for item in link_group.items {
|
||||
{
|
||||
label: '${item.label}',
|
||||
@if item.href != '' {
|
||||
href: '${item.href}'
|
||||
} @else if item.to != '' {
|
||||
to: '${item.to}'
|
||||
} @else {
|
||||
to: '/docs'
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
copyright: '${copyright}',
|
||||
},
|
||||
prism: {
|
||||
theme: prismThemes.github,
|
||||
darkTheme: prismThemes.dracula,
|
||||
},
|
||||
} satisfies Preset.ThemeConfig,
|
||||
};
|
||||
|
||||
export default config;
|
||||
39
lib/web/docusaurus/templates/package.json
Normal file
39
lib/web/docusaurus/templates/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "${name}",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.1.0",
|
||||
"@docusaurus/preset-classic": "^3.1.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.1.0",
|
||||
"@docusaurus/tsconfig": "^3.1.0",
|
||||
"@docusaurus/types": "^3.1.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [">0.5%", "not dead", "not op_mini all"],
|
||||
"development": ["last 1 chrome version", "last 1 firefox version", "last 1 safari version"]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
||||
18
lib/web/docusaurus/templates/sidebars.ts
Normal file
18
lib/web/docusaurus/templates/sidebars.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
- render a sidebar for each doc of that group
|
||||
- provide next/previous navigation
|
||||
|
||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
*/
|
||||
const sidebars: SidebarsConfig = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
};
|
||||
|
||||
export default sidebars;
|
||||
8
lib/web/docusaurus/templates/tsconfig.json
Normal file
8
lib/web/docusaurus/templates/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src/**/*", "docusaurus.config.ts"]
|
||||
}
|
||||
65
lib/web/site/config.v
Normal file
65
lib/web/site/config.v
Normal file
@@ -0,0 +1,65 @@
|
||||
module docusaurus
|
||||
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import json
|
||||
import os
|
||||
|
||||
// Combined config structure
|
||||
pub struct Config {
|
||||
pub mut:
|
||||
name string
|
||||
title string = 'My Documentation Site'
|
||||
description string
|
||||
tagline string
|
||||
favicon string = 'img/favicon.png'
|
||||
image string = 'img/tf_graph.png'
|
||||
copyright string = 'someone'
|
||||
footer Footer
|
||||
navbar Navbar
|
||||
import_sources []ImportSource
|
||||
}
|
||||
|
||||
|
||||
// Footer config structures
|
||||
pub struct FooterItem {
|
||||
pub mut:
|
||||
label string
|
||||
to string
|
||||
href string
|
||||
}
|
||||
|
||||
pub struct FooterLink {
|
||||
pub mut:
|
||||
title string
|
||||
items []FooterItem
|
||||
}
|
||||
|
||||
pub struct Footer {
|
||||
pub mut:
|
||||
style string = 'dark'
|
||||
links []FooterLink
|
||||
}
|
||||
|
||||
|
||||
// Navbar config structures
|
||||
pub struct NavbarItem {
|
||||
pub mut:
|
||||
href string
|
||||
label string
|
||||
position string
|
||||
}
|
||||
|
||||
pub struct Navbar {
|
||||
pub mut:
|
||||
title string
|
||||
items []NavbarItem
|
||||
}
|
||||
|
||||
pub struct ImportSource {
|
||||
pub mut:
|
||||
url string // http git url can be to specific path
|
||||
path string
|
||||
dest string // location in the docs folder of the place where we will build docusaurus
|
||||
replace map[string]string // will replace ${NAME} in the imported content
|
||||
visible bool
|
||||
}
|
||||
100
lib/web/site/example/config.heroscript
Normal file
100
lib/web/site/example/config.heroscript
Normal file
@@ -0,0 +1,100 @@
|
||||
!!docusaurus.config
|
||||
name:"ThreeFold DePIN Tech"
|
||||
description:"ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet."
|
||||
tagline:"Geo Aware Internet Platform"
|
||||
favicon:"img/favicon.png"
|
||||
image:"img/tf_graph.png"
|
||||
copyright:"ThreeFold"
|
||||
|
||||
!!docusaurus.navbar
|
||||
title:"ThreeFold DePIN Tech"
|
||||
logo_alt:"ThreeFold Logo"
|
||||
logo_src:"img/logo.svg"
|
||||
logo_src_dark:"img/new_logo_tft.png"
|
||||
|
||||
!!docusaurus.navbar_item
|
||||
label:"ThreeFold.io"
|
||||
href:"https://threefold.io"
|
||||
position:"right"
|
||||
|
||||
!!docusaurus.navbar_item
|
||||
label:"Mycelium Network"
|
||||
href:"https://mycelium.threefold.io/"
|
||||
position:"right"
|
||||
|
||||
!!docusaurus.navbar_item
|
||||
label:"AI Box"
|
||||
href:"https://aibox.threefold.io/"
|
||||
position:"right"
|
||||
|
||||
!!docusaurus.footer
|
||||
style:"dark"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Docs"
|
||||
label:"Introduction"
|
||||
href:"https://docs.threefold.io/docs/introduction"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Docs"
|
||||
label:"Litepaper"
|
||||
href:"https://docs.threefold.io/docs/litepaper/"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Docs"
|
||||
label:"Roadmap"
|
||||
href:"https://docs.threefold.io/docs/roadmap"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Docs"
|
||||
label:"Manual"
|
||||
href:"https://manual.grid.tf/"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Features"
|
||||
label:"Become a Farmer"
|
||||
href:"https://docs.threefold.io/docs/category/become-a-farmer"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Features"
|
||||
label:"Components"
|
||||
href:"https://docs.threefold.io/docs/category/components"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Features"
|
||||
label:"Technology"
|
||||
href:"https://threefold.info/tech/"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Features"
|
||||
label:"Tokenomics"
|
||||
href:"https://docs.threefold.io/docs/tokens/tokenomics"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Web"
|
||||
label:"ThreeFold.io"
|
||||
href:"https://threefold.io"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Web"
|
||||
label:"Dashboard"
|
||||
href:"https://dashboard.grid.tf"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Web"
|
||||
label:"GitHub"
|
||||
href:"https://github.com/threefoldtech/home"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Web"
|
||||
label:"Mycelium Network"
|
||||
href:"https://mycelium.threefold.io/"
|
||||
|
||||
!!docusaurus.footer_item
|
||||
title:"Web"
|
||||
label:"AI Box"
|
||||
href:"https://www2.aibox.threefold.io/"
|
||||
|
||||
!!docusaurus.collections
|
||||
url:"https://github.com/example/external-docs"
|
||||
replace:"PROJECT_NAME:My Project, VERSION:1.0.0"
|
||||
Reference in New Issue
Block a user