Coder Social home page Coder Social logo

alioss-cli's Introduction

alioss-cli

快速上传文件至阿里云对象存储服务

安装

npm i -g @yelo/alioss-cli

如何使用

  1. 为项目新建文件 .aliossrc,配置内容参考下一章节。

  2. 进入项目目录,执行上传操作

      alioss

配置文件

配置文件的存放规则可以参考 rc standards,文件名为 .aliossrc

建议在 $HOME/.aliossrc 存放敏感配置,如 accessKeyId、accessKeySecret、bucket、region;在项目内 ./.aliossrc 存放项目相关的配置,如 prefix, cwd, patterns。

配置项

必选配置项

accessKeyId

oss 的 accessKeyId。

accessKeySecret

oss 的 accessKeySecret。

prefix

上传至 oss 的目录前缀。如 /myproject/static/

cwd

上传文件的根路径。如 build/static

patterns

上传文件的匹配格式,使用 glob 语法。如全部文件 **/*

可选配置项

ali-oss 相同的可选参数:

  • stsToken
  • bucket
  • endpoint
  • region
  • internal
  • secure
  • timeout

示例

完整的配置文件如下:

{
  "accessKeyId": "...",
  "accessKeySecret": "...",
  "bucket": "mybucket",
  "region": "oss-cn-hangzhou",
  "prefix": "/myproject/static/",
  "cwd": "build/static/",
  "patterns": "**/*"
}

最佳实践

文件结构:

    - ~
      - .aliossrc # 存放 oss 敏感信息,即 accessKeyId, accessKeySecret, bucket, region
      - ...
    - projects
      - myproject # 项目根目录
        - .aliossrc # 存放 prefix, cwd, patterns
        - ...

在每次发布过程中,待静态文件编译完成后,进入项目根目录执行 alioss

EOF

alioss-cli's People

Contributors

dependabot[bot] avatar imyelo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.