Skip to content

Commit

Permalink
feat: Set --unstable-byonm during publishing by default (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Mar 8, 2024
1 parent d4e5408 commit b85eea6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export async function publish(cwd: string, options: PublishOptions) {
"publish",
"--unstable-bare-node-builtins",
"--unstable-sloppy-imports",
"--unstable-byonm",
"--no-check",
...options.publishArgs,
];
Expand Down
38 changes: 38 additions & 0 deletions test/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,44 @@ describe("publish", () => {
});
}).timeout(600000);

it("should leave node_modules as is", async () => {
await runInTempDir(async (dir) => {
const pkgJsonPath = path.join(dir, "package.json");
const pkgJson = await readJson<PkgJson>(pkgJsonPath);
pkgJson.exports = {
".": "./mod.js",
};
await writeJson(pkgJsonPath, pkgJson);

// Add dependency
await runJsr(["i", "--npm", "@std/[email protected]"], dir);

await writeTextFile(
path.join(dir, "mod.ts"),
[
'import * as encoding from "@std/encoding/hex";',
"console.log(encoding);",
"export const value = 42;",
].join("\n"),
);

await writeJson<DenoJson>(path.join(dir, "jsr.json"), {
name: "@deno/jsr-cli-test",
version: pkgJson.version!,
exports: {
".": "./mod.ts",
},
});

await runJsr(["publish", "--dry-run", "--token", "dummy-token"], dir);

assert.ok(
!(await isDirectory(path.join(dir, "node_modules", ".deno"))),
".deno found inside node_modules",
);
});
});

// Windows doesn't support #!/usr/bin/env
if (process.platform !== "win32") {
it("use deno binary from DENO_BIN_PATH when set", async () => {
Expand Down

0 comments on commit b85eea6

Please sign in to comment.