deno icon indicating copy to clipboard operation
deno copied to clipboard

Deprecate `deno vendor` and replace with `"vendor": true`?

Open dsherret opened this issue 2 years ago • 10 comments

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.

dsherret avatar Sep 20 '23 10:09 dsherret

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.

Leokuma avatar Oct 21 '23 03:10 Leokuma

That flag exists today. Read more here: https://deno.com/blog/v1.37#vendor-as-cache-override-unstable

dsherret avatar Oct 21 '23 03:10 dsherret

Oops I missed that. Thanks!

Leokuma avatar Oct 21 '23 03:10 Leokuma

What's the current stance on this?

iuioiua avatar Jan 29 '24 21:01 iuioiua

To deprecate deno vendor in favour of "vendor": true and then move deno vendor out of the CLI to a separate library.

dsherret avatar Jan 29 '24 21:01 dsherret

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 avatar Jan 31 '24 17:01 sigmaSd

@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

dsherret avatar Jan 31 '24 17:01 dsherret

you're right thanks

sigmaSd avatar Jan 31 '24 17:01 sigmaSd

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.

lino-levan avatar Feb 15 '24 20:02 lino-levan

We'll deprecate deno vendor subcommand in 1.42 and move it to a JSR package.

bartlomieju avatar Mar 21 '24 01:03 bartlomieju

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.

Currently, deno cache can put jsr packages under vendor/. deno v1.44.4

iugo avatar Jul 05 '24 02:07 iugo