diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index 73ba1490..00000000 --- a/.babelrc.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. - -module.exports = { - presets: [ - '@babel/preset-env', - '@babel/preset-typescript' - ], -}; diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 00000000..e5b6d8d6 --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000..bdf0c312 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "v5", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..25fec9f7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab +indent_size = 1 + +[*.md] +trim_trailing_whitespace = false +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..73259f95 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: build + +on: ["push", "pull_request"] + +jobs: + ci: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 9 + run_install: false + + - name: Install Dependencies + run: pnpm install --no-frozen-lockfile + + - name: build + run: | + pnpm run ci + + - name: test + run: | + pnpm test + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: antvis/layout diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3335940c..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: CI - -on: ["push", "pull_request"] - -jobs: - ci: - runs-on: macos-latest - steps: - - uses: actions/checkout@v1 - - name: Use Node.js 12 - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: yarn install - run: | - yarn install - - name: lint - run: | - yarn run lint - - name: build - run: | - yarn run build \ No newline at end of file diff --git a/.gitignore b/.gitignore index a88b3814..9ab69d31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,25 @@ .DS_Store -.vscode .idea npm-debug.log yarn-error.log +yarn.lock lerna-debug.log node_modules package-lock.json +Cargo.lock coverage lib es +esm dist *.pem !mock-cert.pem +target +pkg +pkg-node +pkg-parallel +*.lock +Cargo.lock +tsconfig.tsbuildinfo +tsconfig.build.tsbuildinfo +pnpm-lock.yaml diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 00000000..62aa5925 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit "$1" \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..c37466e2 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..b2a42eaa --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +es +lib +dist +tsconfig.json diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..368cc5e5 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,8 @@ +module.exports = { + plugins: [require.resolve('prettier-plugin-organize-imports')], + semi: true, + singleQuote: true, + trailingComma: 'all', + bracketSpacing: true, + arrowParens: 'always', +}; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..88c9a298 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "cSpell.words": [ + "acyclicer", + "edgesep", + "Fruchterman", + "graphlib", + "nodesep", + "rankdir", + "ranksep", + "relayout" + ], + "rust-analyzer.linkedProjects": ["./packages/layout-rust/Cargo.toml"] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..4478c28d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,179 @@ +# 代码贡献规范 + +有任何疑问,欢迎提交 [issue](https://github.com/antvis/layout/issues), +或者直接修改提交 [PR](https://github.com/antvis/layout/pulls)! + +## 开发 + +该项目使用 yarn workspace 作为 monorep 方案。 + +安装依赖: + +```bash +$ yarn install +``` + +编译: + +```bash +$ yarn build +``` + +在 `/demo` 下包含 UMD 的使用示例,编译后在本地启动开发服务器即可预览: + +```bash +$ http-server -p 9090 +``` + +## 测试 + +### 单元测试 + +使用 Jest 运行 `__tests__` 下的单元测试: + +```bash +$ yarn test +``` + +## 提交 issue + +- 请确定 issue 的类型。 +- 请避免提交重复的 issue,在提交之前搜索现有的 issue。 +- 在标签(分类参考**标签分类**), 标题 或者内容中体现明确的意图。 + +随后 AntV 负责人会确认 issue 意图,更新合适的标签,关联 milestone,指派开发者。 + +## 提交代码 + +### 提交 Pull Request + +如果你有仓库的开发者权限,而且希望贡献代码,那么你可以创建分支修改代码提交 PR,AntV 开发团队会 review 代码合并到主干。 + +```bash +# 先创建开发分支开发,分支名应该有含义,避免使用 update、tmp 之类的 +$ git checkout -b branch-name + +# 开发完成后跑下测试是否通过,必要时需要新增或修改测试用例 +$ npm test + +# 测试通过后,提交代码,message 见下面的规范 + +$ git add . # git add -u 删除文件 +$ git commit -m "fix(role): role.use must xxx" +$ git push origin branch-name +``` + +提交后就可以在 [@antv/layout](https://github.com/antvis/layout/pulls) 创建 Pull Request 了。 + +由于谁也无法保证过了多久之后还记得多少,为了后期回溯历史的方便,请在提交 MR 时确保提供了以下信息。 + +1. 需求点(一般关联 issue 或者注释都算) +2. 升级原因(不同于 issue,可以简要描述下为什么要处理) +3. 框架测试点(可以关联到测试文件,不用详细描述,关键点即可) +4. 关注点(针对用户而言,可以没有,一般是不兼容更新等,需要额外提示) + +### 代码风格 + +你的代码风格必须通过 eslint,你可以运行 `$ npm run lint` 本地测试。 + +### Commit 提交规范 + +根据 [angular 规范](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format)提交 commit, +这样 history 看起来更加清晰,还可以自动生成 changelog。 + +```xml +(): + + + +