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

super-cp

v0.2.0

Published

copy files to any storage.

Readme

Super Copy

super-cp 用于将文件传输到任意存储系统

目前已支持的传输目标有:

  • Aliyun OSS

安装和使用

# 全局安装
$ npm i -g super-cp
$ super-cp
# 项目安装
$ npm i super-cp
$ ./node_modules/.bin/super-cp

配置

super-cp 使用一个配置文件来设定传输规则,一般是项目目录下的 .super-cp.yml,你可以使用 --config 手动指定使用的配置文件。

在 super-cp 中有三个重要概念:sourcedist 以及 rulessource 指定需要传输的本地文件集合,dist 指定传输目标,rules 指定对传输对象的处理规则集合(例如:为对象存储添加 Content-Type,为服务器上的文件设置正确的权限位)。

source

source:
  pattern:
    glob: dist/**/*
    options:
      dot: true
  strip: dist
source2:
  pattern: dist/**/*
  strip: dist

source 指定了要被传输的文件,它有以下参数

  • pattern.glob(string): 用于匹配文件的 glob pattern,如 dist/**/*,语法可以参考 minimatch - npm 的介绍
  • pattern.options(object): 传给 glob 的选项,参考 Glob Options,默认值为:{ nodir: true }
  • pattern(string): 当不需要设置 options 时,可在 pattern 上直接设置一个字符串作为 glob
  • strip(string): 剥除路径,在上面的例子中,假设匹配到一个文件:dist/index.html,实际传递给目标的,是 index.html

dist

dist:
  type: "@oss"
  bucket: my-bucket
  path: /test/

dist 指定了文件传输的目标,其中 type 参数指定目标存储插件,其他参数将被透传给目标存储插件(目前本项目仅实现了 Aliyun OSS 目标存储插件,未来将支持使用 npm 包名来指定目标存储插件,如: @super-cp/s3

rules

rules:
  - pattern:
      glob: "*/**"
      options:
        noext: true
    autoContentType: true
  - pattern: "*.html"
    headers:
      cacheControl: public, max-age=60

rules 是对文件的简单“处理”,每条规则有以下参数

  • pattern.glob(string): 用于筛选文件的 glob pattern,基于 strip 之后的路径进行匹配
  • pattern.options(object): 传给 minimatch 的选项,参考 Minimatch Options,默认值为:{ dot: true }
  • pattern(string): 当不需要设置 options 时,可在 pattern 上直接设置一个字符串作为 glob
  • exclude(boolean): exclude 是一个特殊规则,当它为 true 时,匹配到的文件不传输
  • 其他参数将被传递给对应的目标插件

environments

environments:
  test:
    - source:
      dist:
      rules:
  production:
    - source:
      dist:
      rules:
  documents:
    - source:
      dist:
      rules:
    - source:
      dist:
      rules:

environments 帮助你编排多组传输策略,environments 下的每个属性里可以有多个传输策略集合,你可以使用 super-cp -e <environment_name> 来使用其中的某个传输策略集,如果不指定这个参数,默认会使用名为 default 的策略集合。

你可以使用这个特性来实现 CI/CD 环境下的多环境发布

tips

你可以使用 yaml 的 anchor label 来实现复用,可以参考一个复杂的配置

OSS 插件

OSS 用于将文件传输到阿里云 OSS,它实现了自动 Mime 类型补充,以及 MD5 校验(避免重复上传相同文件)

dist options:

详情参考官方文档

值得注意的是,所有以 $ 开头的合法 unix 变量名均会被替换成环境变量的真实值,你可以利用这个特性载入 CI 环境的秘密环境变量

dist:
  type: "@oss"
  path: /test/
  bucket: my-bucket
  region: $OSS_REGION
  accessKeyId: $OSS_ACCESS_KEY_ID
  accessKeySecret: $OSS_ACCESS_KEY_SECRET

rule options:

  • autoMimeType(boolean): 自动根据文件后缀识别并补充 Content-Type 元数据
  • headers([key: string]: string): 设置文件的 header 元数据
rules:
  # 所有文件自动添加 Content-Type Headers
  - pattern: "*/**"
    autoContentType: true

  # 为根目录的 html 文件设置缓存时间为 60s
  - pattern: "*.html"
    headers:
      cacheControl: public, max-age=60