Commit e3b3b8e3 authored by wildfirecode's avatar wildfirecode

1

parent 71a3d835
......@@ -13,6 +13,8 @@ const OSS = require('ali-oss');
const chalk = require('chalk');
const ProgressBar = require('progress');
const BUILD_TYPE_argv = process.argv[2];
const BUILD_TYPE = BUILD_TYPE_argv.split('=')[1];
class TuiaAutoUpload {
constructor(props) {
const defaultOptions = {
......@@ -32,7 +34,7 @@ class TuiaAutoUpload {
region: 'oss-cn-hangzhou',
accessKeyId: 'LTAIdGi1IOap7fkF',
accessKeySecret: 'SKrOOp6EVtDGEV47yn0t2h97gyNioQ',
bucket: process.env.BUILD_TYPE === 'production' ? 'duiba' : 'daily-duiba'
bucket: BUILD_TYPE === 'production' ? 'duiba' : 'daily-duiba'
});
this.bar = new ProgressBar(chalk.yellow(` 文件上传中 [:bar] :current/${this.files().length} :percent :elapseds`), {
complete: '●',
......@@ -67,14 +69,14 @@ class TuiaAutoUpload {
} catch (error) {
originFile = error;
}
if (process.env.BUILD_TYPE === 'production') {
if (BUILD_TYPE === 'production') {
if (originFile.status === 404) {
yield _this.client.put(originPath, path);
_this.uploadFiles += 1;
} else {
_this.existFiles += 1;
}
} else if (process.env.BUILD_TYPE === 'development') {
} else if (BUILD_TYPE === 'development') {
if (originFile.status === 404 || originFile.status === 200) {
_this.existFiles += 1;
}
......
{
"name": "tuia-auto-upload",
"version": "1.1.1",
"version": "1.1.3",
"description": "推啊系统后台自动上传工具",
"main": "index.js",
"scripts": {
......@@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "git@gitlab2.dui88.com:frontend/autoupload.git"
"url": "git@gitlab2.dui88.com:wanghongyuan/duiba-autoupload.git"
},
"author": "zc@duiba.com.cn",
"license": "ISC",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment