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

@mondopower/codeartifact-auth

v2.0.26

Published

This repo houses a CLI tool and custom Github Action for authenticating npm with AWS codeartifact.

Downloads

20

Readme

aws-codeartifact-auth

This repo houses a CLI tool and custom Github Action for authenticating npm with AWS codeartifact.

Quickstart

Github Action

Usage

The below action will setup npm with the codeartifact registry scoped to the referenced package.

- name: Configure AWS Credentials
  uses: aws-actions/configure-aws-credentials@v2
  with:
    role-to-assume: "<IAM role to assume, e.g. from secrets>"
    role-session-name: "<Sessions name>"
    aws-region: "<AWS region>"
- name: Configure npm with AWS CodeArtifact
  uses: MondoPower/[email protected]
  with:       
    domain: "<Domain in AWS CodeArtifact>"
    repository: "<Repository in AWS CodeArtifact>"
    scope: "<Package Scope (optional)>"
    region: "<AWS Region>"
    accountId: "<AWS AccountId>"
    packageType: "<Package Type>" #Supports poetry or npm as arguments

CLI

Usage

Recommended for local usage, refer to the github action above for CI runners.

Method 1 - Package.json

Add the following to package.json:

{
  "awsCodeArtifact": {
    "domain": "<Domain in AWS CodeArtifact>",
    "repository": "<Repository in AWS CodeArtifact>",
    "scope": "<Package Scope (optional)>",
    "region": "<AWS Region>",
    "accountId": "<AWS AccountId>",
    "packageType": "<Package Type>" //Supports poetry or npm as arguments
  }
}

Once you've added the config to your package.json. You will need to assumerole/set your aws credentials within your running context (CI/Terminal).

Then run codeartifact-auth

It will update your home directories .npmrc file with the scope and token information.

Method 2 - CLI Arguments
CodeArtifact Command Line Arguments

-a --accountId                  AWS AccountId associated with codeartifact repo
-d --domain                     The name of the domain that is in scope for the generated authorization token
-r --repository                 The name of the repository e.g. OrganisationNamePackages
-s --scope                      The npm scope for the private package e.g. @OrganisationName
-p --region                     The region the codeArtifact repository is hosted in e.g. us-east-1
-m --packageType                The package type to set. Currently supports npm or poetry
-h --help                       display help page

Long options may be passed with a single dash.

Example

codeartifact-auth --accountId 290556015539 --domain mondo-artifacts --region ap-southeast-2 -r MondoNPMPackages -s @mondo

Windows Users

If you're using this tool on windows and you have installed it globally, you will need to set the path for npm packages. Otherwise the tool won't be picked up in your path.

Make sure you add it to your system path

e.g. %USERPROFILE%\AppData\Roaming\npm

Example

Image of

Command usage on windows:

codeartifact-auth.cmd

Testing CLI locally

  • npm link
  • build
  • run codeartifact-auth

Potential extensions/improvements

  • CLI Tool to take a config or argument list
  • CLI/Github action support for removing scope. This is useful for users that want all their packages pulled via codeartifact instead of just privately scoped ones.