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

@puhaha/vite-plugin-upload-oss

v1.2.1

Published

上传静态资源七牛云、aws的vite插件

Downloads

28

Readme

vite-plugin-upload

实现上传静态资源至七牛云和aws的vite插件,可重复刷新上传和增量更新

特性

  • 支持七牛云
  • 支持亚马逊S3

使用

安装

npm i @puhaha/vite-plugin-upload-oss -D

# 七牛云sdk安装
npm i qiniu -D

配置

公用参数

| 参数 | 说明 | 类型 | 默认值 | | -------------- | ---------------------------- | -------- | ----------- | | sdk | 必填,各平台提供的sdk | object | | | sdkName | uploadPlugin插件使用,其他没必要 | String | | | accessKey | 必填 | String | | | secretKey | 必填 | String | | | bucket | 必填 | String | | | remoteFilePath | 非必填,表示服务器远程路径 | string | | | filePath | 必填,本地文件夹路径 | string | | | openConfirm | 非必填,是否打开上传前的提示 | boolean | true | | success | 非必填,上传成功回调 | Function | files => {} | | error | 非必填,上传失败回调 | Function | files => {} | | publicCdnPath | 必填,cdn基础地址 | string | | | enabledRefresh | 非必填,是否刷新文件 | boolean | true | | uploadTarget | 必填,打包生成的目录地址 | sting | 无默认值,需手动填写path.resolve(__dirname, './dist') | | appName | 必填 | string | 项目名称 | | fileLogPath | 非必填,日志生成的目录地址 | sting | log/ | | env | 非必填,打包的环境 | sting | development | | suffix | 非必填,日志版本号 | string | 空 | | deleteOldFiles | 非必填,本地dist目录是否删除已经上传的老文件 | boolean | true | | excludeHtml | 非必填,是否排除html文件上传 | boolean | false | | htmlPath | 非必填,html上传打的路径 | string | 空 | | awsDistributionId | 刷新aws上的资源的失效id | string | | | deleteEmptyFiles | 是否删除空的js文件 | boolean | false |

七牛云

// vite.config.[t|j]s
import qiniu from 'qiniu'
import {qiniuPlugin} from '@puhaha/vite-plugin-upload-oss'
export default ({ command, mode }: ConfigEnv): UserConfig => {
  const isBuild = command === 'build';

  return {
    plugins: [
      isBuild && qiniuPlugin({
        sdk: qiniu
        accessKey: 'xxx',
        secretKey: 'xxx',
        bucket: 'xxx',
        filePath: 'xxx',
        remoteFilePath: '',
        openConfirm: true,
        publicCdnPath: 'http://xxx.xxx.com/',
        enabledRefresh: true
      })                
    ]
  }
}

日志

  • [x] 2022.04.21 支持七牛云
  • [x] 2022.10.11 支持增量更新上传,只上传项目中修改过的文件
  • [x] 2022.10.17 支持增量更新上传,删除本地已经上传过的文件
  • [x] 2023.02.01 支持aws上传以及刷新
  • [x] 2024.07.05 去除map文件上传

感谢