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

config-upload

v0.3.0

Published

> 📦 Upload files to storage with only one command.

Readme

config-upload npm

📦 Upload files to storage with only one command.

Install

$ yarn add dev config-upload

or install globally

$ yarn global add config-upload

If you prefer using npm:

$ npm install --dev config-upload

Usage

  1. Run config-update --init to create a config file with prompt. Or simply putting config in .config-upload.json.
{
  "dists": {
    "s3": {
      "bucket": "my-vault",
      "folder": "path/to/images"
    }
  },
  "sources": [
    {
      "dist": "s3",
      "include": "images/*",
    }
  ]
}
  1. Upload files to storage with the following command
$ config-upload

CLI

$ config-upload --help

  Usage
    $ config-upload [options]

  Options
    --init           Initialize a configuration file.
    --no-fail-fast   Upload all files no matter what. Default will exiting on first failure.
    --config         Config file path. Default is ".config-upload.json".
    --context        Additional context provided to config.

  Examples
    $ config-upload --init
    $ config-upload
    $ config-upload --config path/to/config.json
    $ config-upload --context '{"revision": "v1.2.3"}'

Config

Need to configure some options by putting it in .config-upload.json

{
  "dists": {
    "dist name": {
      "type": "s3",
      "bucket": "bucket-name",
      "folder": "path/to/folder",
      "filename": "[name].[other-context].[ext]",
      "uploader info": "...",
      "another uploader info": "..."
    }
  },
  "sources": [
    {
      "dist": "dist name",
      "include": "my-files-folder/*",
      "exclude": "**/file_not_include",
      "folder": "override/folder/of/dist",
      "filename": "override_the_filename_from_dist"
    }
  ]
}

dists

dist name

Type: String

Name the distination

type

Type: String

The way to upload. If not specify, it will use dist name as default.

Currently support types:

  • s3
  • qiniu

bucket

Type: String

Storage's bucket name.

folder

Type: String

Default: ''

Folder's path.

filename

Type: String

Default: [name].[ext]

File name in storage. Default is original file name.

folder and filename enable you to replace value with [name] [ext] or other injected context. For example, if uploaded file is image1.jpg, folder/to/[ext]/ will replaced to folder/to/jpg.

Provide context example:

command:            $ config-upload --context '{"revision": "v4", "prefix": "a"}'
source:             "bird.png"
folder:             "/folder/[revision]"
filename:           "[prefix]_[name].[ext]"

file path in storage: /folder/v4/a_bird.png

sources

Type: Array<Object>

Files prepared to upload by the defined array of object.

dist

Type: String

An upload destination defined in the dists section. Specify dist name as it's value.

include

Type: String

Includes files that matching pattern. Using glob.

exclude

Type: String

Excludes files that matching pattern. It takes priority over include. Using glob.

folder

Override folder settings.

filename

Override filename settings.

Config Example

Basic example - Upload to S3

{
  "dists": {
    "s3": {
      "bucket": "BUCKET_NAME",
      "folder": "path/to/folder",
      "accessKey": "XXXXXXXXXXXXXXX",
      "secretKey": "XXXXXXXXXXXXXXX"
    },
  },
  "sources": [
    {
      "dist": "s3",
      "include": "upload_files/*"
    },
  ]
}

Custom Distination Name - Use s3 uploader

{
  "dists": {
    "my_vault": {
      "type": "s3",
      "bucket": "BUCKET_NAME",
    },
  },
  "sources": [
    {
      "dist": "my_vault",
      "include": "upload_files/*"
    }
  ]
}

Exclude file - Without .txt file

{
  "dists": {
    "s3": {
      "bucket": "BUCKET_NAME",
    },
  },
  "sources": [
    {
      "dist": "s3",
      "include": "upload_files/*",
      "exclude": "**/*.txt"
    }
  ]
}

Provide context - Git revision in folder path

command:

$ config-upload --context "{\"revision\": \"`git rev-parse HEAD`\"}"

config:

{
  "dists": {
    "s3": {
      "bucket": "BUCKET_NAME",
      "folder": "folder/[revision]"
    },
  },
  "sources": [
    {
      "dist": "s3",
      "include": "upload_files/*"
    }
  ]
}

TODO

  • [ ] Support YAML format
  • [ ] AWS S3 permission group
  • [ ] More uploaders

LICENSE

MIT