加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
publish.js 883 Bytes
一键复制 编辑 原始数据 按行查看 历史
罗章 提交于 2018-07-10 16:37 . Lz async await (#500)
const { env } = process;
const oss = require('.');
const pkg = require('./package.json');
const check = require('./publish-check');
const store = oss({
accessKeyId: env.ALI_SDK_OSS_CDN_ID,
accessKeySecret: env.ALI_SDK_OSS_CDN_SECRET,
endpoint: env.ALI_SDK_OSS_CDN_ENDPOINT,
bucket: env.ALI_SDK_OSS_CDN_BUCKET,
});
const current = `aliyun-oss-sdk-${pkg.version}.min.js`;
const dist = './dist/aliyun-oss-sdk.min.js';
async function checkFile() {
try {
check.checkDist(dist); // check file exist
const contentMd5 = await check.caculateFileMd5(dist); // check md5 to server
await store.put(current, dist, {
headers: {
'Content-Md5': contentMd5,
},
});
await check.checkCDNFile(current, store);// check cdn file
console.log(`publish CDN success, version is ${pkg.version}`);
} catch (e) {
console.log(e);
}
}
checkFile();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化