Jeremi
Jeremi4w ago

How to use a private Deno module hosted in a private repository?

Hello, I am trying to publish and use a private Deno module from one repository to another. The repositories are hosted on Azure DevOps. Following the docs and other online resources, there are 2 main ways to do that: - Publish a npm package with dnt on the Azure DevOps npm private registry, - Use the raw file directly from the other repo using DENO_AUTH_TOKENS env variable for authentication. For the first solution, the problem is the module I want to publish uses Deno.Command, and there is currently no support in dnt for converting it (https://github.com/denoland/node_shims/issues/110). I also tried to create a simpler npm package with only the module's Deno Typescript files. I am able to publish it on the npm private registry, but when I'm using it from another Deno project, there is a runtime issue because Deno doesn't support importing typescript files from npm packages:
> deno run -A test.ts
error: TypeScript files are not supported in npm packages
> deno run -A test.ts
error: TypeScript files are not supported in npm packages
For the use of a raw Typescript file imported directly from another Azure DevOps repo, I am not able to have the authentication work properly. I have set DENO_AUTH_TOKENS env variable with a token that works for getting the code, using Basic Auth credentials format from the Deno docs (https://docs.deno.com/runtime/fundamentals/modules/#deno_auth_tokens).
$env:DENO_AUTH_TOKENS = "MY_USER:MY_TOKEN@dev.azure.com"
$env:DENO_AUTH_TOKENS = "MY_USER:MY_TOKEN@dev.azure.com"
but when I run the script Deno isn't able to reach the file. It is like the token wasn't sent correctly:
(...)
DEBUG RS - deno::auth_tokens:149 - Parsed 1 auth token(s).
(...)

error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
Specifier: https://spsprodweu5.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=...
(...)
DEBUG RS - deno::auth_tokens:149 - Parsed 1 auth token(s).
(...)

error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
Specifier: https://spsprodweu5.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=...
What is the proper way to do that? Or is there any other way to consume a Deno module hosted in a private repository without using dnt?
GitHub
Issues · denoland/node_shims
npm packages providing shims for the Deno namespace and other globals. Useful for running Deno-first programs on Node. - Issues · denoland/node_shims
Deno
Modules and dependencies
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?