From 5057f58145ab47276fdc4392619888e37aea8864 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 19 Sep 2024 05:55:50 +1000 Subject: [PATCH] feat: suggest `deno install --entrypoint` instead of `deno cache` (#25228) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hides `deno cache` from `--help` output. --------- Signed-off-by: Asher Gomez Co-authored-by: Bartek IwaƄczuk --- cli/args/flags.rs | 3 ++- cli/args/lockfile.rs | 2 +- cli/lsp/language_server.rs | 2 +- tests/ffi/tests/ffi_types.ts | 2 +- tests/integration/npm_tests.rs | 5 ++++- .../specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out | 2 +- .../lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out | 2 +- .../lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out | 2 +- .../lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out | 2 +- .../lockfile/frozen_lockfile/frozen_new_dep_jsr_cache.out | 2 +- .../lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out | 2 +- tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out | 2 +- .../lockfile/frozen_lockfile/frozen_package_json_changed.out | 2 +- .../frozen_lockfile/frozen_package_json_changed_install.out | 2 +- tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out | 2 +- 15 files changed, 19 insertions(+), 15 deletions(-) diff --git a/cli/args/flags.rs b/cli/args/flags.rs index d66ee253fe..79ee38d75b 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -1651,7 +1651,8 @@ Future runs of this module will trigger no downloads or compilation unless --rel Read more: https://docs.deno.com/go/cache"), UnstableArgsConfig::ResolutionOnly, - ) +) + .hide(true) .defer(|cmd| { compile_args(cmd) .arg(check_arg(false)) diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index 35552b5b4e..59ec7f0ef5 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -246,7 +246,7 @@ impl CliLockfile { // has an extra newline at the end let diff = diff.trim_end(); Err(deno_core::anyhow::anyhow!( - "The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it.\nchanges:\n{diff}" + "The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.\nchanges:\n{diff}" )) } else { Ok(()) diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 6626767dd9..f8fffd2929 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -240,7 +240,7 @@ impl LanguageServer { } } - /// Similar to `deno cache` on the command line, where modules will be cached + /// Similar to `deno install --entrypoint` on the command line, where modules will be cached /// in the Deno cache, including any of their dependencies. pub async fn cache( &self, diff --git a/tests/ffi/tests/ffi_types.ts b/tests/ffi/tests/ffi_types.ts index de2f4e4059..a996195c69 100644 --- a/tests/ffi/tests/ffi_types.ts +++ b/tests/ffi/tests/ffi_types.ts @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // deno-lint-ignore-file -// Only for testing types. Invoke with `deno cache` +// Only for testing types. Invoke with `deno install --entrypoint` const remote = Deno.dlopen("dummy_lib.so", { method1: { parameters: ["usize", "bool"], result: "void" }, diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index aaea65d14c..3aea62fc6c 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -1821,7 +1821,10 @@ fn reload_info_not_found_cache_but_exists_remote() { { // create it temp_dir.write("deno.json", r#"{}"#); - test_context.new_command().args("cache main.ts").run(); + test_context + .new_command() + .args("install --entrypoint main.ts") + .run(); assert!(temp_dir.path().join("deno.lock").exists()); // remove a version found in the lockfile diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out index 9a25fd413f..3998a04593 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out @@ -1,4 +1,4 @@ -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "npm:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out index 2e10aaca54..7c86a23cf3 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out @@ -1,5 +1,5 @@ Download http://localhost:4545/welcome.ts -error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 10 | - } 10 | + }, diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out index 6a3dcf5c4b..c22b529edb 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out @@ -1,7 +1,7 @@ Download http://127.0.0.1:4250/@denotest/add/meta.json Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts -error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "jsr:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out index 1f866f24e8..4ae4d059cc 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out @@ -1,5 +1,5 @@ Download http://localhost:4260/@denotest/subtract -error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "npm:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_cache.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_cache.out index 0ed46a9491..9c0fa7edcc 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_cache.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_cache.out @@ -1,4 +1,4 @@ -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "jsr:@denotest/add@1": "1.0.0" 5 | - }, diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out index 6e7a1462f8..fe628a454a 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out @@ -1,6 +1,6 @@ Download http://127.0.0.1:4250/@denotest/add/0.2.0_meta.json Download http://127.0.0.1:4250/@denotest/add/0.2.0/mod.ts -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "jsr:@denotest/add@1": "1.0.0" 5 | - }, diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out index 6645c913e0..057b9632b3 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out @@ -1,5 +1,5 @@ Download http://localhost:4260/@denotest/subtract -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "npm:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out b/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out index 05d1ca3753..dc31a1a653 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out @@ -1,5 +1,5 @@ Download http://localhost:4260/@denotest/bin -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "npm:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed_install.out b/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed_install.out index 112edc411f..8690396c0e 100644 --- a/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed_install.out +++ b/tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed_install.out @@ -1,4 +1,4 @@ -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 4 | - "npm:@denotest/add@1": "1.0.0" 4 | + "npm:@denotest/add@1": "1.0.0", diff --git a/tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out b/tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out index ba63f475a6..27dc66fd2f 100644 --- a/tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out +++ b/tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out @@ -1,5 +1,5 @@ Download http://localhost:4260/@denotest/add -error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. changes: 1 | - 1 | +{