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

aliyunoss-webpack-plugin

v0.2.1

Published

when build ,it can auto update static resources to aliyun oss

Downloads

677

Readme

##aliyunoss-webpack-plugin webpack的插件,用于自动上传静态资源到阿里的oss上,以便作为静态资源使用,当然你也可以用于自动存储大文件。

Installation

Install the plugin with npm:

$ npm install aliyunoss-webpack-plugin --save-dev

Basic Usage

add the plugin to your webpack config as follows:

var AliyunossWebpackPlugin = require('aliyunoss-webpack-plugin')
var webpackConfig = {
  entry: 'index.js',
  output: {
    path: 'dist',
    filename: 'index_bundle.js'
  },
  plugins: [new AliyunossWebpackPlugin({
    buildPath:'your build path',
    region: 'your region',
    accessKeyId: 'your key',
    accessKeySecret: 'your secret',
    bucket: 'your bucket',
    getObjectHeaders: function(filename) {
      return {
        Expires: 6000
      }
    }
  })]
}

don't depend webpack,just as follows:

var AliyunossWebpackPlugin = require('aliyunoss-webpack-plugin')
var oss = new AliyunossWebpackPlugin({
  buildPath:'your build path',
  region: 'your region',
  accessKeyId: 'your key',
  accessKeySecret: 'your secret',
  bucket: 'your bucket',
  deleteAll: true,
  generateObjectPath: function(filename) {
    return filename
  },
  getObjectHeaders: function(filename) {
    return {
      Expires: 6000
    }
  }
});
oss.apply()

Configuration

The plugin allowed values are as follows:

  • buildPath: 需要上传的文件路径,支持整个文件夹的遍历。支持node-glob风格路径,具体可以参见node-glob的文档
  • region: oss的区域,如:oss-cn-shanghai。
  • accessKeyId: 阿里云的权限访问的key。
  • accessKeySecret: 阿里云的权限访问的secret。
  • bucket: 阿里云OSS上的命名空间。
  • deleteAll: 先删除oss上的代码之后再上传,默认为false
  • generateObjectPath: 函数(可选),函数参数为上传的文件名,必须返回一个字符串作为文件名,默认为文件原名。通过该函数可以让使用者自定义上传的文件名或者修改oss的路径,比如加一个前缀等
  • getObjectHeaders: 函数(可选),函数参数为上传的文件名,返回设置的headers对象,默认为空,具体可以参见ali-oss的文档
  • internal: 使用内网还是外网(可选),默认外网