Skip to content

Commit b85eea6

Browse files
feat: Set --unstable-byonm during publishing by default (#54)
1 parent d4e5408 commit b85eea6

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export async function publish(cwd: string, options: PublishOptions) {
158158
"publish",
159159
"--unstable-bare-node-builtins",
160160
"--unstable-sloppy-imports",
161+
"--unstable-byonm",
161162
"--no-check",
162163
...options.publishArgs,
163164
];

test/commands.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,44 @@ describe("publish", () => {
499499
});
500500
}).timeout(600000);
501501

502+
it("should leave node_modules as is", async () => {
503+
await runInTempDir(async (dir) => {
504+
const pkgJsonPath = path.join(dir, "package.json");
505+
const pkgJson = await readJson<PkgJson>(pkgJsonPath);
506+
pkgJson.exports = {
507+
".": "./mod.js",
508+
};
509+
await writeJson(pkgJsonPath, pkgJson);
510+
511+
// Add dependency
512+
await runJsr(["i", "--npm", "@std/encoding@0.216.0"], dir);
513+
514+
await writeTextFile(
515+
path.join(dir, "mod.ts"),
516+
[
517+
'import * as encoding from "@std/encoding/hex";',
518+
"console.log(encoding);",
519+
"export const value = 42;",
520+
].join("\n"),
521+
);
522+
523+
await writeJson<DenoJson>(path.join(dir, "jsr.json"), {
524+
name: "@deno/jsr-cli-test",
525+
version: pkgJson.version!,
526+
exports: {
527+
".": "./mod.ts",
528+
},
529+
});
530+
531+
await runJsr(["publish", "--dry-run", "--token", "dummy-token"], dir);
532+
533+
assert.ok(
534+
!(await isDirectory(path.join(dir, "node_modules", ".deno"))),
535+
".deno found inside node_modules",
536+
);
537+
});
538+
});
539+
502540
// Windows doesn't support #!/usr/bin/env
503541
if (process.platform !== "win32") {
504542
it("use deno binary from DENO_BIN_PATH when set", async () => {

0 commit comments

Comments
 (0)