From af8c3ffd736e5b93a41548281c2d024046c3a266 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 17 May 2023 17:39:15 +0200 Subject: [PATCH] fixed docs index.html overwrite --- crates/docs/src/lib.rs | 9 ++++----- crates/docs/src/static/index.html | 2 +- www/build.sh | 12 +++++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/crates/docs/src/lib.rs b/crates/docs/src/lib.rs index d1f00a506d..654411925f 100644 --- a/crates/docs/src/lib.rs +++ b/crates/docs/src/lib.rs @@ -135,7 +135,7 @@ pub fn generate_docs_html(root_file: PathBuf) { // TODO fix: as is, this overrides an existing index.html // Write index.html for package (/index.html) - /*{ + { let rendered_package = template_html .replace( "", @@ -156,7 +156,7 @@ pub fn generate_docs_html(root_file: PathBuf) { error ) }); - }*/ + } // Write each package module's index.html file for module_docs in loaded_module.docs_by_module.values() { @@ -196,8 +196,7 @@ fn page_title(package_name: &str, module_name: &str) -> String { format!("{module_name} - {package_name}") } -// TODO re-enable with let rendered_package = template_html... -/*fn render_package_index(root_module: &LoadedModule) -> String { +fn render_package_index(root_module: &LoadedModule) -> String { // The list items containing module links let mut module_list_buf = String::new(); @@ -228,7 +227,7 @@ fn page_title(package_name: &str, module_name: &str) -> String { ); index_buf -}*/ +} fn render_module_documentation( module: &ModuleDocumentation, diff --git a/crates/docs/src/static/index.html b/crates/docs/src/static/index.html index 45b65da6e9..5bcd4d07fe 100644 --- a/crates/docs/src/static/index.html +++ b/crates/docs/src/static/index.html @@ -42,7 +42,7 @@ diff --git a/www/build.sh b/www/build.sh index 37701971e1..c4f880339b 100755 --- a/www/build.sh +++ b/www/build.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# run from root of repo with `./www/build.sh` +# check www/README.md to run a test server + # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ set -euxo pipefail @@ -48,8 +51,11 @@ cargo --version export ROC_DOCS_URL_ROOT=/builtins cargo run --release --bin roc-docs crates/compiler/builtins/roc/main.roc -mv generated-docs/*.* www/build # move all the .js, .css, etc. files to build/ -mv generated-docs/ www/build/builtins # move all the folders to build/builtins/ +mv generated-docs/*.js www/build # move all .js files to build/ +mv generated-docs/*.css www/build +mv generated-docs/*.svg www/build + +mv generated-docs/ www/build/builtins # move all the rest to build/builtins/ # Manually add this tip to all the builtin docs. find www/build/builtins -type f -name 'index.html' -exec sed -i 's!!
Tip: Some names differ from other languages.
!' {} \; @@ -58,7 +64,7 @@ find www/build/builtins -type f -name 'index.html' -exec sed -i 's!!