fix(plugin): let a generated package run deno test straight away

With a package.json beside deno.json, Deno expects node_modules to be
installed, so deno test failed until a deno install, and then failed
to type-check node:assert without @types/node. nodeModulesDir "auto"
installs on demand, and the package now passes deno test, node --test
and bun test as generated.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-09-24 13:00:43 -05:00
1 parent efe7ad6027
commit 52241cc9a6
2 files changed
+4

No files matched your search

+1
View File
@@ -83,6 +83,7 @@ fn deno_json(p: &Package) -> String {
"version": "0.1.0",
"license": "MIT",
"exports": "./src/index.ts",
"nodeModulesDir": "auto",
"imports": {{
"@green-tea/core": "npm:@green-tea/core@{CORE_VERSION}"
}},
+3
View File
@@ -192,6 +192,9 @@ fn package_jsr_writes_the_tree_into_dir() {
let deno = std::fs::read_to_string(pkg.join("deno.json")).unwrap();
assert!(deno.contains("\"name\": \"@acme/plugin-algo\""), "{deno}");
assert!(deno.contains("npm:@green-tea/core@26.9.0-beta.2"), "{deno}");
// Without it `deno test` needs a `deno install` first, and then fails to
// type-check `node:assert` for want of @types/node.
assert!(deno.contains("\"nodeModulesDir\": \"auto\""), "{deno}");
let pj = std::fs::read_to_string(pkg.join("package.json")).unwrap();
assert!(pj.contains("\"private\": true"), "{pj}");
assert!(pj.contains("\"devDependencies\""), "{pj}");