Deprecate `deno vendor` and replace with `"vendor": true`?
Deno 1.37 (and actually some earlier versions) has the ability to vendor by specifying the following in a deno.json:
{
"vendor": true
}
After running your program or caching (ex. deno cache mod.ts), a ./vendor folder will be automatically populated with the remote dependencies.
This is considerably easier to use than deno vendor and we should consider deprecating deno vendor in favour of this feature and move the existing deno vendor out into a separate tool.
Wouldn't that make it mandatory to have a deno.json in order to be able to use that feature? Maybe a flag could be added to deno cache like deno cache --vendor or something. Quick vendoring is useful for debugging and patching deps, and some build routines and pipelines might not need a deno.json.
That flag exists today. Read more here: https://deno.com/blog/v1.37#vendor-as-cache-override-unstable
Oops I missed that. Thanks!
What's the current stance on this?
To deprecate deno vendor in favour of "vendor": true and then move deno vendor out of the CLI to a separate library.
this attribute seems to not allow using modules offline, example:
a.ts
import {} from "https://deno.land/[email protected]/encoding/ascii85_test.ts";
deno.json
{ "vendor":true }
run
deno cache a.ts
deno run --no-remote a.ts
fails with
error: A remote specifier was requested: "https://deno.land/[email protected]/encoding/ascii85_test.ts", but --no-remote is specified.
the old method works:
a.ts
import {} from "https://deno.land/[email protected]/encoding/ascii85_test.ts";
create a deno.json with an empty object, so it can be filled with the next command
deno.json
{}
run
deno vendor a.ts
deno run --no-remote a.ts
works with no error
@sigmaSd I think you're looking for --cached-only and not --no-remote? The --no-remote flag means "no remote specifiers are allowed". See https://github.com/denoland/deno/issues/22186
you're right thanks
Currently, the JSR doesn't support raw URL imports. The solution to this would either be rewriting the module to avoid them or to vendor the module. Unfortunately, we are unable to import from the vendor folder using vendor: true in the deno.json. deno vendor works just fine but if it gets deprecated it's unclear what next steps would be for module authors.
We'll deprecate deno vendor subcommand in 1.42 and move it to a JSR package.
Currently, the
JSRdoesn't support raw URL imports. The solution to this would either be rewriting the module to avoid them or to vendor the module. Unfortunately, we are unable to import from thevendorfolder usingvendor: truein the deno.json.deno vendorworks just fine but if it gets deprecated it's unclear what next steps would be for module authors.
Currently, deno cache can put jsr packages under vendor/. deno v1.44.4