Skip to content

Commit c2c27d1

Browse files
committed
Merge pull request #231 from wangxiao/master
修正构建后的文件名
2 parents bfa4382 + c603108 commit c2c27d1

File tree

12 files changed

+55
-42
lines changed

12 files changed

+55
-42
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ JavaScript SDK for [LeanCloud](http://leancloud.cn/).
2626
├── changelog.md
2727
├── dist // 编译之后生成的文件将会在此目录下
2828
│ ├── av-es6.js // 合并后的完整源码(ES6 版本)
29-
│ ├── av-es5.js // 合并并编译后的完整源码(ES5 版本)
30-
│ ├── av-mini.js // 合并、压缩并编译后的源码(ES5 版本)
29+
│ ├── av.js // 合并并编译后的完整源码(ES5 版本)
30+
│ ├── av-min.js // 合并、压缩并编译后的源码(ES5 版本)
3131
│ ├── node // 目录中为生成的 nodejs 版本代码
3232
│ └── ...
3333
├── gulpfile.js

dist/av-es6.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,30 +9721,35 @@ module.exports = function(AV) {
97219721
};
97229722

97239723
/**
9724-
* Call this method first to set up your authentication tokens for LC.
9725-
* You can get your keys from the Data Browser on http://leancloud.cn .
9726-
* @param {Object} incloud appId, appKey, masterKey
9727-
*/
9724+
* Call this method first to set up your authentication tokens for AV.
9725+
* You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
9726+
* @function AV.init
9727+
* @param args initialize options.
9728+
* @param args.appId application id
9729+
* @param args.appKey application key
9730+
* @param args.masterKey application master key
9731+
*/
97289732

9729-
AV.init = (...options) => {
9730-
switch (options.length) {
9733+
AV.init = (...args) => {
9734+
switch (args.length) {
97319735
case 1:
9736+
const options = args[0];
97329737
if (typeof options === 'object') {
97339738
if (!AV._config.isNode && options.masterKey) {
97349739
throw new Error('AV.init(): Master Key is only used in Node.js.');
97359740
}
9736-
initialize(options[0].appId, options[0].appKey, options[0].masterKey);
9741+
initialize(options.appId, options.appKey, options.masterKey);
97379742
} else {
97389743
throw new Error('AV.init(): Parameter is not correct.');
97399744
}
97409745
break;
97419746
// 兼容旧版本的初始化方法
97429747
case 2:
97439748
case 3:
9744-
if (!AV._config.isNode && options.length === 3) {
9749+
if (!AV._config.isNode && args.length === 3) {
97459750
throw new Error('AV.init(): Master Key is only used in Node.js.');
97469751
}
9747-
initialize(...options);
9752+
initialize(...args);
97489753
break;
97499754
}
97509755
};
@@ -9769,6 +9774,7 @@ module.exports = function(AV) {
97699774

97709775
/**
97719776
* Call this method to set production environment variable.
9777+
* @function AV.setProduction
97729778
* @param {Boolean} production True is production environment,and
97739779
* it's true by default.
97749780
*/

dist/av-mini.js renamed to dist/av-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/av-es5.js renamed to dist/av.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,11 +2834,15 @@ child.__super__=parent.prototype;return child;}; /**
28342834
* @param {String} applicationId Your AV Application ID.
28352835
* @param {String} applicationKey Your AV Application Key
28362836
*/var initialize=function initialize(applicationId,applicationKey,masterKey){if(AV.applicationId!==undefined&&applicationId!==AV.applicationId&&applicationKey!==AV.applicationKey&&masterKey!==AV.masterKey){console.warn('AVOSCloud SDK is already initialized, please don\'t reinitialize it.');}AV.applicationId=applicationId;AV.applicationKey=applicationKey;AV.masterKey=masterKey;AV._useMasterKey=false;}; /**
2837-
* Call this method first to set up your authentication tokens for LC.
2838-
* You can get your keys from the Data Browser on http://leancloud.cn .
2839-
* @param {Object} incloud appId, appKey, masterKey
2840-
*/AV.init=function(){for(var _len=arguments.length,options=Array(_len),_key=0;_key<_len;_key++){options[_key]=arguments[_key];}switch(options.length){case 1:if((typeof options==="undefined"?"undefined":_typeof(options))==='object'){if(!AV._config.isNode&&options.masterKey){throw new Error('AV.init(): Master Key is only used in Node.js.');}initialize(options[0].appId,options[0].appKey,options[0].masterKey);}else {throw new Error('AV.init(): Parameter is not correct.');}break; // 兼容旧版本的初始化方法
2841-
case 2:case 3:if(!AV._config.isNode&&options.length===3){throw new Error('AV.init(): Master Key is only used in Node.js.');}initialize.apply(undefined,options);break;}}; // If we're running in node.js, allow using the master key.
2837+
* Call this method first to set up your authentication tokens for AV.
2838+
* You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
2839+
* @function AV.init
2840+
* @param args initialize options.
2841+
* @param args.appId application id
2842+
* @param args.appKey application key
2843+
* @param args.masterKey application master key
2844+
*/AV.init=function(){switch(arguments.length){case 1:var options=arguments.length<=0?undefined:arguments[0];if((typeof options==="undefined"?"undefined":_typeof(options))==='object'){if(!AV._config.isNode&&options.masterKey){throw new Error('AV.init(): Master Key is only used in Node.js.');}initialize(options.appId,options.appKey,options.masterKey);}else {throw new Error('AV.init(): Parameter is not correct.');}break; // 兼容旧版本的初始化方法
2845+
case 2:case 3:if(!AV._config.isNode&&arguments.length===3){throw new Error('AV.init(): Master Key is only used in Node.js.');}initialize.apply(undefined,arguments);break;}}; // If we're running in node.js, allow using the master key.
28422846
if(AV._config.isNode){AV.Cloud=AV.Cloud||{}; /**
28432847
* Switches the AVOSCloud SDK to using the Master key. The Master key grants
28442848
* priveleged access to the data in AVOSCloud and can be used to bypass ACLs and
@@ -2848,6 +2852,7 @@ if(AV._config.isNode){AV.Cloud=AV.Cloud||{}; /**
28482852
*/AV.Cloud.useMasterKey=function(){AV._useMasterKey=true;};} // 兼容老版本的初始化方法
28492853
AV.initialize=AV.init; /**
28502854
* Call this method to set production environment variable.
2855+
* @function AV.setProduction
28512856
* @param {Boolean} production True is production environment,and
28522857
* it's true by default.
28532858
*/AV.setProduction=function(production){if(!AV._isNullOrUndefined(production)){ //make sure it's a number

dist/node/browserify-wrapper/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = function _ajax(method, resourceUrl, data, success, error) {
5353
promise.reject(err);
5454
}
5555
} else {
56-
promise.reject(JSON.parse(responseText));
56+
promise.reject({ responseText: responseText });
5757
}
5858
});
5959
});

dist/node/utils.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,34 +98,35 @@ module.exports = function (AV) {
9898
};
9999

100100
/**
101-
* Call this method first to set up your authentication tokens for LC.
102-
* You can get your keys from the Data Browser on http://leancloud.cn .
103-
* @param {Object} incloud appId, appKey, masterKey
104-
*/
101+
* Call this method first to set up your authentication tokens for AV.
102+
* You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
103+
* @function AV.init
104+
* @param args initialize options.
105+
* @param args.appId application id
106+
* @param args.appKey application key
107+
* @param args.masterKey application master key
108+
*/
105109

106110
AV.init = function () {
107-
for (var _len = arguments.length, options = Array(_len), _key = 0; _key < _len; _key++) {
108-
options[_key] = arguments[_key];
109-
}
110-
111-
switch (options.length) {
111+
switch (arguments.length) {
112112
case 1:
113+
var options = arguments.length <= 0 ? undefined : arguments[0];
113114
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
114115
if (!AV._config.isNode && options.masterKey) {
115116
throw new Error('AV.init(): Master Key is only used in Node.js.');
116117
}
117-
initialize(options[0].appId, options[0].appKey, options[0].masterKey);
118+
initialize(options.appId, options.appKey, options.masterKey);
118119
} else {
119120
throw new Error('AV.init(): Parameter is not correct.');
120121
}
121122
break;
122123
// 兼容旧版本的初始化方法
123124
case 2:
124125
case 3:
125-
if (!AV._config.isNode && options.length === 3) {
126+
if (!AV._config.isNode && arguments.length === 3) {
126127
throw new Error('AV.init(): Master Key is only used in Node.js.');
127128
}
128-
initialize.apply(undefined, options);
129+
initialize.apply(undefined, arguments);
129130
break;
130131
}
131132
};
@@ -150,6 +151,7 @@ module.exports = function (AV) {
150151

151152
/**
152153
* Call this method to set production environment variable.
154+
* @function AV.setProduction
153155
* @param {Boolean} production True is production environment,and
154156
* it's true by default.
155157
*/

gulpfile.babel.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ gulp.task('babel-browser', ['browserify'], () => {
7272
return gulp.src('dist/av-es6.js')
7373
// .pipe(sourcemaps.init())
7474
.pipe(babel())
75-
.pipe(concat('av-es5.js'))
75+
.pipe(concat('av.js'))
7676
// .pipe(sourcemaps.write("."))
7777
.pipe(gulp.dest('dist'));
7878
});
7979

8080
gulp.task('uglify', ['babel-browser'], () => {
8181
return gulp.src([
82-
'dist/av-es5.js'
82+
'dist/av.js'
8383
])
8484
.pipe(uglify())
8585
.pipe(rename((path) => {
8686
// path.basename += '-mini';
87-
path.basename = 'av-mini';
87+
path.basename = 'av-min';
8888
}))
8989
.pipe(gulp.dest('dist'));
9090

@@ -99,8 +99,8 @@ gulp.task('compress-scripts', ['uglify'], () => {
9999

100100
return gulp.src([
101101
'dist/av-es6.js',
102-
'dist/av-es5.js',
103-
'dist/av-mini.js',
102+
'dist/av.js',
103+
'dist/av-min.js',
104104
'readme.txt'
105105
])
106106
.pipe(tar('avos-javascript-sdk-' + version + '.tar'))

readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
解压后的文件包括:
22

33
av-es6.js 未经压缩的 JavaScript SDK(ECMAScript 6 版本)
4-
av-es5.js 编译后的 JavaScript SDK(ECMAScript 5 版本)
5-
av-mini.js 经编译压缩后生成的 JavaScript SDK (ECMAScript 5 版本)
4+
av.js 编译后的 JavaScript SDK(ECMAScript 5 版本)
5+
av-min.js 经编译压缩后生成的 JavaScript SDK (ECMAScript 5 版本)
66

77
快速入门: https://leancloud.cn/start.html
88
开发指南: https://leancloud.cn/docs/js_guide.html

test/file.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111

12-
<script src="../dist/av-mini.js"></script>
12+
<script src="../dist/av-min.js"></script>
1313

1414
<!--Parse Test init-->
1515

test/file_blob.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
<script type="text/javascript">var serverURL="http://stg.paas.com/";</script>
16-
<script src="../dist/av-mini.js"></script>
16+
<script src="../dist/av-min.js"></script>
1717
<script>
1818
var hasBlobConstructor = window.Blob && (function () {
1919
try {

0 commit comments

Comments
 (0)