From 51f5f5789b3b00b327ee7130dc259d24ee631851 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:18:13 -0700 Subject: feat(add): Add npm packages to package.json if present (#25477) Closes https://github.com/denoland/deno/issues/25321 Ended up being a larger refactoring, since we're now juggling (potentially) two config files in the same `add`, instead of choosing one. I don't love the shape of the code, but I think it's good enough Some smaller side improvements: - `deno remove` supports `jsonc` - `deno install --dev` will be a really simple change - if `deno remove` removes the last import/dependency in the `imports`/`dependencies`/`devDependencies` field, it removes the field instead of leaving an empty object --- tests/specs/remove/basic/__test__.jsonc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/specs/remove/basic') diff --git a/tests/specs/remove/basic/__test__.jsonc b/tests/specs/remove/basic/__test__.jsonc index 2f4d82c88..495496b5c 100644 --- a/tests/specs/remove/basic/__test__.jsonc +++ b/tests/specs/remove/basic/__test__.jsonc @@ -12,5 +12,8 @@ }, { "args": ["eval", "console.log(Deno.readTextFileSync('deno.lock').trim())"], "output": "remove_lock.out" + }, { + "args": ["eval", "console.log(Deno.readTextFileSync('deno.json').trim())"], + "output": "{\n}\n" }] } -- cgit v1.2.3