Skip to content

Commit

Permalink
adding docs on private registries
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjofrank committed Jul 4, 2024
1 parent 9ae09c4 commit 49b5864
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 2 deletions.
4 changes: 3 additions & 1 deletion runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export const sidebar = [
items: [
"/runtime/manual/basics/modules/",
"/runtime/manual/basics/modules/reloading_modules/",
"/runtime/manual/basics/modules/private/",
"/runtime/manual/basics/modules/private_repositories/",
"/runtime/manual/basics/modules/private_registries/",
"/runtime/manual/basics/modules/grpc_connections/",
"/runtime/manual/basics/modules/proxies/",
"/runtime/manual/basics/modules/integrity_checking/",
"/runtime/manual/advanced/publishing/",
Expand Down
20 changes: 20 additions & 0 deletions runtime/manual/basics/modules/grpc_connections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "gRPC Connections"
---

gRPC is a high-performance, open-source, universal RPC framework that enables efficient communication between services. With gRPC support, you can build real-time, interactive applications that leverage the low-latency communication capabilities of gRPC.

Deno supports gRPC connections using the `@grpc/grpc-js` client library from npm. This enables you to connect to gRPC services, such as Google Cloud Platform, directly from Deno. For example, you can classify an image using the Google Cloud Vision API:

```typescript title="classifyImage.ts"

import { ImageAnnotatorClient } from "npm:@google-cloud/vision";

const client = new ImageAnnotatorClient();
const [result] = await client.labelDetection("./cat_dog.webp");
const labels = result.labelAnnotations;
console.log("Labels:");
for (const label of labels) {
console.log(" - ", label.description);
}
```
56 changes: 56 additions & 0 deletions runtime/manual/basics/modules/private_registries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "Private Registries"
---

Deno supports private registries, which allow you to host and share your own
modules. This is useful for organizations that want to keep their code private
or for individuals who want to share their code with a select group of people.

## What are private registries?

Large organizations often host their own private npm registries to manage internal packages securely. These private registries serve as repositories where organizations can publish and store their proprietary or custom packages. Unlike public npm registries, private registries are accessible only to authorized users within the organization.

## How to use private registries with Deno

First, configure your `.npmrc` file to point to your private registry. You can do this by adding the following line to your `.npmrc` file:

```sh
@mycompany:registry=http://mycompany.com:8111/
//mycompany.com:8111/:_auth=secretToken
```

Replace `http://mycompany.com:8111/` with the actual URL of your private registry and `secretToken` with your authentication token.

Then update Your `deno.json` or `package.json` to specify the import path for your private package. For example:

```json title="deno.json"
{
"imports": {
"@mycompany/package": "npm:@mycompany/[email protected]"
}
}
```

or if you're using a `package.json`:

```json title="package.json"
{
"dependencies": {
"@mycompany/package": "1.0.0"
}
}
```

Now you can import your private package in your Deno code:

```typescript title="main.ts"
import { hello } from "@mycompany/package";

console.log(hello());
```

and run it using the `deno run` command:

```sh
deno run main.ts
```
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/manual/getting_started/setup_your_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ There are several environment variables which can impact the behavior of Deno:

- `DENO_AUTH_TOKENS` - a list of authorization tokens which can be used to allow
Deno to access remote private code. See the
[Private modules and repositories](../basics/modules/private.md) section for
[Private modules and repositories](../basics/modules/private_repositories.md) section for
more details.
- `DENO_TLS_CA_STORE` - a list of certificate stores which will be used when
establishing TLS connections. The available stores are `mozilla` and `system`.
Expand Down

0 comments on commit 49b5864

Please sign in to comment.