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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@origami-network/cli-step-publish-s3

v0.0.0

Published

Module that publish the folder to AWS S3 bucket.

Readme

Build Status Coverage Status

Publish to S3

Publish artifacts to AWS S3 blob storage. Mainly used to allow access client side assets through CDN infrastructure.

Usage

The simple usage is to define custom script that will install and run the command at once.

In the package.json add new script:

{
    ...
    "scripts": {
        "cli-step-publish-s3": "npm install --no-save --silent @origami-network/cli-step-publish-s3 && cli-publish-s3"
        ...
    }
    ...
}

Now it is possible to run the command.

> npm run cli-step-publish-s3 <parameters>

It will copy the ./dist folder of the current package to the defined S3 bucket. The files will be placed with the prefix <name>/v<version>, where <name> and <version> are taken from the current package.

Parameters

It is possible to store pass additional parameters to the script when calling npm run, by adding -- and the arguments of the script:

  • -A, --aws-access-key <value> - AWS access key that has privilege to put objects in bucket.

  • -S, --aws-secret-key <value> - AWS secret key corresponding to access key.

    NOTE: Do not store AWS secret key in the repository. It should be defined in secure storge.

  • -r, --s3-region <name> - S3 bucket region.

  • -b, --s3-bucket <name> - S3 bucket name.

Optionaly fallowing arguments can be used:

  • -p, --s3-key-prefix <value> - S3 bucket key prefix. Parameter is optional.
  • -s, --source <path> - Path with files that should be published. It should be path relative to module. By default it is ./dist.
  • -e, --s3-endpoint <url> - URL to the S3 endpoint. Used for testing purposes with Minio server. Should be omited when working with AWS S3 services.

In addition, fallowing informational parameters can be used:

  • -h, --help - output usage information,
  • -V, --version - output version of the script.

Examples

Command line

if the package.json has defined name foo with version X.Y.Z the example files in ./dist folder:

  • ./dist/bundle.js - /foo/vX.Y.Z/bundle.js
  • ./dist/bundle.css - /foo/vX.Y.Z/bundle.css
  • ./dist/img/logo.svg - /foo/vX.Y.Z/logo.svg

Calling fallowing command:

> npm run cli-step-publish-s3 -- --aws-access-key <access key> --aws-secret-key <secret key> -s3-region us-east-1 --s3-bucket example

Will publish the files in bucket example in the us-east-1 region, under keys:

  • /foo/vX.Y.Z/bundle.js
  • /foo/vX.Y.Z/bundle.css
  • /foo/vX.Y.Z/logo.svg

It is possible to add aditional prefix to the S3 key witt fallowing command:

> npm run cli-step-publish-s3 -- --aws-access-key <access key> --aws-secret-key <secret key> -s3-region us-east-1 --s3-bucket example --s3-key-prefix some-prefix

The keys for published files will looks:

  • /some-prefix/foo/vX.Y.Z/bundle.js
  • /some-prefix/foo/vX.Y.Z/bundle.css
  • /some-prefix/foo/vX.Y.Z/logo.svg

If the files that shoudl be published are other folder, for instance in ./dist/cdn, it is possible to point the location by calling:

> npm run cli-step-publish-s3 -- --aws-access-key <access key> --aws-secret-key <secret key> -s3-region us-east-1 --s3-bucket example --source ./dist/cdn

Jenkinsfile

For Windows slave node add fallowing code to Jenkinsfile.

    withCredentials([[
        $class: 'UsernamePasswordMultiBinding',
        credentialsId: '<CREDENTIALS_ID>',
        usernameVariable: 'AWS_ACCESS_KEY',
        passwordVariable: 'AWS_SECRET_KEY'
    ]]) {    
        bat "npm run cli-step-publish-s3 -- --aws-access-key ${env.AWS_ACCESS_KEY} --aws-secret-key ${env.AWS_SECRET_KEY} -s3-region <region> --s3-bucket <bucket>"
    }
}

On Un*x slave nodes bat step should be replaced with sh step.

Specification

In order to execute living specification suite use the fallowing command.

> npm --aws-access-key=<access key> --aws-secret-key=<secret key> --s3-region=<region> --s3-bucket=<bucket> --public-base-url=<bucket base url> run spec

The S3 bucket to act as CDN should has at last read only policy for direct public access to the objects. Also the CORS should be defined.

Use Minio

Minio is an object storage server compatible with Amazon S3 cloud storage service.

In order to use it the parameter --s3-endpoint=<minio endpoint> need to be provided. See CI/CD file for exeample usage.

TODO

  • Allow to pass Cache-Control header value.