-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
execPath still requires the use of deno #155
Comments
Would you be able to show more details about your problem? If the code is using |
Sure...i'm writing this cli. It's quite simple and its using this https://deno.land/x/cmd@v1.2.0 to parse Deno.args and call the proper command. https://github.com/SvelteLab/cli/tree/main/src For the moment there's just a single command but actually even just trying to run npx sveltelab (that should only show the default message) results in an error when the user doesn't have deno installed.
This is my build file that uses dnt https://github.com/SvelteLab/cli/blob/main/tasks/build-npm.ts |
Ok apparently it's used here https://deno.land/x/cmd@v1.2.0/deps.ts?source but given that this is shimming Deno...should this actually return the execPath of node? |
It looks like commander is asking for the location of Deno here: https://github.com/acathur/cmd/blob/07339f4c7f8971c0a86e9371bf686b1549984fbd/deps.ts#L37 So I don't think this is an issue in these shims. It looks like What I'd recommend doing is upgrading dnt to the latest 0.37.0 version to get npm specifier support: https://github.com/SvelteLab/cli/blob/6c9074a8912cfa27c51041f028c1c5382a9acec1/tasks/build-npm.ts#L1 Then change this line: To something like: import { Command } from 'npm:commander@^11.0'; That seems to make it work for me. |
I don't know if you looked at my previous comment but what i'm asking is: if the goal of dnt (and more specifically node_shims) is to provide a way to cross publish deno and npm shouldnt this shim change the execPath from deno to node? |
Actually, you could just add the following when calling mappings: {
'https://deno.land/x/cmd@v1.2.0/mod.ts': {
name: 'commander',
version: '^11.0'
}
}, |
I think i did that in the beginning but if i'm not mistaken the two packages have slightly different apis...i'll try tho |
Usually people will use For example, what would it do in this scenerio? export function runDeno(args: string[]) {
const denoExec = Deno.execPath();
// code here that calls deno with the provided arguments
} It's better for library authors to use something like https://github.com/dsherret/which_runtime to figure out what runtime the code is being run in for specific scenarios, then add some runtime specific behaviour. |
Mmm i guess it's fair...at the end of the day this should mostly be a problem for libraries that are ported from node to deno and try to recreate process in deno. That said i still think a shim should provide the "correct" path for the shimmed version. However i completely understand and trust you on this decision 😄 Feel free to close this issue if you don't think it's a good idea to change this. |
I'm trying to use this but if i try to build with dnt it throws the follwing error
is that expected behavior? |
Try this:
|
Uh sorry didn't saw that. However just as an hjeads up version 0.35.0 and up errors out
However i was able to build with 0.34.0 |
I think you're using an old version of Deno ( |
node_shims/packages/shim-deno/src/deno/stable/functions/execPath.ts
Line 5 in 094b9cf
I'm trying to build a cli with Deno and cross publish to npm using
dnt
but the cli works only if deno is installed and the above LOC should be the culprit. It tryes to find deno and throws if there's no deno installed.Can i do something about this?
The text was updated successfully, but these errors were encountered: