Skip to content

Commit 3810ef9

Browse files
committed
Print CDN url after uploading the file.
1 parent 1f7f0b1 commit 3810ef9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gulpfile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ function uploadCDN(file, version) {
7676
qiniu.conf.ACCESS_KEY = process.env['CDN_QINIU_KEY']
7777
qiniu.conf.SECRET_KEY = process.env['CDN_QINIU_SECRET']
7878
var bucketname = 'paas_files';
79-
var putPolicy = new qiniu.rs.PutPolicy(bucketname);
80-
var uptoken = putPolicy.token();
8179
var key = 'static/js/' + path.basename(file, '.js') + '-' +
8280
version + '.js';
81+
82+
var putPolicy = new qiniu.rs.PutPolicy(bucketname + ':' + key);
83+
var uptoken = putPolicy.token();
8384
var extra = new qiniu.io.PutExtra();
8485
extra.mimeType = 'application/javascript';
8586
var buffer = fs.readFileSync(file);
8687
qiniu.io.put(uptoken, key, buffer, extra, function(err, ret) {
8788
if (!err) {
88-
console.log(ret.key, ret.hash);
89+
console.log('https://cdn1.lncld.net/' + ret.key);
8990
} else {
9091
console.log(err)
9192
}
@@ -156,6 +157,7 @@ gulp.task('clean', function() {
156157

157158
gulp.task('upload', function() {
158159
uploadCDN('./dist/av-mini.js', getAVVersion());
160+
uploadCDN('./dist/av-core-mini.js', getAVVersion());
159161
});
160162

161163

0 commit comments

Comments
 (0)