Skip to content

Commit

Permalink
Fix crates export
Browse files Browse the repository at this point in the history
  • Loading branch information
Folyd committed May 26, 2024
1 parent 8b07c6b commit 88b9fd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rust/src/tasks/books.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl BooksTask {
Ok(result) => {
let books: Vec<_> = result.into_iter().filter(|book| !book.is_empty()).collect();
let contents = format!(
"let N=null;const booksIndex={};export default booksIndex;",
"var N=null;const booksIndex={};export default booksIndex;",
serde_json::to_string(&books)?
);
let path = Path::new(&self.dest_path);
Expand Down
3 changes: 2 additions & 1 deletion rust/src/tasks/crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn generate_javascript_crates_index(crates: &[Crate], minifier: &Minifier) -> St
})
.collect();
let crate_index = format!(
"const crateIndex={};export default crateIndex;",
"const crateIndex={};",
serde_json::to_string(&crates_map).unwrap()
);
contents.push_str(&Minifier::minify_js(&crate_index));
Expand Down Expand Up @@ -179,6 +179,7 @@ impl Task for CratesTask {
serde_json::to_string(&mapping)?
);
contents.push_str(&generate_javascript_crates_index(&crates, &minifier));
contents.push_str("export {mapping,crateIndex};");
let path = Path::new(&self.dest_path);
fs::write(path, &contents)?;
println!("\nGenerate javascript crates index successful!");
Expand Down

0 comments on commit 88b9fd1

Please sign in to comment.