gulpfile.js 774 Bytes
'use strict';

const path = require('path');

const gulp = require('gulp');
const qiniu = require('gulp-qiniu');


gulp.task('upQiniu', () => {
    let args = process.argv.slice(3);

    let name = args[0].replace('--name=', '');
    let time = args[1].replace('--time=', '');
    let pkg = args[2].replace('--pkg=', '');

    if (!name || !time || !pkg) {
        return;
    }

    // 找到对应项目对应的版本的静态资源上传至七牛cdn
    gulp.src(path.join(__dirname, `../../packages/${name}/${time}/${pkg}/**`)).pipe(
        qiniu({
            accessKey: 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE',
            secretKey: 'RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG',
            bucket: 'yohocdn'
        }, {
            dir: pkg
        })
    );
});