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

wecos-uploadali

v3.2.3

Published

wecos upload Ali.

Downloads

21

Readme

wecos-uploadali -- 小程序图片上传阿里云存储

安装

npm install wecos-uploadali

基本配置

在你的小程序目录同级下创建wecos.config.json文件

wecos.config.json配置项例子:

{
  "appDir": "./dist",
  "cos": {
    "secret_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    "secret_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "bucket": "wxapp-1251902136",
    "region": "ap-guangzhou", //创建bucket时选择的地域简称
    "folder": "/", //资源存放在bucket的哪个目录下,比如example文件夹下,就是  “example/”
  }
}

| 配置项 | 类型 | 说明 | |:-- |:-- |:-- | | appDir | [String] | 默认 ./app,小程序项目目录 | | cos | [Object] | 必填,填写需要上传到OSS对应的配置信息,部分信息可在[OSS控制台]查看 |

使用

在配置文件同级目录下命令行执行

wecos

注意,执行前需要在该目录下创建wecos.config.json文件

高级配置

| 配置项 | 类型 | 说明 | |:-- |:-- |:-- | | backupDir | [String] | 默认 ./wecos_backup,备份目录(或者指定文本) | | uploadFileSuffix | [Array] | 默认 [".jpg", ".png", ".gif"],图片上传后缀名配置 | | uploadFileBlackList | [Array] | 默认 [],图片资源黑名单 | | replaceHost | [String] | 默认 '',把指定域名替换成 targetHost | | targetHost | [String] | 默认 '',使用自定义域名 | | compress | [Boolean] | 默认 false,是否开启压缩图片 | | watch | [Boolean] | 默认 true,是否开启实时监听项目目录 |

设置备份目录

由于在运行时会自动将项目下的图片上传至COS然后删除,这样可能存在丢失源文件的风险,因此我们也提供了备份源文件的功能,每上传一张图片,会在项目同级的某个目录下备份该文件

为了方便使用,可以通过以下配置来修改备份目录名,如果不需要使用该功能,可以设置为空值

  "backupDir": "./wecos_backup"

如果想要删除文件,但是不进行备份(例如是删除dist目录里的某些文件),可以设置为:Delete but do not backup

"backupDir": "Delete but do not backup"

设置图片后缀

有些时候,我们需要限制上传图片的格式,例如只允许jpg格式,可以通过WeCOS提供的图片后缀配置项来定义

WeCOS默认支持jpg,png,gif三种格式,假如你还需要添加其他格式,例如webp,可以在该配置项中添加

  "uploadFileSuffix": [".jpg",".png",".gif",".webp"]

设置图片黑名单

开发过程中,某些特定的图片我们不希望被上传,可以通过WeCOS的黑名单配置来解决这个问题,配置后上传程序会自动忽略掉这些图片

黑名单配置支持目录或具体到文件名的写法

  "uploadFileBlackList": ["./images/logo.png","./logo/"]

设置实时监听

WeCOS默认实时监听项目目录变化,自动处理图片资源,在开发过程中,如果觉得实时监听不方便,或者只需要一次性处理就停止,可以修改该配置,程序将只会执行一次后退出

  "watch": false