diff --git a/package.json b/package.json index 00a78dc..af3ec70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "publish-helper", - "version": "1.2.0", + "version": "1.2.1", "description": "", "main": "index.js", "scripts": { diff --git a/src/uploader.js b/src/uploader.js index d00a250..169c889 100644 --- a/src/uploader.js +++ b/src/uploader.js @@ -91,8 +91,19 @@ function selector(done){ if(self.mapfile.static.length==0){ return resolve(); } + var tempArr = []; + + tempArr = self.mapfile.static.sort(function(a,b){ + if(a.length < b.length){ + return 1; + }else{ + return -1; + } + }) + + console.log(tempArr) - self.mapfile.static.forEach((item, index)=>{ + tempArr.forEach((item, index)=>{ let tempUrl = self.mapfile._[item].url; upload(tempUrl, item, self, (err, data)=>{ self.mapfile.staticCount--; diff --git a/test/go.js b/test/go.js index 86cc547..bca0b87 100644 --- a/test/go.js +++ b/test/go.js @@ -29,12 +29,12 @@ var stripJsonComments = require('strip-json-comments'); new publisher({ - src:path.resolve(__dirname, './demo1/*.html'), - dist: path.resolve(__dirname, './demo1/build'), + src:path.resolve(__dirname, '../../active-maker/dist/*.html'), + dist: path.resolve(__dirname, '../../active-maker/output'), iwantcdn:false, uploadUrl: "XXXX",// 上传文件 ajax 路径,必填 hostname:function(type, data){ - return 'http://cdn.inyuapp.com/'; + return 'http://cdn.inyuapp.com'; }, sourceMappingURL:false, chunk: false,