Skip to content

Commit

Permalink
Release (#1495)
Browse files Browse the repository at this point in the history
* feat: init gesture plugin (#1454)

* feat: init gesture plugin

* feat: 修改部分问题

* chore: update contributing.md

* chore: commit changeset

---------

Co-authored-by: 兵人 <[email protected]>

* chore: trigger changeset (#1494)

* chore: trigger changeset

* chore: commit changeset

* chore(release): bump version (#1493)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: 兵人 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 18, 2023
1 parent 360cb8b commit b288bf2
Show file tree
Hide file tree
Showing 22 changed files with 935 additions and 190 deletions.
57 changes: 28 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ If you have any comment or advice, please report your [issue](https://github.com

## Reporting New Issues

- Please specify what kind of issue it is.
- Before you report an issue, please search for related issues. Make sure you are not going to open a duplicate issue.
- Explain your purpose clearly in tags(see **Useful Tags**), title, or content.
- Please specify what kind of issue it is.
- Before you report an issue, please search for related issues. Make sure you are not going to open a duplicate issue.
- Explain your purpose clearly in tags(see **Useful Tags**), title, or content.

AntV group members will confirm the purpose of the issue, replace more accurate tags for it, identify related milestone, and assign developers working on it.

Expand Down Expand Up @@ -58,14 +58,14 @@ You are encouraged to use [angular commit-message-format](https://github.com/ang

Must be one of the following:

- feat: A new feature
- fix: A bug fix
- docs: Documentation-only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
- feat: A new feature
- fix: A bug fix
- docs: Documentation-only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

(2)scope

Expand All @@ -81,8 +81,8 @@ Feel free to add more content in the body, if you think subject is not self-expl

(5)footer

- **If the commit is a Breaking Change, please note it clearly in this part.**
- related issues, like `Closes #1, Closes #2, #3`
- **If the commit is a Breaking Change, please note it clearly in this part.**
- related issues, like `Closes #1, Closes #2, #3`

e.g.

Expand All @@ -108,8 +108,8 @@ Look at [these files](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJyg
G provides a two-part test based on Jest:
- **unit test** [`__tests__/unit/`](./__tests__/unit/) Testing pure data modules or functions
- **integration test** [`__tests__/integration/`](./__tests__/integration/) Based on [node-canvas](https://github.com/Automattic/node-canvas), [jsdom](https://github.com/jsdom/jsdom/) and [headless-gl](https://github.com/stackgl/headless-gl), we test these 3 renderers `@antv/g-canvas`, `@antv/g-svg` and `@antv/g-webgl` on the serverside. We will compare the generated snapshots with golden images later.
- **unit test** [`__tests__/unit/`](./__tests__/unit/) Testing pure data modules or functions
- **integration test** [`__tests__/integration/`](./__tests__/integration/) Based on [node-canvas](https://github.com/Automattic/node-canvas), [jsdom](https://github.com/jsdom/jsdom/) and [headless-gl](https://github.com/stackgl/headless-gl), we test these 3 renderers `@antv/g-canvas`, `@antv/g-svg` and `@antv/g-webgl` on the serverside. We will compare the generated snapshots with golden images later.
## Publish
Expand All @@ -133,19 +133,18 @@ This makes it easy to perform version locking.
Referring to [S2's engineering practices](https://www.yuque.com/antv/vo4vyz/vtowig#HuNvY), we use [changesets](https://github.com/changesets/changesets) for fully automated semantic releases. It can automatically create GitHub Releases and automatically associate the release to the corresponding issue.
There are three release branches:
- The `next` branch is for the current stable release
- The `beta` branch for beta releases
- The `alpha` branch for the preview release
Create a new branch `release` from `next`, each PR will trigger CI on `release`. We publish on `next` branch finally.
1. Create `release` branch from `next`
2. Checkout dev branch from `release`, run changeset and commit
```bash
git commit -m "chore(release): bump version"
git push
pnpm run changeset
git add ./
git commit -a -m "chore: commit changeset"
```
3. Merge dev branch into `release` branch, CI version process will create a `Version Package` PR
4. Merge `release` into `next` branch
In addition, all API deprecations need to be `deprecate` prompted on the current stable version and guaranteed to be compatible on the current stable version until a new version is released.
### How to lock down dependencies
Expand All @@ -154,8 +153,8 @@ It is often necessary to lock down certain dependencies in case of emergency, or
tnpm uses `resolutions`. Take G2 as an example, if we want to test beta versions:
- Use `dependencies` to lock down **direct dependencies**.
- Use `resolutions` to lock down **indirect dependencies**, which can make sure some dependencies of G2 such as `@antv/gui` using the same beta versions
- Use `dependencies` to lock down **direct dependencies**.
- Use `resolutions` to lock down **indirect dependencies**, which can make sure some dependencies of G2 such as `@antv/gui` using the same beta versions
```js
"dependencies": {
Expand All @@ -175,6 +174,6 @@ tnpm uses `resolutions`. Take G2 as an example, if we want to test beta versions
Other package management tools also have corresponding dependency overrides:
- npm [overrides](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)
- yarn [resolutions](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/)
- pnpm [overrides](https://pnpm.io/package_json#pnpmoverrides)
- npm [overrides](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)
- yarn [resolutions](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/)
- pnpm [overrides](https://pnpm.io/package_json#pnpmoverrides)
53 changes: 29 additions & 24 deletions CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

## 提交 issue

- 请确定 issue 的类型。
- 请避免提交重复的 issue,在提交之前搜索现有的 issue。
- 在标签(分类参考**标签分类**), 标题 或者内容中体现明确的意图。
- 请确定 issue 的类型。
- 请避免提交重复的 issue,在提交之前搜索现有的 issue。
- 在标签(分类参考**标签分类**), 标题 或者内容中体现明确的意图。

随后 AntV 负责人会确认 issue 意图,更新合适的标签,关联 milestone,指派开发者。

Expand Down Expand Up @@ -59,15 +59,15 @@ $ git push origin branch-name

提交 commit 的类型,包括以下几种

- feat: 新功能
- fix: 修复问题
- docs: 修改文档
- style: 修改代码格式,不影响代码逻辑
- refactor: 重构代码,理论上不影响现有功能
- perf: 提升性能
- test: 增加修改测试用例
- chore: 修改工具相关(包括但不限于文档、代码生成等)
- deps: 升级依赖
- feat: 新功能
- fix: 修复问题
- docs: 修改文档
- style: 修改代码格式,不影响代码逻辑
- refactor: 重构代码,理论上不影响现有功能
- perf: 提升性能
- test: 增加修改测试用例
- chore: 修改工具相关(包括但不限于文档、代码生成等)
- deps: 升级依赖

(2)scope

Expand All @@ -83,8 +83,8 @@ $ git push origin branch-name

(5)footer

- **当有非兼容修改(Breaking Change)时必须在这里描述清楚**
- 关联相关 issue,如 `Closes #1, Closes #2, #3`
- **当有非兼容修改(Breaking Change)时必须在这里描述清楚**
- 关联相关 issue,如 `Closes #1, Closes #2, #3`

示例

Expand All @@ -110,8 +110,8 @@ BREAKING CHANGE:
G 基于 Jest 提供了两部分测试:
- **单元测试** [`__tests__/unit/`](./__tests__/unit/) 测试纯数据模块或者功能
- **集成测试** [`__tests__/integration/`](./__tests__/integration/) 基于 [node-canvas](https://github.com/Automattic/node-canvas),[jsdom](https://github.com/jsdom/jsdom/) 和 [headless-gl](https://github.com/stackgl/headless-gl) 完成 `@antv/g-canvas``@antv/g-svg``@antv/g-webgl` 三个渲染器的服务端渲染,再进行截图对比
- **单元测试** [`__tests__/unit/`](./__tests__/unit/) 测试纯数据模块或者功能
- **集成测试** [`__tests__/integration/`](./__tests__/integration/) 基于 [node-canvas](https://github.com/Automattic/node-canvas),[jsdom](https://github.com/jsdom/jsdom/) 和 [headless-gl](https://github.com/stackgl/headless-gl) 完成 `@antv/g-canvas``@antv/g-svg``@antv/g-webgl` 三个渲染器的服务端渲染,再进行截图对比
## 发布管理
Expand All @@ -135,13 +135,18 @@ G 使用 [pnpm workspace](https://pnpm.io/workspaces) 作为 monorepo 方案。
参考 [S2 的工程化实践](https://www.yuque.com/antv/vo4vyz/vtowig#HuNvY),我们使用了 [changesets](https://github.com/changesets/changesets) 进行全自动的语义化发布。它可以自动创建 GitHub Releases。
从 next 分支拉出发布分支 release。每个 release 分支上的提交都会触发 CI,更新 version。最后在 next 分支上触发 publish 流程。
1. 从 next 分支拉出发布分支 release
2. 从 release 分支拉出各自的开发分支,开发完成后执行 changeset 并提交:
```bash
git commit -m "chore(release): bump version"
git push
pnpm run changeset
git add ./
git commit -a -m "chore: commit changeset"
```
3. 将开发分支合入 release 分支,此时会触发 CI version 流程,自动生成 Version Package 的 PR,将此 PR 合入
4. 最后将 release 分支合并到 next 分支上,此时会触发 CI release 流程
另外所有 API 的废弃都需要在当前的稳定版本上 `deprecate` 提示,并保证在当前的稳定版本上一直兼容到新版本的发布。
### 如何锁定版本
Expand All @@ -150,8 +155,8 @@ git push
tnpm 使用 `resolutions` 进行依赖覆盖。以 G2 为例,假如想测试一系列 beta 版本效果,可以这样做:
- `dependencies` 中锁定**直接依赖**的版本号
- `resolutions` 中锁定**间接依赖**的版本号。这样确保 G2 依赖的 `@antv/gui` 也使用同样的版本
- 在 `dependencies` 中锁定**直接依赖**的版本号
- 在 `resolutions` 中锁定**间接依赖**的版本号。这样确保 G2 依赖的 `@antv/gui` 也使用同样的版本
```js
"dependencies": {
Expand All @@ -171,6 +176,6 @@ tnpm 使用 `resolutions` 进行依赖覆盖。以 G2 为例,假如想测试
其他包管理工具也都有对应的依赖覆盖方式,不再赘述:
- npm [overrides](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)
- yarn [resolutions](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/)
- pnpm [overrides](https://pnpm.io/package_json#pnpmoverrides)
- npm [overrides](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)
- yarn [resolutions](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/)
- pnpm [overrides](https://pnpm.io/package_json#pnpmoverrides)
13 changes: 13 additions & 0 deletions packages/g-mobile-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @antv/g-mobile-canvas

## 0.11.0

### Minor Changes

- d92e6c43: Update minor version.

### Patch Changes

- cd442df1: Use latest gesture plugin.
- Updated dependencies [cd442df1]
- Updated dependencies [d92e6c43]
- @antv/g-plugin-gesture@1.1.0

## 0.10.12

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/g-mobile-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-canvas",
"version": "0.10.12",
"version": "0.11.0",
"description": "A renderer implemented with Canvas2D API in mobile environment",
"keywords": [
"antv",
Expand Down Expand Up @@ -45,6 +45,7 @@
"@antv/g-plugin-dragndrop": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-plugin-gesture": "workspace:*",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
Expand Down
16 changes: 14 additions & 2 deletions packages/g-mobile-canvas/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import * as CanvasRenderer from '@antv/g-plugin-canvas-renderer';
import * as DragDropEvent from '@antv/g-plugin-dragndrop';
import * as ImageLoader from '@antv/g-plugin-image-loader';
import * as MobileInteraction from '@antv/g-plugin-mobile-interaction';
import * as GesturePlugin from '@antv/g-plugin-gesture';

import { isNil } from '@antv/util';
import { ContextRegisterPlugin } from './ContextRegisterPlugin';

Expand Down Expand Up @@ -36,8 +38,12 @@ export class Renderer extends AbstractRenderer {

this.registerPlugin(
new DragDropEvent.Plugin({
isDocumentDraggable: isNil(config?.isDocumentDraggable) ? true : config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable) ? true : config.isDocumentDroppable,
isDocumentDraggable: isNil(config?.isDocumentDraggable)
? true
: config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable)
? true
: config.isDocumentDroppable,
dragstartDistanceThreshold: isNil(config?.dragstartDistanceThreshold)
? 10
: config.dragstartDistanceThreshold,
Expand All @@ -46,5 +52,11 @@ export class Renderer extends AbstractRenderer {
: config.dragstartTimeThreshold,
}),
);

this.registerPlugin(
new GesturePlugin.Plugin({
isDocumentGestureEnabled: true,
}),
);
}
}
11 changes: 11 additions & 0 deletions packages/g-plugin-gesture/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @antv/g-plugin-gesture

## 1.1.0

### Minor Changes

- d92e6c43: Update minor version.

### Patch Changes

- cd442df1: Use latest gesture plugin.
21 changes: 21 additions & 0 deletions packages/g-plugin-gesture/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 AntV team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions packages/g-plugin-gesture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# @antv/g-plugin-gesture

## Getting Started

Create and register plugin in renderer.

```js
import { Renderer } from '@antv/g-canvas';
import { Plugin } from '@antv/g-plugin-gesture';

const plugin = new Plugin();
const renderer = new Renderer();
renderer.registerPlugin(plugin);
```

Enable gesture with `gestureEnabled` in style.

```js
const circle = new Circle({
style: {
cx: 200,
cy: 200,
r: 100,
fill: 'blue',
gestureEnabled: true,
},
});
```

Then we can listen gesture event such as `press` on plugin:

```js
canvas.addEventListener('press', (e) => {
console.log(e.target);
});
```
Loading

0 comments on commit b288bf2

Please sign in to comment.