Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

remove: don't fail when manifest.toml is missing

If you run `gleam remove` in a project that's never been built (or
where someone deleted manifest.toml while sorting out a dependency
mess) the command crashes with a generic File IO error coming from
the manifest read inside cleanup(). gleam.toml itself doesn't get
updated.

Skip the cleanup when manifest.toml doesn't exist. There's nothing
to clean up in that case and the next build will regenerate it
anyway.

Closes #5654.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>

+12 -1
+5
CHANGELOG.md
··· 188 188 189 189 ### Bug fixes 190 190 191 + - Fixed a bug where `gleam remove` would fail with a confusing File IO error 192 + if `manifest.toml` didn't exist yet (e.g. in a freshly-created project or 193 + after the manifest had been deleted). 194 + ([Charlie Tonneslan](https://github.com/c-tonneslan)) 195 + 191 196 - Fixed a bug where the build tool would check for new major versions of a local 192 197 or git dependency on Hex when running `gleam update`. 193 198 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
+7 -1
compiler-cli/src/remove.rs
··· 46 46 47 47 // Write the updated config 48 48 fs::write(root_config.as_path(), &toml.to_string())?; 49 - _ = crate::dependencies::cleanup(paths, cli::Reporter::new())?; 49 + 50 + // If there's no manifest yet (e.g. the project has never been built) we 51 + // don't need to clean it up. `cleanup` reads manifest.toml unconditionally 52 + // and that failed with a confusing "File IO failure" before this guard. 53 + if paths.manifest().exists() { 54 + _ = crate::dependencies::cleanup(paths, cli::Reporter::new())?; 55 + } 50 56 51 57 Ok(()) 52 58 }