diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..8abfd99f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,102 @@ +name: Bug Report +description: Report a bug to @VisActor/VChart +title: '[Bug] ' +labels: [bug] +body: + - type: markdown + attributes: + value: | + The issue list is reserved exclusively for bug reports and feature requests. + + For usage questions, please use the following resources: + + - Read the [docs](https://www.visactor.io/) + - Find in [examples](https://www.visactor.io/) + - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactor) + + For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). + + Also try to search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue using the form below instead of commenting on the old issue. + + # - type: checkboxes + # attributes: + # label: Is there an existing issue for this? + # description: Please search to see if an issue already exists for the bug you encountered. + # options: + # - label: I have searched the existing issues + # required: true + + - type: input + attributes: + label: Version + description: | + Check if the issue is reproducible with the latest stable version of @VisActor/VChart. + placeholder: | + e.g. 1.0.0 + + validations: + required: true + + - type: input + attributes: + label: Link to Minimal Reproduction + description: | + If the reproduction does not need a build setup, please provide a link to [JSFiddle](https://jsfiddle.net/pfv0azuc/4/),[CodePen](https://codepen.io/kkxxkk2019/pen/KKrMRqa) or [CodeSandbox](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww) or provide a GitHub repo. + The reproduction should be **minimal** - i.e. it should contain only the bare minimum amount of code needed to show the bug. + Please do not just fill in a random link. The issue will be closed if no valid reproduction is provided. [Why?](https://antfu.me/posts/why-reproductions-are-required) + + validations: + required: true + + - type: textarea + attributes: + label: Steps to Reproduce + description: | + What do we need to do after opening your repo in order to make the bug happen? Clear and concise reproduction instructions are important for us to be able to triage your issue in a timely manner. Note that you can use [Markdown](https://guides.github.com/features/mastering-markdown/) to format lists and code. + + placeholder: | + 1. How do you create the view + 2. What's the spec of view + 3. User interactions before the error happens. + validations: + required: true + + - type: textarea + attributes: + label: Current Behavior + description: A concise description of what you're experiencing. + validations: + required: true + + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: true + + - type: textarea + attributes: + label: Environment + description: | + e.g. + - **OS**: macOS Monterey + - **Browser**: Chrome 96.0.4664.55 + - **Framework** Vue@3 + value: | + - OS: + - Browser: + - Framework: + render: markdown + + validations: + required: false + + - type: textarea + attributes: + label: Any additional comments? + description: | + e.g. some background/context of how you ran into this bug. + + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..95ee307f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +# contact_links: +# - name: @VisaActor/VChart +# url: https://www.visactor.io/ +# about: Please search question here before opening a new issue diff --git a/.github/ISSUE_TEMPLATE/feaure_request.yml b/.github/ISSUE_TEMPLATE/feaure_request.yml new file mode 100644 index 00000000..0f65b108 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feaure_request.yml @@ -0,0 +1,38 @@ +name: Feature Request +description: Request a new feature from @VisActor/VChart +title: '[Feature] ' +labels: [new-feature] +body: + - type: markdown + attributes: + value: | + The issue list is reserved exclusively for bug reports and feature requests. + + For usage questions, please use the following resources: + + - Read the [docs](https://www.visactor.io/) + - Find in [examples](https://www.visactor.io//) + - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactors) + + For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). + + Also try to search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue using the form below instead of commenting on the old issue. + + - type: textarea + attributes: + label: What problem does this feature solve? + description: | + Explain your use case, context, and rationale behind this feature request. More importantly, what is the end user experience you are trying to build that led to the need for this feature? + + An important design goal of @VisActor/VChart is keeping the API surface small and straightforward. In general, we only consider adding new features that solve a problem that cannot be easily dealt with using existing APIs (i.e. not just an alternative way of doing things that can already be done). The problem should also be common enough to justify the addition. + + validations: + required: true + + - type: textarea + attributes: + label: What does the proposed API look like? + description: Describe how you propose to solve the problem and provide code samples of how the API would work once implemented. Note that you can use [Markdown](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to format your code blocks. + + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/others.md b/.github/ISSUE_TEMPLATE/others.md new file mode 100644 index 00000000..e3818ddf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/others.md @@ -0,0 +1,7 @@ +--- +name: Others +about: Describe this issue's purpose here. +title: '' +labels: '' +assignees: '' +--- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..b1cba0ad --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,86 @@ + + +[[中文版模板 / Chinese template](https://github.com/VisActor/VChart/blob/main/.github/PULL_REQUEST_TEMPLATE/pr_cn.md?plain=1)] + +### 🤔 This is a ... + +- [ ] New feature +- [ ] Bug fix +- [ ] TypeScript definition update +- [ ] Bundle size optimization +- [ ] Performance optimization +- [ ] Enhancement feature +- [ ] Refactoring +- [ ] Update dependency +- [ ] Code style optimization +- [ ] Test Case +- [ ] Branch merge +- [ ] Release +- [ ] Site / documentation update +- [ ] Demo update +- [ ] Workflow +- [ ] Other (about what?) + +### 🔗 Related issue link + + + +### 🔗 Related PR link + + + +### 🐞 Bugserver case id + + + +### 💡 Background and solution + + + +### 📝 Changelog + + + +| Language | Changelog | +| ---------- | --------- | +| 🇺🇸 English | | +| 🇨🇳 Chinese | | + +### ☑️ Self-Check before Merge + +⚠️ Please check all items below before requesting a reviewing. ⚠️ + +- [ ] Doc is updated/provided or not needed +- [ ] Demo is updated/provided or not needed +- [ ] TypeScript definition is updated/provided or not needed +- [ ] Changelog is provided or not needed + +--- + + + +### 🚀 Summary + +copilot:summary + +### 🔍 Walkthrough + +copilot:walkthrough diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_cn.md b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md new file mode 100644 index 00000000..6cf3bfa8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md @@ -0,0 +1,84 @@ + + +### 🤔 这个分支是... + +- [ ] 新功能 +- [ ] Bug fix +- [ ] Ts 类型更新 +- [ ] 打包优化 +- [ ] 性能优化 +- [ ] 功能增强 +- [ ] 重构 +- [ ] 依赖版本更新 +- [ ] 代码优化 +- [ ] 测试 case 更新 +- [ ] 分支合并 +- [ ] 发布 +- [ ] 网站/文档更新 +- [ ] demo 更新 +- [ ] Workflow +- [ ] 其他 (具体是什么,请补充?) + +### 🔗 相关 issue 链接 + + + +### 🔗 相关的 PR 链接 + + + +### 🐞 Bugserver 用例 id + + + +### 💡 问题的背景&解决方案 + + + +### 📝 Changelog + + + +| Language | Changelog | +| ---------- | --------- | +| 🇺🇸 English | | +| 🇨🇳 Chinese | | + +### ☑️ 自测 + +⚠️ 在提交 PR 之前,请检查一下内容. ⚠️ + +- [ ] 文档提供了,或者更新,或者不需要 +- [ ] Demo 提供了,或者更新,或者不需要 +- [ ] Ts 类型定义提供了,或者更新,或者不需要 +- [ ] Changelog 提供了,或者不需要 + +--- + + + +### 🚀 Summary + +copilot:summary + +### 🔍 Walkthrough + +copilot:walkthrough diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..a3ab94f2 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,21 @@ +# This workflow will triage pull requests and apply a label based on the +# paths that are modified in the pull request. +# +# To use this workflow, you will need to set up a .github/labeler.yml +# file with configuration. For more information, see: +# https://github.com/actions/labeler + +name: Labeler +on: [pull_request_target] + +jobs: + label: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - uses: actions/labeler@v4 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 00000000..c6b4e6a9 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,29 @@ +name: Check of pull request + +# 这里业务方根据需求设置 +on: + pull_request: + branches: ['develop', 'dev/**'] +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + - uses: xile611/pr-type-check@main + with: + pull_request_body: | + ${{ github.event.pull_request.body }} + pull_request_head: ${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..e37a6348 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,73 @@ +name: Pre-release CI + +on: + push: + branches: + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-hotfix.[0-9]+' + +jobs: + build: + runs-on: macOS-latest + + permissions: + contents: write + + strategy: + matrix: + node-version: [18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + # Install rush + - name: Install rush + run: node common/scripts/install-run-rush.js install --bypass-policy + + - name: Parse semver version from branch name + id: semver_parser + uses: xile611/read-package-version-action@main + with: + path: packages/vmind + semver_string: ${{ github.ref_name }} + semver_pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default + + - name: Apply prereleaseName + run: node common/scripts/apply-prerelease-version.js ${{ steps.semver_parser.outputs.pre_release_name }} ${{ steps.semver_parser.outputs.main }} + + - name: Build packages + env: + NODE_OPTIONS: '--max_old_space_size=4096' + run: node common/scripts/install-run-rush.js build --only tag:package + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.pre_release_type }} + + - name: Update shrinkwrap + run: node common/scripts/install-run-rush.js update + + - name: Get npm version + id: package-version + uses: xile611/read-package-version-action@main + with: + path: packages/vmind + + - name: Commit & Push changes + uses: actions-js/push@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}' + branch: ${{ github.ref_name }} + author_name: ${{ github.actor }} diff --git a/.github/workflows/release-changelog.yml b/.github/workflows/release-changelog.yml new file mode 100644 index 00000000..b1f403ef --- /dev/null +++ b/.github/workflows/release-changelog.yml @@ -0,0 +1,67 @@ +name: Release changelog + +on: + release: + types: [published] + +jobs: + update-changelog-after-publish-a-release: + name: GitHub Actions Test + runs-on: macOS-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v3 + - run: | + git config user.name ${{ github.actor }} + git config user.email ${{ github.actor }}@users.noreply.github.com + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + # Install rush + - name: Install rush + run: node common/scripts/install-run-rush.js install --bypass-policy + + - name: Create branch + run: | + git status + git fetch origin develop:develop + git checkout develop + git status + git checkout -b docs/generate-changelog-${{ github.event.release.tag_name }} + + - name: generate changelog + id: generate-changelog + uses: xile611/collect-release-changelog@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + folder: ./docs/assets/changelog + langs: 'en,zh' + tag_name: ${{github.event.release.tag_name}} + file_name: release.md + + - name: Push branch + run: | + git add . + git commit -m "docs: generate changelog of release ${{ github.event.release.tag_name }}" -n + git push origin docs/generate-changelog-${{ github.event.release.tag_name }} + + - name: Create Pull Request + uses: dustinirving/create-pr@v1.0.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: '[Auto changelog] changlog of ${{ github.event.release.tag_name }}' + base: develop + head: 'docs/generate-changelog-${{ github.event.release.tag_name }}' + labels: changelog + body: 'update changelog of ${{ github.event.release.tag_name }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0e041622 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,109 @@ +name: Release CI + +on: + push: + branches: + - 'release/[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + runs-on: macOS-latest + permissions: + contents: write + pull-requests: write + + strategy: + matrix: + node-version: [18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - run: | + git config user.name ${{ github.actor }} + git config user.email ${{ github.actor }}@users.noreply.github.com + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + # Install rush + - name: Install rush + run: node common/scripts/install-run-rush.js install --bypass-policy + + - name: Parse semver version from branch name + id: semver_parser + uses: xile611/read-package-version-action@main + with: + path: packages/vmind + semver_string: ${{ github.ref_name }} + semver_pattern: '^release/(.*)$' # ^v?(.*)$ by default + + - name: update nextBump of version policies + uses: xile611/set-next-bump-of-rush@main + with: + release_version: ${{ steps.semver_parser.outputs.full }} + write_next_bump: true + + - name: Update version + run: node common/scripts/install-run-rush.js version --bump + + - name: Build packages + env: + NODE_OPTIONS: '--max_old_space_size=4096' + run: node common/scripts/install-run-rush.js build --only tag:package + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + run: node common/scripts/install-run-rush.js publish --publish --include-all --tag latest + + - name: Update shrinkwrap + run: node common/scripts/install-run-rush.js update + + - name: Get npm version + id: package-version + uses: xile611/read-package-version-action@main + with: + path: packages/vmind + + - name: Commit & Push changes + run: | + git add . + git commit -m 'build: prelease version ${{ steps.package-version.outputs.current_version }}' -n + git push origin ${{ github.ref_name }} + + - name: Collect changelog of rush + uses: xile611/collect-rush-changlog@main + id: changelog + with: + version: ${{ steps.package-version.outputs.current_version }} + + - name: Create Release for Tag + id: release_tag + uses: ncipollo/release-action@v1.12.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag: v${{ steps.package-version.outputs.current_version }} + commit: main + prerelease: false + body: | + ${{ steps.changelog.outputs.markdown }} + draft: true # + + - name: Create Pull Request + uses: dustinirving/create-pr@v1.0.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: '[Auto release] release ${{ steps.package-version.outputs.current_version }}' + base: main + head: ${{ github.ref_name }} + labels: release # default labels, the action will throw error if not specified + reviewers: kkxxkk2019 # default reviewers, the action will throw error if not specified + body: | + ${{ steps.changelog.outputs.markdown }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..4595279c --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,35 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '20 4 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 730 + days-before-close: 7 + stale-issue-message: 'This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.' + close-issue-message: 'This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of @VisActor/VMind, please open a new issue and link this to it. Thanks!' + close-issue-reason: 'not_planned' + stale-issue-label: 'stale_issue' + stale-pr-message: 'This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR. We are sorry for this but 2 years is a long time and the code base has been changed a lot. Thanks for your contribution anyway.' + close-pr-message: 'This PR has been automatically closed because it has not had recent activity. Sorry for that and we are looking forward to your next contribution.' + stale-pr-label: 'stale_pr' + exempt-issue-labels: 'High Priority' + exempt-all-milestones: true + operations-per-run: 500 + ascending: true diff --git a/.github/workflows/sync-main-to-develop.yml b/.github/workflows/sync-main-to-develop.yml new file mode 100644 index 00000000..ca1f370d --- /dev/null +++ b/.github/workflows/sync-main-to-develop.yml @@ -0,0 +1,61 @@ +name: Sync main to develop after release + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + if_merged: + if: github.event.pull_request.merged == true + + runs-on: macOS-latest + + permissions: + contents: write + pull-requests: write + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + - run: | + git config user.name ${{ github.actor }} + git config user.email ${{ github.actor }}@users.noreply.github.com + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + # Install rush + - name: Install rush + run: node common/scripts/install-run-rush.js install --bypass-policy + + - name: Get version + id: package-version + uses: xile611/read-package-version-action@main + with: + path: packages/vmind + + - name: Create a new branch + run: | + git status + git checkout -b sync/main-${{ steps.package-version.outputs.current_version }} + git push origin sync/main-${{ steps.package-version.outputs.current_version }} + + - name: Create Pull Request + uses: dustinirving/create-pr@v1.0.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: '[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}' + base: develop + head: sync/main-${{ steps.package-version.outputs.current_version }} + reviewers: xile611 + body: 'Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}' diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 00000000..7bfb55d4 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,37 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: TEST CI + +on: + push: + branches: ['main', 'develop'] + pull_request: + branches: ['main', 'develop', 'dev/**'] + +jobs: + build: + runs-on: macOS-latest + + strategy: + matrix: + node-version: [18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' + + # Install rush + - name: Install rush + run: node common/scripts/install-run-rush.js install --bypass-policy + + - name: Compile + run: node common/scripts/install-run-rush.js compile --only tag:package + - name: Test + run: node common/scripts/install-run-rush.js test --only tag:package diff --git a/.gitignore b/.gitignore index 716c4993..1222cc77 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,7 @@ cjs build build-es5 *.zip - +packages/calculator/lib *.zip stats.html @@ -101,3 +101,5 @@ docs/public/documents # env files .env.local +packages/calculator/tsconfig.cjs.tsbuildinfo +packages/calculator/tsconfig.esm.tsbuildinfo diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 43f5ac1d..88e6e667 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -87,21 +87,14 @@ "commandKind": "global", "name": "start", "summary": "Start the development server", - "description": "Run this command to start vchart development server", - "shellCommand": "rush run -p @visactor/vchart -s start" - }, - { - "commandKind": "global", - "name": "react", - "summary": "Start the development server of react-vchart demo", - "description": "Run this command to start react-vchart development server", - "shellCommand": "rush run -p @visactor/react-vchart -s start" + "description": "Run this command to start VMind development server", + "shellCommand": "rush run -p @visactor/vmind -s start" }, { "commandKind": "global", "name": "vmind", - "summary": "Start the development server of react-vchart demo", - "description": "Run this command to start react-vchart development server", + "summary": "Start the development server", + "description": "Run this command to start VMind development server", "shellCommand": "rush run -p @visactor/vmind -s start" }, { @@ -119,13 +112,6 @@ "summary": "Start the document development server", "description": "Run this command to start document development server", "shellCommand": "rush run -p @internal/docs -s start" - }, - { - "commandKind": "global", - "name": "types", - "summary": "Build the types of vchart", - "description": "Run this command to build the types of vchart", - "shellCommand": "rush run -p @visactor/vchart -s build:types" } ], "parameters": [ @@ -176,7 +162,9 @@ "longName": "--message", "shortName": "-m", "description": "Write a message for change", - "associatedCommands": ["change-all"], + "associatedCommands": [ + "change-all" + ], "argumentName": "MESSAGE", "required": false }, @@ -185,7 +173,9 @@ "longName": "--not-commit", "shortName": "-n", "description": "not commit after run rush change", - "associatedCommands": ["change-all"], + "associatedCommands": [ + "change-all" + ], "required": false }, { @@ -193,7 +183,9 @@ "longName": "--type", "shortName": "-t", "description": "The bump type of change: major, minor, patch, none", - "associatedCommands": ["change-all"], + "associatedCommands": [ + "change-all" + ], "alternatives": [ { "name": "patch", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index dc33e4a9..71db8ad6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -7,6 +7,9 @@ importers: ../../packages/calculator: specifiers: + '@internal/bundler': workspace:* + '@internal/eslint-config': workspace:* + '@internal/ts-config': workspace:* '@types/jest': ^26.0.0 '@types/node': '*' jest: ^26.0.0 @@ -19,6 +22,9 @@ importers: dependencies: ts-pattern: 4.1.4 devDependencies: + '@internal/bundler': link:../../tools/bundler + '@internal/eslint-config': link:../../share/eslint-config + '@internal/ts-config': link:../../share/ts-config '@types/jest': 26.0.24 '@types/node': 20.11.6 jest: 26.6.3_ts-node@10.9.0 diff --git a/common/scripts/hotfix-release.js b/common/scripts/hotfix-release.js index 9cecc351..a4b840a6 100644 --- a/common/scripts/hotfix-release.js +++ b/common/scripts/hotfix-release.js @@ -16,12 +16,12 @@ function run() { let hotfixType = ''; const cwd = process.cwd(); const rushJson = getPackageJson(path.join(__dirname, '../../rush.json')); - const package = rushJson.projects.find((project) => project.packageName === '@visactor/vchart'); - + const package = rushJson.projects.find((project) => project.packageName === '@visactor/vmind'); + if (!package) { return; } - const pkgJsonPath = path.join( __dirname, '../../', package.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', package.projectFolder, 'package.json') const pkgJson = getPackageJson(pkgJsonPath) const currentVersion = pkgJson.version; const preReleaseName = ''; @@ -64,10 +64,6 @@ function run() { stdio: 'inherit', shell: false, }); - spawnSync('sh', ['-c', `rush build --only @visactor/lark-vchart`], { - stdio: 'inherit', - shell: false, - }); // 3. publish to npm spawnSync('sh', ['-c', `rush publish --publish --include-all --tag ${hotfixType}`], { @@ -82,7 +78,7 @@ function run() { }); if (package) { - const pkgJsonPath = path.join( __dirname, '../../', package.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', package.projectFolder, 'package.json') const pkgJson = getPackageJson(pkgJsonPath) // 5. add the the changes diff --git a/common/scripts/pre-release.js b/common/scripts/pre-release.js index 407f9650..dac9064f 100644 --- a/common/scripts/pre-release.js +++ b/common/scripts/pre-release.js @@ -18,14 +18,14 @@ function run() { let preReleaseType = ''; const cwd = process.cwd(); const rushJson = getPackageJson(path.join(__dirname, '../../rush.json')); - const package = rushJson.projects.find((project) => project.packageName === '@visactor/vchart'); + const package = rushJson.projects.find((project) => project.packageName === '@visactor/vmind'); let regRes = null; if (typeof preReleaseName === 'string' && preReleaseName && (regRes = preReleaseNameReg.exec(preReleaseName))) { preReleaseType = regRes[2]; } else if (!preReleaseName) { if (package) { - const pkgJsonPath = path.join( __dirname, '../../', package.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', package.projectFolder, 'package.json') const pkgJson = getPackageJson(pkgJsonPath) const currentVersion = pkgJson.version; @@ -60,10 +60,6 @@ function run() { stdio: 'inherit', shell: false, }); - spawnSync('sh', ['-c', `rush build --only @visactor/lark-vchart`], { - stdio: 'inherit', - shell: false, - }); // 3. publish to npm spawnSync('sh', ['-c', `rush publish --publish --include-all --tag ${preReleaseType}`], { @@ -78,7 +74,7 @@ function run() { }); if (package) { - const pkgJsonPath = path.join( __dirname, '../../', package.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', package.projectFolder, 'package.json') const pkgJson = getPackageJson(pkgJsonPath) // 5. add the the changes diff --git a/common/scripts/release.js b/common/scripts/release.js index e29a6719..ca28a779 100644 --- a/common/scripts/release.js +++ b/common/scripts/release.js @@ -30,10 +30,6 @@ function run() { stdio: 'inherit', shell: false, }); - spawnSync('sh', ['-c', `rush build --only @visactor/lark-vchart`], { - stdio: 'inherit', - shell: false, - }); // 3. publish to npm spawnSync('sh', ['-c', 'rush publish --publish --include-all'], { @@ -48,10 +44,10 @@ function run() { }); const rushJson = getPackageJson(path.join(__dirname, '../../rush.json')); - const package = rushJson.projects.find((project) => project.name === '@visactor/vchart'); + const package = rushJson.projects.find((project) => project.name === '@visactor/vmind'); if (package) { - const pkgJsonPath = path.join( __dirname, '../../', project.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', project.projectFolder, 'package.json') const pkgJson = getPackageJson(pkgJsonPath) // 5. add tag diff --git a/common/scripts/set-prerelease-version.js b/common/scripts/set-prerelease-version.js index 664642e7..6b8e50f2 100644 --- a/common/scripts/set-prerelease-version.js +++ b/common/scripts/set-prerelease-version.js @@ -8,12 +8,12 @@ const setJsonFileByKey = require('./set-json-file'); function writePrereleaseVersion(nextBump, preReleaseName, nextVersionStr, buildName) { const rushJson = getPackageJson(path.join(__dirname, '../../rush.json')); const projects = rushJson.projects; - const mainPackage = projects.find((project) => project.packageName === '@visactor/vchart'); + const mainPackage = projects.find((project) => project.packageName === '@visactor/vmind'); if (!mainPackage) { return; } - + const mainPkgJsonPath = path.join(__dirname, '../../', mainPackage.projectFolder, 'package.json') const mainPkgJson = getPackageJson(mainPkgJsonPath) const mainVersion = mainPkgJson.version; @@ -53,7 +53,7 @@ function writePrereleaseVersion(nextBump, preReleaseName, nextVersionStr, buildN console.log(`next version is ${nextVersion}`); projects.forEach(project => { - const pkgJsonPath = path.join( __dirname, '../../', project.projectFolder, 'package.json') + const pkgJsonPath = path.join(__dirname, '../../', project.projectFolder, 'package.json') let jsonFile = fs.readFileSync(pkgJsonPath, { encoding: 'utf-8' }) const pkgJson = JSON.parse(jsonFile); @@ -85,8 +85,8 @@ function writePrereleaseVersion(nextBump, preReleaseName, nextVersionStr, buildN fs.writeFileSync(pkgJsonPath, jsonFile) }); - + } -module.exports = writePrereleaseVersion; \ No newline at end of file +module.exports = writePrereleaseVersion; diff --git a/common/scripts/version-policies.js b/common/scripts/version-policies.js index c7925718..ef4f9151 100644 --- a/common/scripts/version-policies.js +++ b/common/scripts/version-policies.js @@ -15,11 +15,11 @@ const parseNextBumpFromVersion = ( ) => { const res = parseVersion(versionString); - if (res) { + if (res) { if (res.patch === 0) { return res.minor == 0 ? MAJOR : MINOR; } - + return PATCH } @@ -43,34 +43,34 @@ const writeNextBump = ( } const readNextBumpFromChanges = () => { - const changeRoot = path.join(__dirname, '../changes/@visactor/vchart'); + const changeRoot = path.join(__dirname, '../changes/@visactor/vmind'); const filenames = fs.readdirSync(changeRoot); if (filenames && filenames.length) { - const changeType = []; + const changeType = []; - filenames.forEach(fileName => { - const json = JSON.parse(fs.readFileSync(path.join(changeRoot, fileName)).toString()); + filenames.forEach(fileName => { + const json = JSON.parse(fs.readFileSync(path.join(changeRoot, fileName)).toString()); - if (json.changes && json.changes.length) { - json.changes.forEach(change => { - if (change.type && !changeType.includes(change.type)) { - changeType.push(change.type); - } - }) - } - }); + if (json.changes && json.changes.length) { + json.changes.forEach(change => { + if (change.type && !changeType.includes(change.type)) { + changeType.push(change.type); + } + }) + } + }); - return changeType.includes(MAJOR) ? MAJOR : changeType.includes(MINOR) ? MINOR : PATCH; - } else { - process.exit(1); - } + return changeType.includes(MAJOR) ? MAJOR : changeType.includes(MINOR) ? MINOR : PATCH; + } else { + process.exit(1); + } } const checkAndUpdateNextBump = (version) => { let nextBump = PATCH; - if (version && NEXT_BUMPMS.includes(version)) { + if (version && NEXT_BUMPMS.includes(version)) { nextBump = version; } else if (version) { nextBump = parseNextBumpFromVersion(version); diff --git a/packages/calculator/jest.config.ts b/packages/calculator/jest.config.ts new file mode 100644 index 00000000..3d2d6023 --- /dev/null +++ b/packages/calculator/jest.config.ts @@ -0,0 +1,32 @@ +module.exports = { + preset: 'ts-jest', + runner: 'jest-electron/runner', + testEnvironment: 'jest-electron/environment', + testMatch: ['/src/**/*.test.(ts|tsx)'], + silent: true, + globals: { + 'ts-jest': { + isolatedModules: true, + resolveJsonModule: true, + esModuleInterop: true, + experimentalDecorators: true, + module: 'ESNext', + tsconfig: './tsconfig.test.json' + } + }, + verbose: true, + collectCoverage: true, + coverageReporters: ['json-summary', 'lcov', 'text'], + coveragePathIgnorePatterns: ['node_modules', '__tests__', 'interface.ts', '.d.ts', 'typings', 'vite'], + collectCoverageFrom: [ + '**/src/**', + '!**/cjs/**', + '!**/build/**', + '!**/esm/**', + '!**/node_modules/**', + '!**/__tests__/**', + '!**/types/**', + '!**/interface.ts', + '!**/vite/**' + ] +}; diff --git a/packages/calculator/package.json b/packages/calculator/package.json index b619914c..e9664589 100644 --- a/packages/calculator/package.json +++ b/packages/calculator/package.json @@ -37,6 +37,9 @@ "rimraf": "^3.0.2", "ts-jest": "^26.0.0", "ts-node": "10.9.0", - "typescript": "4.9.5" + "typescript": "4.9.5", + "@internal/ts-config": "workspace:*", + "@internal/eslint-config": "workspace:*", + "@internal/bundler": "workspace:*" } } diff --git a/packages/calculator/tsconfig.json b/packages/calculator/tsconfig.json index f2a21e95..655834fb 100644 --- a/packages/calculator/tsconfig.json +++ b/packages/calculator/tsconfig.json @@ -1,7 +1,8 @@ { + "extends": "@internal/ts-config/tsconfig.base.json", "compilerOptions": { "declaration": true, //Generates corresponding d.ts files. - + "composite": true, "baseUrl": ".", "rootDir": "src", "outDir": "es", diff --git a/packages/calculator/tsconfig.test.json b/packages/calculator/tsconfig.test.json new file mode 100644 index 00000000..e68bcbbf --- /dev/null +++ b/packages/calculator/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "paths": { + } + }, + "references": [] +} diff --git a/packages/vmind/jest.config.js b/packages/vmind/jest.config.js index d9d660da..b9b8e822 100644 --- a/packages/vmind/jest.config.js +++ b/packages/vmind/jest.config.js @@ -5,7 +5,7 @@ module.exports = { preset: 'ts-jest', runner: 'jest-electron/runner', testEnvironment: 'jest-electron/environment', - testMatch: ['/src/**/*.test.(js|ts)'], + testMatch: ['/__tests__/unit/*.test.(js|ts)'], silent: true, globals: { 'ts-jest': { diff --git a/packages/vmind/package.json b/packages/vmind/package.json index e56651f2..cfedba4e 100644 --- a/packages/vmind/package.json +++ b/packages/vmind/package.json @@ -56,9 +56,8 @@ "react": "^18.0.0", "react-dom": "^18.0.0", "react-router-dom": "6.9.0", - "@visactor/vchart": "1.9.0", - "@visactor/vrender-core": "0.17.19", - "@visactor/vutils-extension": "1.9.0", + "@visactor/vchart": "^1.9.0", + "@visactor/vrender-core": "^0.17.19", "@rollup/plugin-dynamic-import-vars": "~2.1.0", "@ffmpeg/core": "^0.11.0", "@ffmpeg/ffmpeg": "^0.11.6", @@ -68,7 +67,7 @@ }, "dependencies": { "@visactor/chart-advisor": "0.1.10", - "@visactor/vrender-core": "0.17.19", + "@visactor/vrender-core": "^0.17.19", "@visactor/vdataset": "~0.17.4", "@visactor/vutils": "~0.17.4", "axios": "^1.4.0", diff --git a/rush.json b/rush.json index 37b8399d..93434047 100644 --- a/rush.json +++ b/rush.json @@ -67,7 +67,7 @@ { "packageName": "@visactor/calculator", "projectFolder": "packages/calculator", - "shouldPublish": false, + "shouldPublish": true, "tags": [ "package" ]