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

@gdyfe/webpack-alioss-plugin

v0.1.6

Published

A webpack plugin to upload assets to aliyun oss

Downloads

14

Readme

webpack-alioss-plugin

A webpack plugin to upload assets to aliyun oss

安装

npm i @gdyfe/webpack-alioss-plugin --save
yarn add @gdyfe/webpack-alioss-plugin -D

参数

| 选项名 | 类型 | 是否必填 | 默认值 | 描述 | | :-------------- | :------------------- | :------- | :----- | :----------------------------------------------------------------------------------------------------------------------------------- | | accessKeyId | String | √ | | 阿里云accessKeyId | | accessKeySecret | String | √ | | 阿里云accessKeySecret | | region | String | √ | | 阿里云region | | bucket | String | √ | | 阿里云bucket | | prefix | String | √ | | 自定义路径前缀,通常使用项目目录名,文件将存放在alioss的bucket/prefix目录下 | | format | Number | × | getFormat('YYMMDD') | 可用时间戳来生成oss目录版本号,每次会保留最近的版本文件做零宕机发布,删除其他版本文件。可以通过插件自身提供的静态方法getFormat()获得,默认值为年月日 | | limit | Number | × | 5 | 最多备份版本数量,会备份最近的版本,最小是3。配置了format才会生效 | | deleteAll | Boolean | × | false | 是否删除bucket/prefix中所有文件。优先匹配format配置 | | local | Boolean | × | true | 默认每次上传webpack构建流中文件,设为true可上传打包后webpack output指向目录里的文件 | | output | String | × | '' | 读取本地目录的路径,如果local为true,output为空,默认为读取webpack输出目录 | | exclude | ExpReg/Array | × | [/.*.html$/] | 可传入正则,或正则组成的数组,来排除上传的文件 |

使用

  • 实例传参
const WebpackAliOSSPlugin = require('@gdyfe/webpack-alioss-plugin')

new WebpackAliOSSPlugin({
  accessKeyId: '2****************9',
  accessKeySecret: 'z**************=',
  region: 'oss-cn-hangzhou',
  bucket: 'xxx',
  prefix: 'test',  
})
  • 配置文件

const WebpackAliOSSPlugin = require('@gdyfe/webpack-alioss-plugin')
const format = WebpackAliOSSPlugin.getFormat('YYYYMMDD') // 默认为getFormat('YYMMDD')
new WebpackAliOSSPlugin({
  format
})

// oss.config.json
{
  accessKeyId: '2****************9',
  accessKeySecret: 'z**************=',
  region: 'oss-cn-hangzhou',
  bucket: 'xxx',
  prefix: 'test',  
}