DenoDDeno
Powered by
JeremiJ
Deno•14mo ago•
1 reply
Jeremi

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
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
Modules and dependencies
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How to use private remote modules hosted on GitHub on Deno Deploy?
nickchen120235Nnickchen120235 / help
3y ago
How to use Tensorflow in Deno?
OxooxoOOxooxo / help
7mo ago
Trying to deploy a project on Deno Deploy with a private Github repository dependency
sociopatenSsociopaten / help
3y ago