cobola / cdn-cli

对象存储部署前端项目,支持阿里云/腾讯云/七牛云

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

对象存储部署前端项目,支持阿里云/腾讯云/七牛云

npm package

1. 安装依赖包
npm install cdn-cli -g
2. 初始化项目
cdn init aliyun # 阿里云
cdn init tencent # 腾讯云
cdn init qiniu # 七牛云
3. 配置

deploy-config/config.json

{
  "type": "aliyun",
  "deploy": {
    "directories": [
      {
        "from": "./dist",
        "to": "."
      },
      "./static"
    ],
    "files": [
      {
        "from": "./product.html",
        "to": "./item.html"
      },
      "./login.html"
    ]
  },
  "noCache": {
    "fileSuffix": [
      "html"
    ],
    "fileName": [
      "service-worker.js"
    ]
  },
  "lastUpload": {
    "fileSuffix": [
      "html"
    ],
    "fileName": []
  },
  "ignore": {
    "fileSuffix": [
      "map"
    ],
    "fileName": []
  }
}
  1. 将代码部署到阿里云
  2. ./dist 目录里面的文件放到 . 目录下,将 ./static 里面的文件放到 ./static 目录下
  3. 上传 ./product.html./item.html,上传 ./login.html./login.html
  4. 不缓存后缀名为 html 的文件,不缓存 service-worker.js 文件;后缀名为 html 的文件最后上传
  5. 忽略后缀名为 map 的文件

阿里云 deplot-config/aliyun/

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

腾讯云 deplot-config/tencent/

{
  "region": "",
  "bucket": "",
  "appId": "",
  "secretId": "",
  "secretKey": ""
}

七牛云配置 deplot-config/qiniu/

{
  "region": "",
  "bucket": "",
  "accessKey": "",
  "secretKey": ""
}
4. 发布项目
cdn deploy production
cdn deploy test
cdn deploy development
...

注:可以自定义

5. 不将 config 文件提交到 git

在项目下添加 .gitignore 文件,然后在 .gitignore 文件中添加下面内容

deploy-config/aliyun/
deploy-config/tencent/
deploy-config/qiniu/

About

对象存储部署前端项目,支持阿里云/腾讯云/七牛云


Languages

Language:JavaScript 100.0%