nbugs-ship-cdn
nbugs tool to ship web assets to the CDN mirror server
Last updated 4 years ago by colorhook .
Original npm · Tarball · package.json
$ cnpm install nbugs-ship-cdn 
SYNC missed versions from official npm registry.

nbugs-ship-cdn

ship web assets to the CDN mirror server

Usage

建议 nbugs-ship-cdn 用于与 package.json 文件相同目录下执行,因为它会读出 package.json 文件的 nameversion 作为参数。

将单个文件发布到 CDN 源站:

nbugs-ship-cdn public/index.js

将多个文件发布到 CDN 源站:

nbugs-ship-cdn "public/**"

手动设置参数:

nbugs-ship-cdn "**/*" --name nbugs --version 1.0.0 --force

通过 node 模块编写自定义脚本:

const shipCDN = require('nbugs-ship-cdn');

// 设置发布选项
const options = {
  // 服务端接口地址
  url: "http://cdn.xiaoyuanhao.com",
  // 项目名称
  name: "nbugs",
  // 项目版本
  version: "1.0.0",
  // 用于签名验证,可以是任意字符串
  key: "use to sign", // any thing
  // 是否可以覆盖
  force: false, // overwrite flag
  // 单个文件发送前的回调函数
  itemBeforeShip: () => {},
  // 单个文件的发布回调函数
  itemCallback: () => {}
}

// ship 单个文件
shipCDN(__dirname + '/index.js', options);

// 使用数组 ship 多个文件
shipCDN([__dirname + '/index.js', __dirname + '/index.css'], options);

// 使用 glob 语法 ship 多文件
shipCDN.ship(__dirname + '/**', options);

// ship 回调
shipCDN.ship(file, options, (err, result) => {
});

Current Tags

  • 1.6.0                                ...           latest (4 years ago)

9 Versions

  • 1.6.0                                ...           4 years ago
  • 1.5.0                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (4)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |