mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
refactor: separate publish from pm subcommands (#28237)
This commit is contained in:
parent
761a9b62ce
commit
29c4661d0b
19 changed files with 38 additions and 46 deletions
|
@ -15,6 +15,7 @@ mod module_loader;
|
|||
mod node;
|
||||
mod npm;
|
||||
mod ops;
|
||||
mod registry;
|
||||
mod resolver;
|
||||
mod standalone;
|
||||
mod task_runner;
|
||||
|
@ -108,10 +109,10 @@ fn spawn_subcommand<F: Future<Output = T> + 'static, T: SubcommandOutput>(
|
|||
async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> {
|
||||
let handle = match flags.subcommand.clone() {
|
||||
DenoSubcommand::Add(add_flags) => spawn_subcommand(async {
|
||||
tools::registry::add(flags, add_flags, tools::registry::AddCommandName::Add).await
|
||||
tools::pm::add(flags, add_flags, tools::pm::AddCommandName::Add).await
|
||||
}),
|
||||
DenoSubcommand::Remove(remove_flags) => spawn_subcommand(async {
|
||||
tools::registry::remove(flags, remove_flags).await
|
||||
tools::pm::remove(flags, remove_flags).await
|
||||
}),
|
||||
DenoSubcommand::Bench(bench_flags) => spawn_subcommand(async {
|
||||
if bench_flags.watch.is_some() {
|
||||
|
@ -193,7 +194,7 @@ async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> {
|
|||
}),
|
||||
DenoSubcommand::Outdated(update_flags) => {
|
||||
spawn_subcommand(async move {
|
||||
tools::registry::outdated(flags, update_flags).await
|
||||
tools::pm::outdated(flags, update_flags).await
|
||||
})
|
||||
}
|
||||
DenoSubcommand::Repl(repl_flags) => {
|
||||
|
@ -316,7 +317,7 @@ async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> {
|
|||
),
|
||||
DenoSubcommand::Vendor => exit_with_message("⚠️ `deno vendor` was removed in Deno 2.\n\nSee the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations", 1),
|
||||
DenoSubcommand::Publish(publish_flags) => spawn_subcommand(async {
|
||||
tools::registry::publish(flags, publish_flags).await
|
||||
tools::publish::publish(flags, publish_flags).await
|
||||
}),
|
||||
DenoSubcommand::Help(help_flags) => spawn_subcommand(async move {
|
||||
use std::io::Write;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue