Skip to content

Commit d22a591

Browse files
wangxiaoleeyeh
authored andcommitted
Add gulp upload error tips (#294)
* Add gulp upload error tips * ESlint add no-console: trace * console.trace -> throw error
1 parent e156b86 commit d22a591

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
'consistent-return': 0,
77
'no-else-return': 0,
88
'max-len': 0,
9-
'no-console': [ 2, { allow: ['warn'] } ],
9+
'no-console': [ 2, { allow: ['warn', 'trace'] } ],
1010
'no-restricted-syntax': [ 0, 'ForInStatement' ],
1111
'no-new': 0,
1212
}

gulpfile.babel.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const getAVVersion = () => {
3434
const uploadCDN = (file, version, cb) => {
3535
qiniu.conf.ACCESS_KEY = process.env.CDN_QINIU_KEY;
3636
qiniu.conf.SECRET_KEY = process.env.CDN_QINIU_SECRET;
37+
if (!qiniu.conf.ACCESS_KEY || !qiniu.conf.SECRET_KEY) {
38+
throw new Error('Need Qiniu CDN_QINIU_KEY and CDN_QINIU_SECRET');
39+
}
3740
const bucketname = 'paas_files';
3841
const key = 'static/js/' + path.basename(file, '.js') + '-' + version + '.js';
3942
const putPolicy = new qiniu.rs.PutPolicy(bucketname + ':' + key);
@@ -201,7 +204,7 @@ gulp.task('test', [
201204
});
202205

203206
// 上传到 CDN
204-
gulp.task('upload', ['compress-scripts'], (cb) => {
207+
gulp.task('upload', () => {
205208
uploadCDN('./dist/av-min.js', getAVVersion(), () => {});
206209
});
207210

0 commit comments

Comments
 (0)