rust_to_npm/generators/
uninstall.rs

1pub use super::generate_installs;
2
3/// create the uninstall script for the repo
4pub fn generate_uninstall(name: &String) -> String {
5    format!(
6        r#"{}
7const binp = path.join(cargoDir, "bin", "{name}");
8
9if (fs.existsSync(binp)) {{
10  console.log("Uninstalling {name}...");
11  exec(`cargo uninstall {name}`, (error, stdout, stderr) => {{
12    console.log(stdout);
13    if (error || stderr) {{
14      console.log(error || stderr);
15    }}
16  }});
17}} else {{
18  console.log("{name} not found skipping!");
19}}
20    
21    "#,
22        generate_installs()
23    )
24}