From 0f1349bca8d40dff23098e141363c956a8dd7875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 14 Feb 2023 02:13:44 +0100 Subject: feat: Deprecate 'deno bundle' subcommand (#17695) This commit adds a deprecation warning when using "deno bundle" subcommand and removes it from the output of "deno help". --- cli/args/flags.rs | 1 + cli/tests/integration/watcher_tests.rs | 7 +++++-- cli/tests/testdata/bundle/shebang_file.bundle.out | 2 ++ cli/tools/bundle.rs | 9 +++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index ee8ec2563..21a940dc5 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -767,6 +767,7 @@ glob {*_,*.,}bench.{js,mjs,ts,mts,jsx,tsx}: fn bundle_subcommand<'a>() -> Command<'a> { compile_args(Command::new("bundle")) + .hide(true) .arg( Arg::new("source_file") .takes_value(true) diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs index 5ba16cd5e..99d5a5727 100644 --- a/cli/tests/integration/watcher_tests.rs +++ b/cli/tests/integration/watcher_tests.rs @@ -402,6 +402,8 @@ fn bundle_js_watch() { let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); + assert_contains!(stderr_lines.next().unwrap(), "Warning"); + assert_contains!(stderr_lines.next().unwrap(), "deno_emit"); assert_contains!(stderr_lines.next().unwrap(), "Check"); let next_line = stderr_lines.next().unwrap(); assert_contains!(&next_line, "Bundle started"); @@ -455,8 +457,9 @@ fn bundle_watch_not_exit() { .unwrap(); let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); - let next_line = stderr_lines.next().unwrap(); - assert_contains!(&next_line, "Bundle started"); + assert_contains!(stderr_lines.next().unwrap(), "Warning"); + assert_contains!(stderr_lines.next().unwrap(), "deno_emit"); + assert_contains!(stderr_lines.next().unwrap(), "Bundle started"); assert_contains!(stderr_lines.next().unwrap(), "error:"); assert_eq!(stderr_lines.next().unwrap(), ""); assert_eq!(stderr_lines.next().unwrap(), " syntax error ^^"); diff --git a/cli/tests/testdata/bundle/shebang_file.bundle.out b/cli/tests/testdata/bundle/shebang_file.bundle.out index df425f656..978fe6d97 100644 --- a/cli/tests/testdata/bundle/shebang_file.bundle.out +++ b/cli/tests/testdata/bundle/shebang_file.bundle.out @@ -1,3 +1,5 @@ +Warning "deno bundle" is deprecated and will be removed in the future. +Use alternative bundlers like "deno_emit", "esbuild" or "rollup" instead. Bundle file:///[WILDCARD]/subdir/shebang_file.js #!/usr/bin/env -S deno run --allow-read // deno-fmt-ignore-file diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs index 86b28828b..6a9019cd8 100644 --- a/cli/tools/bundle.rs +++ b/cli/tools/bundle.rs @@ -25,6 +25,15 @@ pub async fn bundle( bundle_flags: BundleFlags, ) -> Result<(), AnyError> { let cli_options = Arc::new(CliOptions::from_flags(flags)?); + + log::info!( + "{} \"deno bundle\" is deprecated and will be removed in the future.", + colors::yellow("Warning"), + ); + log::info!( + "Use alternative bundlers like \"deno_emit\", \"esbuild\" or \"rollup\" instead." + ); + let resolver = |_| { let cli_options = cli_options.clone(); let source_file1 = &bundle_flags.source_file; -- cgit v1.2.3