Skip to content

Commit 19d2313

Browse files
committed
chore: update readme and changelog
1 parent 44e1782 commit 19d2313

File tree

2 files changed

+114
-32
lines changed

2 files changed

+114
-32
lines changed

README.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,75 @@
1-
# LeanCloud JavaScript SDK [![Build Status](https://travis-ci.org/leancloud/javascript-sdk.svg)](https://travis-ci.org/leancloud/javascript-sdk) [![codecov.io](https://codecov.io/github/leancloud/javascript-sdk/coverage.svg?branch=master)](https://codecov.io/github/leancloud/javascript-sdk?branch=master)
1+
LeanCloud JavaScript SDK
2+
====
3+
[![Build Status](https://img.shields.io/travis/leancloud/javascript-sdk.svg?style=flat-square)](https://travis-ci.org/leancloud/javascript-sdk)
4+
[![Codecov](https://img.shields.io/codecov/c/github/leancloud/javascript-sdk.svg?style=flat-square)](https://codecov.io/github/leancloud/javascript-sdk)
5+
[![David](https://img.shields.io/david/leancloud/javascript-sdk.svg?style=flat-square)](https://david-dm.org/leancloud/javascript-sdk)
6+
[![npm](https://img.shields.io/npm/v/leancloud-storage.svg?style=flat-square)](https://www.npmjs.com/package/leancloud-storage)
27

3-
JavaScript SDK for [LeanCloud](http://leancloud.cn/).
48

5-
## 使用方法请看 [官方文档](https://leancloud.cn/docs/leanstorage_guide-js.html)
9+
JavaScript SDK for [LeanCloud](http://leancloud.cn/).
610

711
## 安装
812

913
```
1014
// npm 安装
1115
npm install leancloud-storage --save
16+
// npm 安装 pre-release 版本
17+
npm install leancloud-storage@next --save
1218
1319
// bower 安装
1420
bower install leancloud-storage --save
1521
```
22+
文档
23+
----
24+
- [安装文档](https://leancloud.cn/docs/sdk_setup-js.html)
25+
- [使用文档](https://leancloud.cn/docs/leanstorage_guide-js.html)
26+
- [API 文档](https://leancloud.github.io/javascript-sdk/docs/)
27+
28+
支持
29+
----
30+
* 如果你发现了新的 bug,或者有新的 feature request,请新建一个 issue
31+
* 在使用过程中遇到了问题时
32+
* 如果你购买了技术支持服务,请新建一个 ticket。
33+
* 也可以在 [论坛](https://forum.leancloud.cn/) 提问、讨论。
1634

17-
## 贡献代码
35+
贡献
36+
----
37+
如果你希望为这个项目贡献代码,请按以下步骤进行:
1838

1939
* `fork` 这个项目
2040
* `npm install` 安装相关依赖
2141
* 开发和调试
2242
* 浏览器环境执行 `gulp dev`,会自动启动 `demo` 目录,可在 `test-es6.js` 中修改和测试,`test-es5.js` 为自动生成的代码
2343
* Nodejs 环境同样在 `demo` 目录中,通过执行 `node test-es6.js` 开发与调试。推荐安装 `node inspector` 来调试,安装后执行 `node-debug test-es6.js`。每次修改代码后,如果开发代码引用的是 dist 目录中的代码,需要执行 `gulp release`
24-
* 确保测试全部通过 `gulp test`,浏览器环境打开 `test/test.html`
44+
* 确保测试全部通过 `npm run test`,浏览器环境打开 `test/test.html`
2545
* 提交并发起 `Pull Request`
26-
* 执行 `gulp release` 会生成全部版本的 SDK
2746

2847
项目的目录结构说明如下:
2948

3049
```
31-
├── README.md // 说明文档
32-
├── demo // demo 目录中有一些代码片段,主要用于开发与调试
33-
├── changelog.md
3450
├── dist // 编译之后生成的文件将会在此目录下
3551
│ ├── av-es6.js // 合并后的完整源码(ES6 版本)
3652
│ ├── av.js // 合并并编译后的完整源码(ES5 版本)
3753
│ ├── av-min.js // 合并、压缩并编译后的源码(ES5 版本)
3854
│ ├── node // 目录中为生成的 nodejs 版本代码
3955
│ └── ...
40-
├── gulpfile.babel.js
4156
├── src
42-
│ ├── av.js // node.js 环境入口文件
57+
│ ├── index.js // node.js 环境入口文件
4358
│ ├── browserify-wrapper // 目录中为针对 node.js 与浏览器环境之间差异的不同实现
4459
│ └── ...
45-
├── package.json
46-
├── readme.txt
47-
├── test // 单元测试
48-
│ └── ...
49-
└── tools // 构建中依赖的第三方工具
60+
└── test // 单元测试
5061
```
5162

52-
## 官方新版本发布流程
63+
## 发布流程
5364

54-
* 修改版本号
65+
0. 遵循 semver 提升版本号
5566
* src/version.js
5667
* package.json
5768
* bower.json
58-
* 修改 Changelog
59-
* 打包(执行 `gulp release`
60-
* 提交当前所有代码
61-
* 版本号相关修改
62-
* 对照 commit 历史写 change log
63-
* dist/ 目录中的新代码
64-
* 提交代码,发 Pull Request
65-
* 通过 review,merge 代码
66-
* Github 生成 release 包(for bower)
67-
* 发布到 npm,需 npm 协作者身份(执行 `npm publish`
68-
* 发布到 CDN,需要七牛权限(执行 `gulp upload`
69-
* 提醒所有相关工程师完善文档
70-
* 需修改文档中 JS SDK 的 CDN 地址
71-
69+
0. 对照 commit 历史写 changelog
70+
0. 提交当前所有改动
71+
0. 等待持续集成 pass
72+
0. 使用 GitHub 基于 dist 分支发布一个 release(for bower)
73+
0. Fetch and checkout remote `dist` branch 并确认该提交的内容是即将发布的版本
74+
0. npm publish(`npm publish`,需 npm 协作者身份),如果是 pre-release 版本需要带 next tag
75+
0. 发布到 CDN,需要七牛权限(执行 `gulp upload`

changelog.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
# 2.0.0-beta.0 (2016-9-27)
2+
### Breaking Changes
3+
* 移除了所有 Backbone callbacks 回调风格的参数,请使用 Promise 处理异步操作的结果:
4+
5+
```javascript
6+
// Backbone callback 回调风格的参数的用法
7+
object.save(null, {
8+
success: function(object) {},
9+
error: function(error, object) {},
10+
});
11+
12+
// 需要替换为
13+
object.save().then(
14+
function(object) {},
15+
function(error) {}
16+
);
17+
```
18+
19+
* `AV.Promise` 现在是一个满足 Promises/A+ 标准的实现,所有非标准的方法已被移除,所有非标准的行为已被修正。关于标准 Promise 的更多信息推荐阅读 [《JavaScript Promise 迷你书》](http://liubin.org/promises-book/)
20+
21+
* 如果你 extend 的 `AV.Object` 子类重写了 `validate` 方法,当属性无效时现在需要 throw 一个 Error(之前是 return 一个 Error)。相应的,`AV.Object#set` 方法如果 set 的值无效,需要通过 try catch 捕获异常(之前通过检查返回值是 false)。
22+
23+
```javascript
24+
// 之前的用法
25+
var Student = AV.Object.extend('Student', {
26+
validate: function(attibutes) {
27+
if (attributes.age < 0) return new Error('negative age set');
28+
}
29+
});
30+
var tom = new Student();
31+
if (tom.set('age', -1) === false) {
32+
console.error('something wrong');
33+
} else {
34+
tom.save();
35+
}
36+
37+
// 现在的用法
38+
var Student = AV.Object.extend('Student', {
39+
validate: function(attibutes) {
40+
if (attributes.age < 0) throw new Error('negative age set');
41+
}
42+
});
43+
var tom = new Student();
44+
try {
45+
tom.set('age', -1);
46+
} catch (error) {
47+
console.error(error.message);
48+
}
49+
tom.save();
50+
```
51+
52+
* `AV.User#_linkWith` 的第二个参数中的 `options.authData` 字段提升为第二个参数。
53+
54+
```javascript
55+
// 之前的用法
56+
user._linkWith('weixin', {
57+
authData: {
58+
access_token: 'access_token'
59+
},
60+
});
61+
62+
// 现在的用法
63+
user._linkWith('weixin', {
64+
access_token: 'access_token'
65+
});
66+
```
67+
68+
* 移除了 deprecated 的 API,包括:
69+
- `AV.Object#existed`
70+
- `AV.User.requestEmailVerfiy` (typo)
71+
- `AV.useAVCloudCN`
72+
- `AV.useAVCloudUS`
73+
- `AV._ajax`
74+
- `AV._request`
75+
76+
### Bug Fixes
77+
* 修复了应用内社交模块的方法在未登录状态下传入了 sessionToken 仍然抛未登录异常的问题
78+
179
## 1.4.0 (2016-9-1)
280
相比于 v1.4.0-beta.0:
381
* 修复了 `AV.File#save` 方法的 `onprogress` 参数失效的问题

0 commit comments

Comments
 (0)