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

verdaccio-aws-and-local-storage

v0.0.12

Published

AWS S3 and local storage implementation for Verdaccio

Downloads

26

Readme

verdaccio-aws-s3-storage

📦 AWS S3 storage plugin for Verdaccio

verdaccio (latest) CircleCI Known Vulnerabilities codecov backers discord MIT node

Twitter followers Github backers stackshare

This plugin was forked based on verdaccio-s3-storage built in Typescript + other features added along the time. Both plugins might have vary in behaviour since then, we recommend use the AWS plugin on this repo due is under control of Verdaccio community and constantly upated.

See it in action

Basic Requirements

  • AWS Account (in case you are using the cloud)
  • Verdaccio server (4.0) (for 3.x use verdaccio-s3-storage instead)
npm install -g verdaccio

Usage

npm install verdaccio-aws-s3-storage

This will pull AWS credentials from your environment.

In your verdaccio config, configure

store:
  aws-s3-storage:
    bucket: your-s3-bucket
    keyPrefix: some-prefix # optional, has the effect of nesting all files in a subdirectory
    region: us-west-2 # optional, will use aws s3's default behavior if not specified
    endpoint: https://{service}.{region}.amazonaws.com # optional, will use aws s3's default behavior if not specified
    s3ForcePathStyle: false # optional, will use path style URLs for S3 objects
    tarballACL: private # optional, use public-read to work with CDN like Amazon CloudFront
    accessKeyId: your-access-key-id # optional, aws accessKeyId for private S3 bucket
    secretAccessKey: your-secret-access-key # optional, aws secretAccessKey for private S3 bucket
    sessionToken: your-session-token # optional, aws sessionToken for private S3 bucket

The configured values can either be the actual value or the name of an environment variable that contains the value for the following options:

  • bucket
  • keyPrefix
  • region
  • endpoint
  • accessKeyID
  • secretAccessKey
  • sessionToken
store:
  aws-s3-storage:
    bucket: S3_BUCKET # If an environment variable named S3_BUCKET is set, it will use that value. Otherwise assumes the bucket is named 'S3_BUCKET'
    keyPrefix: S3_KEY_PREFIX # If an environment variable named S3_KEY_PREFIX is set, it will use that value. Otherwise assumes the bucket is named 'S3_KEY_PREFIX'
    endpoint: S3_ENDPOINT # If an environment variable named S3_ENDPOINT is set, it will use that value. Otherwise assumes the bucket is named 'S3_ENDPOINT'
    ...

store properties can be defined for packages. The storage location corresponds to the folder in s3 bucket.

packages:
  '@scope/*':
    access: all
    publish: $all
    storage: 'scoped'
  '**':
    access: $all
    publish: $all
    proxy: npmjs
    storage: 'public'

Specify ACL of Tarball Files

You can specify ACL of tarball files in S3 by the tarballACL configuration, set to 'private' by default. To enable S3 integrated CDN service (Amazon CloudFront for example), set tarballACL to 'public-read' to grant tarball files anonymous read permission.

store:
  aws-s3-storage:
    tarballACL: public-read

Developer Testing

In case of local testing, this project can be used self-efficiently. Four main ingredients are as follows:

  • config.yaml, see verdaccio documentation
  • The provided docker file allows to test the plugin, with no need for main verdaccio application
  • The provided docker-compose also provides minio in orchestration as a local substitute for S3 backend
  • Create and set content of registry.env as follows. This file does not exist on the repo and should be generated manually after cloning the project.
AWS_ACCESS_KEY_ID=foobar
AWS_SECRET_ACCESS_KEY=1234567e
AWS_DEFAULT_REGION=eu-central-1
AWS_S3_ENDPOINT=https://localhost:9000/
AWS_S3_PATH_STYLE=true

Execute the docker image for testing

You need the latest docker installed in your computer

docker-compose up

By default there is no bucket created, you might need to browse http://127.0.0.1:9000/minio/ and create the example bucket manually named rise and then restart docker-compose up.

The default values should work out of the box. If you change anything, make sure the corresponding variables are set in other parts of the ingredient as well.