diff --git a/docs/src/lib.rs b/docs/src/lib.rs index bfa9f7ffa1..d4de9c25d2 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -63,9 +63,10 @@ pub fn generate(filenames: Vec, std_lib: StdLib, build_dir: &Path) { // Write each package's module docs html file for (docs_by_id, interns) in package.modules.iter_mut() { for module in docs_by_id.values_mut() { - let mut filename = String::new(); - filename.push_str(module.name.as_str()); - filename.push_str(".html"); + let module_dir = build_dir.join(module.name.as_str()); + + fs::create_dir(&module_dir) + .expect("TODO gracefully handle not being able to create the module dir"); let rendered_module = template_html .replace( @@ -78,7 +79,7 @@ pub fn generate(filenames: Vec, std_lib: StdLib, build_dir: &Path) { render_main_content(interns, module).as_str(), ); - fs::write(build_dir.join(filename), rendered_module) + fs::write(module_dir.join("index.html"), rendered_module) .expect("TODO gracefully handle failing to write html"); } } diff --git a/www/build.sh b/www/build.sh index b5474bfd69..28d29a85b6 100755 --- a/www/build.sh +++ b/www/build.sh @@ -16,17 +16,5 @@ echo 'Generating docs...' # We run the CLI with --no-default-features because that way we don't have a LLVM # dependency. (Netlify's build servers have Rust installed, but not LLVM.) cargo run -p roc_cli --no-default-features docs compiler/builtins/docs/Bool.roc - mv generated-docs/ www/build/builtins - -pushd www/build/builtins - -for f in ./*.html; do - DIRNAME=$(echo "$f" | sed s/.html//) - mkdir "$DIRNAME" - mv "$f" "$DIRNAME"/index.html -done - -popd - popd