deno install should bundle before installation

Created on 4 May 2020  路  9Comments  路  Source: denoland/deno

deno install is a utility that allows to install any module as an executable by creating shell script that invokes actual module.

Currently it works by caching all dependencies of the module in $DENO_DIR and adding entry point local URL to the shell script.

Huge caveat in this approach is that if user reloads dependencies installed script might break (especially for untagged imports...).
To mitigate this problem the script should be bundled into a single file during installation.

This way installed script can be made into standalone utilities that do not share cache with other development projects and are completely standalone.

CC @ry

cli feat

All 9 comments

It's challenging to make this a self-contained file still, since it needs to both be a shell script and contain the bundle somehow. For unix you can hack this with:

#!/bin/sh
":" //; exec "deno" "run" [baked options]... "$0" [baked args]... "$@"
;

<bundle output>

In the shell context this is equivalent to:

":" //
exec "deno" "run" [baked options]... "$0" [baked args]... "$@"

And in the JS context it is:

":";
<bundle output>

馃槤

For a first version, I think it would be okay if the bundled lived in a separate file, neighboring the executable script.

We reverted this, so we need to re-open.

I suspect that something like #5276 might be able to be re-landed now the refactor is done.

@kt3k could you update and reopen your PR?

@bartlomieju The previous branch seems unusable (because many things have been changed), but I'll try a new one in another branch 馃憤 (It may take a little while)

By the way I still see some issues about bundling ( https://github.com/denoland/deno/issues?q=is%3Aissue+is%3Aopen+bundle ). Do you think we need an option for enabling/disabling bundling at install time?

@kt3k I think adding a flag is a sensible solution

Yes, I even think with a lot of issues resolved, people may still not want to bundle. I would suggest though that bundling be t the default, and that the option deno install --no-bundle be used to opt out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ry picture ry  路  3Comments

CruxCv picture CruxCv  路  3Comments

ry picture ry  路  3Comments

xueqingxiao picture xueqingxiao  路  3Comments

JosephAkayesi picture JosephAkayesi  路  3Comments