diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs index adfd04b9e4..61e50ba8d3 100644 --- a/cli/npm/managed/resolvers/local.rs +++ b/cli/npm/managed/resolvers/local.rs @@ -515,6 +515,15 @@ async fn sync_resolution_with_fs( .add(package.clone(), package_path); } + if let Some(deprecated) = &package.deprecated { + log::info!( + "{} {:?} is deprecated: {}", + crate::colors::yellow("Warning"), + package.id, + crate::colors::gray(deprecated), + ); + } + // finally stop showing the progress bar drop(pb_guard); // explicit for clarity Ok::<_, AnyError>(()) diff --git a/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.d.mts b/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.d.mts new file mode 100644 index 0000000000..29da1e6d7b --- /dev/null +++ b/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.d.mts @@ -0,0 +1,3 @@ +export declare function setValue(val: number): void; +export declare function getValue(): number; +export declare const url: string; diff --git a/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.mjs b/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.mjs new file mode 100644 index 0000000000..0a44f75859 --- /dev/null +++ b/tests/registry/npm/@denotest/deprecated-package/1.0.0/main.mjs @@ -0,0 +1,11 @@ +let value = 0; + +export function setValue(newValue) { + value = newValue; +} + +export function getValue() { + return value; +} + +export const url = import.meta.url; diff --git a/tests/registry/npm/@denotest/deprecated-package/1.0.0/package.json b/tests/registry/npm/@denotest/deprecated-package/1.0.0/package.json new file mode 100644 index 0000000000..af82efef00 --- /dev/null +++ b/tests/registry/npm/@denotest/deprecated-package/1.0.0/package.json @@ -0,0 +1,9 @@ +{ + "name": "@denotest/deprecated-package", + "version": "1.0.0", + "type": "module", + "main": "main.mjs", + "types": "main.d.mts", + "deprecated": "Deprecated version" + } + \ No newline at end of file diff --git a/tests/specs/install/install_deprecated_package/__test__.jsonc b/tests/specs/install/install_deprecated_package/__test__.jsonc new file mode 100644 index 0000000000..23c9cdb3f0 --- /dev/null +++ b/tests/specs/install/install_deprecated_package/__test__.jsonc @@ -0,0 +1,25 @@ +{ + "tempDir": true, + "envs": { + "DENO_FUTURE": "1" + }, + "steps": [ + { + "args": "install npm:@denotest/deprecated-package", + "output": "install.out" + }, + { + // make sure the dep got cached + "args": "run --cached-only main.js", + "exitCode": 0, + "output": "" + }, + { + "args": [ + "eval", + "console.log(Deno.readTextFileSync('package.json').trim())" + ], + "output": "package.json.out" + } + ] +} diff --git a/tests/specs/install/install_deprecated_package/install.out b/tests/specs/install/install_deprecated_package/install.out new file mode 100644 index 0000000000..9dc84fbc1a --- /dev/null +++ b/tests/specs/install/install_deprecated_package/install.out @@ -0,0 +1,5 @@ +Add npm:@denotest/deprecated-package@1.0.0 +Download http://localhost:4260/@denotest/deprecated-package +Download http://localhost:4260/@denotest/deprecated-package/1.0.0.tgz +Initialize @denotest/deprecated-package@1.0.0 +Warning @denotest/deprecated-package@1.0.0 is deprecated: Deprecated version diff --git a/tests/specs/install/install_deprecated_package/main.js b/tests/specs/install/install_deprecated_package/main.js new file mode 100644 index 0000000000..de5026c50e --- /dev/null +++ b/tests/specs/install/install_deprecated_package/main.js @@ -0,0 +1,2 @@ +import { setValue } from "@denotest/deprecated-package"; +setValue(5); diff --git a/tests/specs/install/install_deprecated_package/package.json b/tests/specs/install/install_deprecated_package/package.json new file mode 100644 index 0000000000..18a1e415e5 --- /dev/null +++ b/tests/specs/install/install_deprecated_package/package.json @@ -0,0 +1,3 @@ +{ + "dependencies": {} +} diff --git a/tests/specs/install/install_deprecated_package/package.json.out b/tests/specs/install/install_deprecated_package/package.json.out new file mode 100644 index 0000000000..4b4b08087a --- /dev/null +++ b/tests/specs/install/install_deprecated_package/package.json.out @@ -0,0 +1,3 @@ +{ + "dependencies": { "@denotest/deprecated-package": "^1.0.0" } +}