From c6d1b0a1ccf45b7819b1e6f1efe8687b240f495a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 4 Sep 2024 16:00:44 +0200 Subject: fix(byonm): resolve npm deps of jsr deps (#25399) This allows using npm deps of jsr deps without having to add them to the root package.json. Works by taking the package requirement and scanning the `node_modules/.deno` directory for the best matching package, so it relies on deno's node_modules structure. Additionally to make the transition from package.json to deno.json easier, Deno now: 1. Installs npm deps in a deno.json at the same time as installing npm deps from a package.json. 2. Uses the alias in the import map for `node_modules/` for better package.json compatiblity. --- tests/integration/npm_tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/integration/npm_tests.rs') diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index db63d4533..61ef0b22d 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -2195,7 +2195,7 @@ console.log(getKind()); .args("run --allow-read chalk.ts") .run(); output.assert_matches_text( - r#"error: Could not find a matching package for 'npm:chalk@5' in a package.json file. You must specify this as a package.json dependency when the node_modules folder is not managed by Deno. + r#"error: Could not find a matching package for 'npm:chalk@5' in the node_modules directory. Ensure you have all your JSR and npm dependencies listed in your deno.json or package.json, then run `deno install`. Alternatively, turn on auto-install by specifying `"nodeModulesDir": "auto"` in your deno.json file. at file:///[WILDCARD]chalk.ts:1:19 "#); output.assert_exit_code(1); @@ -2277,7 +2277,7 @@ console.log(getKind()); .args("run --allow-read chalk.ts") .run(); output.assert_matches_text( - r#"error: Could not find a matching package for 'npm:chalk@5' in a package.json file. You must specify this as a package.json dependency when the node_modules folder is not managed by Deno. + r#"error: Could not find a matching package for 'npm:chalk@5' in the node_modules directory. Ensure you have all your JSR and npm dependencies listed in your deno.json or package.json, then run `deno install`. Alternatively, turn on auto-install by specifying `"nodeModulesDir": "auto"` in your deno.json file. at file:///[WILDCARD]chalk.ts:1:19 "#); output.assert_exit_code(1); -- cgit v1.2.3