Giter Site home page Giter Site logo

hsuc's Introduction

语言

中文

describe

Upload the files generated by web pack to the cloud to improve the loading speed
Currently, Alibaba cloud, Huawei cloud, Tencent cloud, qiniu cloud and remake cloud, as well as user-defined extensions are supported.

install

npm install hsuc --save-dev

required

Node

Node.js >= 10.10.0 required

use

webpack.config.js

// webpack.config.js
const Hsuc = require('hsuc');

...
plugins: [
    ...
    new Hsuc({
        cloudFolder: "<Cloud folder>",
        domain: "<domain name>",
        enable: true,
        // Alicloud (Choose one)
        aliyun: {
            region: "<OSS region>",
            accessKeyId: "<Your accessKeyId>",
            accessKeySecret: "<Your accessKeySecret>",
            bucket: "<Your bucket name>"
        }
        // Hua Weiyun (Choose one)
        huawei: {
            accessKeyId: "<Provide your Access Key>",
            secretAccessKey: "<Provide your Secret Key>",
            server: "<https://your-endpoint>",
            bucket: "<Bucket>"
        },
        // Tencent cloud (Choose one)
        tencent: {
            secretId: "<SecretId>",
            secretKey: "<SecretKey>",
            bucket: "<Bucket>",
            region: "<Region>"
        },
        // Qiniu cloud (Choose one)
        qiniu: {
            accessKey: "<ACCESS_KEY>",
            secretKey: "<SECRET_KEY>",
            bucket: "<Bucket>"
        },
        // Clapping clouds again (Choose one)
        upyun: {
            serviceName: "<service name>",
            operatorName: "<operator name>",
            operatorPassword: "<operator password>",
        }
    })
]

hsuc(options) supported options

  • aliyun - Initialize alicloud OSS parameters
  • huawei - Initialize Huawei cloud OBS parameters.
  • tencent - Initialize Tencent cloud cos parameters.
  • qiniu - Initialize the Qiniu cloud parameter.
  • upyun - Initialize the re shooting cloud parameter.
  • enable[boolean] - Enable at the beginning, defaulttrue
  • removePrevVersion[boolean] - Delete previous versions of cloud or not, defaultfalse
  • log[boolean] - Display log, defaulttrue
  • cover[boolean|RegExp] - Overwrite file, defaultfalse. Please refer to/\.(png|jpe?g|gif|ico|woff2?|svg|ttf|eot)$/
  • custom[js文件,例如require("./template.js")] - User defined upload file, you can refer to the template.js in the project

Object store CORS rule settings

  • aliyun Set according to CORS
  • huawei Set according to CORS
  • tencent Set according to CORS
  • qiniu Set according to CORS
  • upyun Set according to CORS

matters needing attention

  • Please set the cloud access to "public read / write" or "public read"
  • In the options parameter, aliyun, huawei, tencent, qiniu and upyun are configured at the same time, only the first one is valid
  • The plug-in is disabled in development mode
  • options.deletePrevBuildFile Enabling this item will delete the previous version. Please be careful.

deploy

webpack
// Deploy the index.html file under the package folder to the server, and you can access

hsuc's People

Contributors

kszitt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.