Open oscar6echo opened 5 days ago
This is expected behaviour and the primary reason we built JSR. With http
specifiers there is no concept of a "package". From Deno's point of view these are just a bunch of random files with no relation to each other, apart from the import statements. There is no concept of where a package boundary starts or ends.
This is different when using JSR. There every package can have their own imports
mapping and it will be respected as expected.
Thx for the swift reply :+1: Ok very clear ! Does make sense.
In a corp context, where publishing packages anywhere outside incl. JSR is not an option, what would be in your view the best way to share packages ? (I appreciate this is a bit off topic, be grateful for just hints/directions).
@oscar6echo I think there might be a small misunderstanding. You can still use the config file you have there, from a URL - but you will have to specify it explicitly using --config
flag.
@bartlomieju Thx for the tip :+1:
After some trial and error I reached the following conclusion with --config
.
Indeed if a corresponding deno.json
is available on disk it does work.
But if it is remote it does not: --config
expects a path, quite reasonably.
If it could also accept a url then It would be possible to run a remote package in one deno run
command.
(even if not on JSR - again corp use case)
Would it make sense to allow this ?
repo sample-deno-pkg updated.
Still thinking about it :thinking:
It seems the best way to make package available via https
is to put all dependencies with full qualified urls in a deps.ts
.
Thus:
deno.json
deno.json/imports
is replaced by deps.ts
. While it works, is it the recommended way ?
Observation
I noticed that when doing
deno run path/to/main.ts
theimports
field indeno.json
is used - as expected.However when running the same script from remote
deno run https:///abc/xyz/main.ts
this is not the case.So if I need distribute a "package" ie a collection of interdependent
.ts
files then I cannot use the convenience ofdeno.json/imports
.Question
Is it a feature or a bug ?
If it is a feature, to you plan to allow the use of
deno.json
in remote runs ?Or is there a good reason not to ?
Context
I am in a corp env and the best/only way to share such package is via a github enterprise repo.
Repo
To reproduce: https://github.com/oscar6echo/sample-deno-pkg
Screenshots: