npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-aznpmrcs

v0.4.0

Published

CLI to help with setting up feeds and authentication for Azure DevOps

Downloads

31

Readme

Simple-aznpmrcs

Why I created this

Every 30/60/90 days the PAT was expired that was used for installing NPM dependencies.
Which meant I needed to login, create a new PAT, covert it to base64, update NPMRC and then I was able to proceed.

If you only have one Azure DevOps organization then it is not handy but doable.
I use multiple and therefor needed to login to each of the different Organizations and do the update circus.
And ofcourse, that was always when you can cannot really use it >.<

So in comes this module!
It can create NPMRC' based on the given aZOrganization, azProject and feedname
A PAT is generate automatically and you can update it with ease.

As this is automated, there is no need to have very long lived PAT's. You can use shortlived because well its easy to regenerate.

So how does it work

It uses the Azure CLI to connect.
You need to make sure that you have this installed, and are logged in (az login)

After that you are good to go :-)

How to use it

You can either install it globally npm install -g simple-aznpmrcs or use npx npx -y simple-aznpmrcs to execute the commands.
In the documentation it is expected that you have it installed globally.
If you don't want to install it globally, you need to put npx -y in front of each command.

You do need to have a 'default' npmrc in which you have the npmjs registry set.
If you haven't, you can add this: npm_config_registry=https://registry.npmjs.org before each npx command.

note: It currently only works if your feed is 'project scoped' organization scoped will fail.

Create

For creating a NPMRC one parameter is required:

  • feedName (as available in Artifacts)

One that have a default:

  • name (directory name is used if not provided)

And two that are needed but can be retrieved from a different property. When repository.url is set in the package.json, that one will be used.

  • azOrganization (first part of Azure DevOps url)
  • azProject (second part of Azure DevOps url)

Example Azure DevOps url: https://dev.azure.com/henkvandenbrink/kitchensink
azOrganization = henkvandenbrink
azProject = kitchensink
feedName = As created.

Examples:

Easiest: snmprc create feed-name

  • This will generate an NPMRC with feed-name, the azure details are retrieved from package.json and current directory name is used as name.

More detailed: snpmrc create npm-feed henkvandenbrink kitchensink myNpmrc

  • Here all options are provided and will be used.

Switch

When you have create one or more npmrcs you can easily switch:

snpmrc example-npmrc

Or if you created the NPMRC with the name of the directory:
snpmrc

Use

When issuing the use command a list of all available NPMRC' are shown and you can select one.

snpmrc use

Update

There are three options for updating:

  • All
  • Provide a name
  • Current active npmrc

Update all npmrcs:
snpmrc update all

Update provided NPMRC:
snpmrc myNpmrcs

Update current NPMRC:
snpmrc