diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-07-23 19:00:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-23 19:00:48 -0400 |
commit | 9114a2df69da9318c4e10887553b7daf77b0fa16 (patch) | |
tree | 2309817e74485f9fe8f7b79238afa026070b79df /cli/tools/fmt.rs | |
parent | 6055629ee7f48a4e887392ccac13788aa4008249 (diff) |
fix(upgrade): do not error if config in cwd invalid (#24689)
```
> deno upgrade
error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile.
V:\scratch
> V:\deno\target\debug\deno upgrade
Looking up latest version
Local deno version 1.45.3 is the most recent release
```
Closes #24517
Closes #20729
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r-- | cli/tools/fmt.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 277a79cda..baecb482f 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -49,7 +49,10 @@ use std::sync::Arc; use crate::cache::IncrementalCache; /// Format JavaScript/TypeScript files. -pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> { +pub async fn format( + flags: Arc<Flags>, + fmt_flags: FmtFlags, +) -> Result<(), AnyError> { if fmt_flags.is_stdin() { let cli_options = CliOptions::from_flags(flags)?; let start_dir = &cli_options.start_dir; @@ -74,8 +77,8 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> { move |flags, watcher_communicator, changed_paths| { let fmt_flags = fmt_flags.clone(); Ok(async move { - let factory = CliFactory::from_flags(flags)?; - let cli_options = factory.cli_options(); + let factory = CliFactory::from_flags(flags); + let cli_options = factory.cli_options()?; let caches = factory.caches()?; let mut paths_with_options_batches = resolve_paths_with_options_batches(cli_options, &fmt_flags)?; @@ -119,9 +122,9 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> { ) .await?; } else { - let factory = CliFactory::from_flags(flags)?; + let factory = CliFactory::from_flags(flags); + let cli_options = factory.cli_options()?; let caches = factory.caches()?; - let cli_options = factory.cli_options(); let paths_with_options_batches = resolve_paths_with_options_batches(cli_options, &fmt_flags)?; format_files(caches, &fmt_flags, paths_with_options_batches).await?; |