pwshub.com

Secure, efficient private npm registries with Cloudsmith and Deno

In Deno 1.44, we landed private npm registry support to allow development teams to easily share internal modules. Managing npm registries — private or public — presents challenges such as security vulnerabilities, lack of visibility into package usage, and availabilities.

Which is why we’re thrilled to announce support for using npm registries with Cloudsmith, a secure, cloud-native artifact management platform. Cloudsmith offers secure, controlled, and efficient package management for all formats including private in-house modules and public npm packages.

Why Cloudsmith?

Cloudsmith offers a powerful solution for managing npm packages, whether private or sourced from public registries. Here are some reasons to consider Cloudsmith:

  • Enhanced Security: Cloudsmith not only permits authorized users to access your npm packages, but also verifies and scans every npm package in your project for security and compliance threats.
  • Visibility: Cloudsmith provides full transparency into all packages used in your projects, letting you track, audit, and manage all dependencies.
  • Efficiency: Cloudsmith’s caching speeds up builds and ensures your projects are not dependent on the availability of public registries.

Cloudsmith makes it simple to securely manage your software supply chain, leading to faster development cycles, more reliable deployments, and greater peace of mind.

Managing a Private Module with Cloudsmith

Here’s how to manage private modules using Cloudsmith.

1. Setup your Cloudsmith repository

First, create a private repository in Cloudsmith to store your npm modules.

2. Create and publish your npm module

Create your npm module and publish it to your Cloudsmith repository. For example, if you have a module called my-fave-npm-package, you can publish it with npm:

npm publish --registry https://npm.cloudsmith.io/ciara-demo/npm-repo

3. Configure Deno to use your private npm registry

Create a .npmrc file to point to your Cloudsmith repo with the necessary authentication:

@cloudsmith:registry=https://npm.cloudsmith.io/YOUR_ORG/YOUR_REPO
///npm.cloudsmith.io/YOUR_ORG/YOUR_REPO/:_authoToken=YOUR_TOKEN_HERE

Next, configure your deno.json file to import your private module:

{
  "imports": {
    "@cloudsmith/my-fave-npm-package": "npm:my-fave-npm-package@1.0.0"
  }
}

4. Use your private module in Deno

In your main.ts file, you can import and use the private module:

import helloWorld from "@cloudsmith/my-fave-npm-package";
console.log(helloWorld());

5. Run your Deno project

You can run your project:

deno run --allow-net main.ts

And there you have it — your project is now pulling private modules from Cloudsmith!

What’s next

There are many other ways to use Cloudsmith with Deno. A more advanced use case would be to pull public npm modules into your secure Cloudsmith repository using their upstream proxies, which allows Cloudsmith to scan, vet, and cache your dependencies in one place.

🚨️ Deno 2 is right around the corner 🚨️

You can install the Deno 2 Release Candidate today by using deno upgrade rc or the DENO_FUTURE=1 environment variable.

For details on breaking changes between 1.x and 2, please refer to our migration guide.

Source: deno.com

Related stories
3 weeks ago - Our last 1.x release before Deno 2 comes with a ton of features, ranging from a simpler, improved CLI, to multi-threaded web servers, improvements to Node.js/npm compatibility, and more.
1 month ago - In this adoption guide, we’ll discuss some reasons to choose Fastify, key features, compare Fastify to some popular alternatives, and more. The post Fastify adoption guide: Overview, examples, and alternatives appeared first on LogRocket...
3 weeks ago - Secret management tool helps businesses protect sensitive data by securely storing and encrypting passwords, API keys, and certificates in centralized vaults. This ensures that only authorized users and applications can access these...
1 month ago - A cloud phone system is a calling solution that uses VoIP (Voice over Internet Protocol) technology for communication. It’s hosted on a cloud PBX (Private Branch Exchange) rather than an in-house server with expensive hardware, which...
1 month ago - This tutorial will guide you through the core concepts and new features of Java Streams, covering basic and advanced stream operations.
Other stories
1 hour ago - Ubuntu 24.10 ‘Oracular Oriole’ is released on October 13th, and as you’d expect from a new version of Ubuntu, it’s packed with new features. As a short-term release, Ubuntu 24.10 gets 9 months of ongoing updates, security patches, and...
3 hours ago - Did you know that CSS can play a significant role in web accessibility? While CSS primarily handles the visual presentation of a webpage, when you use it properly it can enhance the user’s experience and improve accessibility. In this...
4 hours ago - Design thinking workshops are your key to turning big problems into clear solutions. In this blog, I share how to run them efficiently and keep your team aligned. The post How to run a design thinking workshop appeared first on LogRocket...
4 hours ago - New memory-optimized X8g instances offer up to 3 TiB DDR5 memory, 192 vCPUs, and 50 Gbps network bandwidth, designed for memory-intensive workloads like databases, analytics, and caching with unparalleled price/performance and efficiency.
4 hours ago - Gain indispensable data engineering expertise through a hands-on specialization by DeepLearning.AI and AWS. This professional certificate covers ingestion, storage, querying, modeling, and more.