Fetch the runtime JS modules into `dist/runtime/` mirroring their CDN layout.
(out_dir: &Path)
| 86 | |
| 87 | /// Fetch the runtime JS modules into `dist/runtime/` mirroring their CDN layout. |
| 88 | fn vendor_runtime(out_dir: &Path) -> Result<()> { |
| 89 | for rel in RUNTIME_FILES { |
| 90 | let url = format!("{RUNTIME_BASE}{rel}"); |
| 91 | let bytes = fetch(&url).with_context(|| format!("fetching {url}"))?; |
| 92 | let path = out_dir.join("runtime").join(rel); |
| 93 | if let Some(p) = path.parent() { |
| 94 | fs::create_dir_all(p)?; |
| 95 | } |
| 96 | fs::write(&path, bytes)?; |
| 97 | } |
| 98 | Ok(()) |
| 99 | } |
| 100 | |
| 101 | /// Walk the project for `.py` files; skip hidden dirs and the output directory itself. |
| 102 | fn collect_scripts(project: &Path, out_dir: &Path) -> Vec<PathBuf> { |