Giter Club home page Giter Club logo

aliyun-oss-deploy's Introduction

aliyun-oss-deploy

一个用于部署静态资源到 aliyun oss 的模块,支持 putObject 和 putStream。可以代码方式或者 cli 方式调用!

npm npm

image

Install

npm i --save-dev aliyun-oss-deploy

Usage

  • 代码方式
const deploy = require('aliyun-oss-deploy');

deploy(path, ossConfig[, prefix, byStream]);

注意:prefix 用来配置资源版本号比较合适,默认为空;byStream 默认为 false,表示使用 putObject 方法!

  • CLI 方式
aliyun-oss-deploy -p ./dist -c .aliossrc -d static

帮助文档:

aliyun-oss-deploy --help
Options:
  --version        Show version number           [boolean]
  -p, --filePath   Set your upload files path     [string]
  -d, --prefix     Set the target dir of upload   [string]
  -c, --aliossrc   Set your .aliossrc file path   [string]
  -s, --useStream  Upload file by putStream      [boolean]
  --help           Show help                     [boolean]

可以在 package.json 中直接使用

{
  "script": {
    "deploy": "aliyun-oss-deploy -p ./dist"
  }
}

Config

无论是代码方式还是 cli 方式,aliyun oss 配置文件都是下面的数据结构!

需要注意的是:对于 CLI 方法,配置文件必须是 JSON 格式(双引号)!

{
  "accessKeyId": "your accessKeyId",
  "accessKeySecret": "your accessKeySecret",
  "region": "your region",
  "bucket": "your bucket"
}

注意region 是区分 endpoint 的区域分类。

License

ISC@hustcc.

aliyun-oss-deploy's People

Contributors

hustcc avatar

Watchers

 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.