deno-cliffy icon indicating copy to clipboard operation
deno-cliffy copied to clipboard

Can't use npmUpgradeProvider with bun

Open rubenfiszel opened this issue 1 year ago • 3 comments

Compiled package with dnt

npm upgrade provider works fine on node but on bun:

â–¶ bun /git/windmill/cli/npm/esm/main.js upgrade 
87 |             }
88 |         });
89 |     }),
90 |     get writable() {
91 |         if (stdoutWritable == null) {
92 |             stdoutWritable = node_stream_1.default.Writable.toWeb(process.stdout);

                  ^
TypeError: undefined is not a function
      at node:stream:3045:33
      at writable (/git/windmill/cli/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/std.js:92:61)
      at start (/git/windmill/cli/npm/esm/deps/jsr.io/@cliffy/command/1.0.0-rc.5/upgrade/spinner.js:153:95)
      at /git/windmill/cli/npm/esm/deps/jsr.io/@cliffy/command/1.0.0-rc.5/upgrade/upgrade_command.js:86:22
      at /git/windmill/cli/npm/esm/deps/jsr.io/@cliffy/command/1.0.0-rc.5/upgrade/upgrade_command.js:77:30
      at /git/windmill/cli/npm/esm/deps/jsr.io/@cliffy/command/1.0.0-rc.5/command.js:970:2

and that's because bun is missing toWeb: https://github.com/oven-sh/bun/issues/3927

Is there a way to write the upgrade provider such that it doesn't rely on that api (after shimmed by dnt)

rubenfiszel avatar Sep 06 '24 10:09 rubenfiszel

Commenting this line is enough: https://github.com/c4spar/deno-cliffy/blob/main/command/upgrade/spinner.ts#L201

Maybe removing the spinner as an option would solve the issue for now?

rubenfiszel avatar Sep 06 '24 10:09 rubenfiszel

Does this still happen when importing cliffy from JSR?

KnorpelSenf avatar Oct 30 '25 10:10 KnorpelSenf

In fact, bun finally managed to add toWeb support anyway, so this should just be closed

KnorpelSenf avatar Oct 30 '25 10:10 KnorpelSenf