# webpack-plugin-qiniu-upload

> Vue3,webpack-plugin-qiniu-upload for qiniu(七牛)|aws(亚马逊) cloud upload. support @vue/cli-service 5.0.x

Latest version **2.0.7** (published 2024-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-plugin-qiniu-upload
pnpm add webpack-plugin-qiniu-upload
yarn add webpack-plugin-qiniu-upload
bun add webpack-plugin-qiniu-upload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2024-03-06 |
| First published | 2022-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 27.2 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | cduyzh |
| Maintainers | cduyzh |
| Keywords | vue3, vue-cli-plugin, webpack, plugin, qiniu, aws, @vue/cli-service, upload |

## Links

- npm: https://www.npmjs.com/package/webpack-plugin-qiniu-upload
- Repository: https://github.com/cduyzh/webpack-plugin-qiniu-upload
- Homepage: https://github.com/cduyzh/webpack-plugin-qiniu-upload#readme
- Issues: https://github.com/cduyzh/webpack-plugin-qiniu-upload/issues
- npm.io page: https://npm.io/package/webpack-plugin-qiniu-upload

## Dependencies (7)

- [mime](https://npm.io/package/mime.md) ^3.0.0
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [qiniu](https://npm.io/package/qiniu.md) ^7.6.0
- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1286.0
- [hidefile](https://npm.io/package/hidefile.md) ^3.0.0
- [util.promisify](https://npm.io/package/util.promisify.md) ^1.1.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.7 (latest) — 2024-03-06
- 2.0.6 — 2023-05-30
- 2.0.5 — 2023-02-14
- 2.0.4 — 2022-06-30
- 2.0.3 — 2022-06-20
- 2.0.2 — 2022-05-20
- 2.0.1 — 2022-05-20
- 2.0.0 — 2022-05-19
- 1.0.4 — 2022-05-17
- 1.0.3 — 2022-05-17
- 1.0.2 — 2022-04-27
- 1.0.1 — 2022-04-27
- 1.0.0 — 2022-04-27

## README

<div align="center">
  <a href="https://cli.vuejs.org/">
    <img width="200" height="200"
      src="https://cli.vuejs.org/favicon.png">
  </a>
  <h1>Upload To qiniu cloud  webpack|vue-cli-Plugin</h1>
  <h1>Qiniu Cloud scaffolding package upload plug-in package，webpack5，vue-cli4|vue-cli5 plugin</h1>
  <p>A plugin upload file to qiniu clound for vue-cli4|vue-cli5</p>

<p align="center">
    <img src="https://img.shields.io/npm/v/webpack-plugin-qiniu-upload?style=flat-square" alt="npm version" />
    <img src="https://img.shields.io/npm/dm/webpack-plugin-qiniu-upload.svg?style=flat-square&color=#4fc08d" alt="downloads" />
</p>
</div>
<h2 align="center">Features</h2>

☁️ Support the latest SDK Qiniu Cloud upload, adapted to the latest VUE scaffolding CLI4.0 and 5.0 versions

💪 Suitable for the latest vue scaffolding cli4.0 and 5.0 versions, support webpack5 configuration

💪 Webpack5 configuration is supported

🚀 Incremental file upload is supported, eliminating the annoyance and waiting time of repeatedly uploading and refreshing files for all resources

<h2 align="center">Install</h2>

```bash
  pnpm add webpack-plugin-qiniu-upload -D
```

```bash
  yarn add webpack-plugin-qiniu-upload -D
```

<h2 align="center">Use the sample</h2>

**vue.config.js**

```js
const UploadQiNiuPlugin = require("webpack-plugin-thirdparty-upload");
const isBuildDev = process.env.buildMode === 'dev'

module.exports = {
  ...,
  plugins: [
    uploadPlugin({
        sdkName: isBuildDev ? 'qiniu' : 'aws',
        accessKey: isBuildDev ? process.env.QN_ACCESS_KEY : process.env.AWS_ACCESS_KEY,
        secretKey: isBuildDev ? process.env.QN_SECRET_KEY : process.env.AWS_SECRET_KEY,
        bucket: isBuildDev ? process.env.QN_BUCKET : process.env.AWS_BUCKET,
        region: isBuildDev ? 'Zone_z2' : 'us-east-1',
        awsDistributionId: 'xxxx', // aws的失效id
        enabledRefresh: true,
        publicPath: process.env.logBaseUrl,
        uploadTarget: path.resolve(__dirname, './dist'),
        appName: webpackEntry.EntryConfigs[argv.e].filename.replaceAll('.html', ''),
        fileLogPath: 'log/',
        env: isBuildDev ? 'development' : 'production',
        htmlPath: htmlPath, // html 存到云的路径
        excludeHtml: false, // 是否排除html文件
        // suffix: '-v1'
    })
  ],
};
```

<h2 align="center">Options</h2>

### qiniu cloud Options

|            Name            |    Type     |                                             Default                                              | Description                                                                                             |
| :------------------------: | :---------: | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------ |
| **[`qiniuAccessKey`](#)**  | `{String}`  |                                              `null`                                              | Your Qiniu AccessKey                                                                                    |
| **[`qiniuSecretKey`](#)**  | `{String}`  |                                              `null`                                              | Your Qiniu SecretKey                                                                                    |
|   **[`qiniuBucket`](#)**   | `{String}`  |                                              `null`                                              | Your Qiniu Bucket Name                                                                                  |
|    **[`qiniuZone`](#)**    | `{String}`  |                                              `null`                                              | Your Qiniu zone code                                                                                    |
| **[`enabledRefresh`](#)**  | `{Boolean}` |                                             `false`                                              | Is enable refresh the file on Qiniu Clound after file upload                                            |
|   **[`excludeHtml`](#)**   | `{Boolean}` |                                              `true`                                              | Is exclude html file                                                                                    |
| **[`onlyRefreshHtml`](#)** | `{Boolean}` |                                             `false`                                              | only refresh html file (eg: _/demo/index.html + _/demo/), throws an exception in the case of a failure. |
|   **[`prefixPath`](#)**    | `{String}`  |                                                -                                                 | prefix path for the file                                                                                |
|   **[`fileLogPath`](#)**   | `{String}`  |                                              `log/`                                              | Provide a directory where log file should be stored                                                     |
|   **[`publicPath`](#)**    | `{String}`  | [webpackConfig.output.publicPath](https://webpack.js.org/configuration/output/#outputpublicpath) | The prefix path to your packaged resource                                                               |
|  **[`uploadTarget`](#)**   | `{String}`  |      [webpackConfig.output.path](https://webpack.js.org/configuration/output/#output-path)       | Directory of the folder to be uploaded                                                                  |
|     **[`appName`](#)**     | `{Number}`  |                                           `Date.now()`                                           | Optional. Name of the file used to generate resource mapping file logs                                  |
|       **[`env`](#)**       | `{String}`  |                                          `development`                                           | The environment directory corresponding to the JSON file of log                                         |

About [qiniuZone](https://developer.qiniu.com/kodo/sdk/1289/nodejs):

## TODO LIST

- [x] Supports incremental update file upload
- [x] Supports environment With log json file
- [ ] Support log file cleaning or pull range filtering

---
_Source: https://npm.io/package/webpack-plugin-qiniu-upload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
