Skip to content

Commit 026ade4

Browse files
authored
Merge branch 'master' into fix-16924
2 parents b6a041e + ef926fa commit 026ade4

File tree

567 files changed

+151039
-66888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

567 files changed

+151039
-66888
lines changed

.eslintrc-common.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rules:
3939
- "error"
4040
prefer-const: 1
4141
no-constant-condition: 0
42-
comma-dangle: 2
42+
comma-dangle: 0
4343
no-debugger: 2
4444
no-dupe-keys: 2
4545
no-empty-character-class: 2
@@ -163,7 +163,7 @@ rules:
163163
- 2
164164
- "never"
165165
space-unary-ops: 2
166-
spaced-comment: 0
166+
spaced-comment: "error"
167167

168168
max-nested-callbacks:
169169
- 1

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ body:
4141
attributes:
4242
label: Link to Minimal Reproduction
4343
description: |
44-
If the reproduction does not need a build setup, please provide a link to [JSFiddle](https://jsfiddle.net/plainheart/e46ozpqj/7/), [JSBin](https://jsbin.com/) or [CodePen](https://codepen.io/Ovilia/pen/dyYWXWM). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/s/echarts-basic-example-template-mpfz1s) or provide a GitHub repo.
44+
If the reproduction does not need a build setup, please provide a link to [Official Editor](https://echarts.apache.org/examples/editor.html), [JSFiddle](https://jsfiddle.net/plainheart/e46ozpqj/7/), [JSBin](https://jsbin.com/) or [CodePen](https://codepen.io/Ovilia/pen/dyYWXWM). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/s/echarts-basic-example-template-mpfz1s) or provide a GitHub repo.
45+
The reproduction should be **minimal** - i.e. it should contain only the bare minimum amount of code needed to show the bug.
46+
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)
4547
4648
validations:
47-
required: false
49+
required: true
4850

4951
- type: textarea
5052
attributes:

.github/pull_request_template.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,28 @@ This pull request is in the type of:
3333

3434

3535

36-
### After: How is it fixed in this PR?
36+
### After: How does it behave after the fixing?
3737

3838
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
3939

4040
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
4141

4242

4343

44+
## Document Info
45+
46+
One of the following should be checked.
47+
48+
- [ ] This PR doesn't relate to document changes
49+
- [ ] The document should be updated later
50+
- [ ] The document changes have been made in apache/echarts-doc#xxx
51+
52+
53+
4454
## Misc
4555

46-
<!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
56+
### ZRender Changes
4757

48-
- [ ] The API has been changed (apache/echarts-doc#xxx).
4958
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
5059

5160
### Related test cases or examples to use the new APIs
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* @typedef {import('@octokit/rest').Octokit} Octokit
3+
* @typedef {import('@actions/github')['context']} Context
4+
*/
5+
6+
module.exports = async function updateNoticeYear(
7+
/** @type {{ octokit: Octokit, context: Context }} */
8+
{ octokit, context }
9+
) {
10+
const now = new Date()
11+
// Change to UTC+8
12+
now.setHours(now.getHours() + 8)
13+
const newYear = now.getFullYear()
14+
console.log('Prepare to update notice year to', newYear)
15+
16+
const noticeContent = `Apache ECharts
17+
Copyright 2017-${newYear} The Apache Software Foundation
18+
19+
This product includes software developed at
20+
The Apache Software Foundation (https://www.apache.org/).`
21+
22+
const repoCtx = context.repo
23+
24+
const repoInfo = (await octokit.rest.repos.get(repoCtx)).data
25+
const defaultBranchName = repoInfo.default_branch
26+
const remoteNoticeFile = (await octokit.rest.repos.getContent({
27+
...repoCtx,
28+
path: 'NOTICE',
29+
ref: defaultBranchName
30+
})).data
31+
const remoteNoticeContent = base64ToUtf8(remoteNoticeFile.content)
32+
if (remoteNoticeContent === noticeContent) {
33+
console.log('NOTICE year is already updated.')
34+
return
35+
}
36+
37+
console.log('Ready to update the NOTICE file:\n' + noticeContent)
38+
39+
const defaultBranch = (await octokit.rest.repos.getBranch({
40+
...repoCtx,
41+
branch: defaultBranchName
42+
})).data
43+
44+
const newBranchName = `bot/update-notice-year/${newYear}`
45+
await octokit.rest.git.createRef({
46+
...repoCtx,
47+
ref: `refs/heads/${newBranchName}`,
48+
sha: defaultBranch.commit.sha
49+
})
50+
console.log('Created a new branch:', newBranchName)
51+
52+
await octokit.rest.repos.createOrUpdateFileContents({
53+
...repoCtx,
54+
path: 'NOTICE',
55+
message: `chore: update NOTICE year to ${newYear}`,
56+
content: utf8ToBase64(noticeContent),
57+
sha: remoteNoticeFile.sha,
58+
branch: newBranchName
59+
})
60+
61+
console.log('Updated the NOTICE file on the new branch')
62+
63+
const pr = (await octokit.rest.pulls.create({
64+
...repoCtx,
65+
head: newBranchName,
66+
base: defaultBranchName,
67+
maintainer_can_modify: true,
68+
title: `chore: update NOTICE year to ${newYear}`,
69+
body: `## Brief Information
70+
71+
This pull request is in the type of:
72+
73+
- [ ] bug fixing
74+
- [ ] new feature
75+
- [x] others
76+
77+
### What does this PR do?
78+
79+
Update notice year to ${newYear}. 💖
80+
81+
Happy new year! 祝大家新年快乐!🎇`
82+
})).data
83+
84+
console.log(`Opened PR #${pr.number} for updating the NOTICE file`)
85+
}
86+
87+
function utf8ToBase64(data) {
88+
return Buffer.from(data, 'utf-8').toString('base64')
89+
}
90+
91+
function base64ToUtf8(data) {
92+
return Buffer.from(data, 'base64').toString('utf-8')
93+
}

.github/workflows/ci.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@ name: Node CI
22

33
on:
44
pull_request:
5-
types: [opened, synchronize]
5+
types: [opened, reopened, synchronize]
6+
7+
concurrency:
8+
# Note that the `teardown-pr-preview` workflow needs the same group name
9+
# to cancel the running `ci` workflows
10+
group: ${{ github.workflow }}-${{ github.event.number }}
11+
cancel-in-progress: true
612

713
jobs:
814
lint:
915
runs-on: ubuntu-latest
1016

1117
strategy:
1218
matrix:
13-
node-version: [12.x]
19+
node-version: [18.x]
1420

1521
steps:
1622
- name: Fetch commit count
@@ -19,18 +25,18 @@ jobs:
1925
run: |
2026
echo "FETCH_DEPTH=$(($PR_COMMIT_COUNT + 1))" >> $GITHUB_ENV
2127
22-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2329
with:
2430
fetch-depth: ${{ env.FETCH_DEPTH }}
2531

2632
- name: Use Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
2834
with:
2935
node-version: ${{ matrix.node-version }}
3036

3137
- name: Cache node modules
3238
id: cache-dep
33-
uses: actions/cache@v3
39+
uses: actions/cache@v4
3440
env:
3541
cache-name: cache-node-modules
3642
with:
@@ -44,7 +50,7 @@ jobs:
4450
- name: Collect changed files
4551
run: |
4652
mkdir ~/tmp/
47-
git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --name-only --relative '*src/**/*.ts' > ~/tmp/changed_files
53+
git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --diff-filter=ACM --name-only --relative '*src/**/*.ts' > ~/tmp/changed_files
4854
echo -e "Changed files: \n$(cat ~/tmp/changed_files)"
4955
5056
- name: Lint
@@ -58,19 +64,19 @@ jobs:
5864

5965
strategy:
6066
matrix:
61-
node-version: [12.x]
67+
node-version: [18.x]
6268

6369
steps:
64-
- uses: actions/checkout@v3
70+
- uses: actions/checkout@v4
6571

6672
- name: Use Node.js ${{ matrix.node-version }}
67-
uses: actions/setup-node@v3
73+
uses: actions/setup-node@v4
6874
with:
6975
node-version: ${{ matrix.node-version }}
7076

7177
- name: Cache node modules
7278
id: cache-dep
73-
uses: actions/cache@v3
79+
uses: actions/cache@v4
7480
env:
7581
cache-name: cache-node-modules
7682
with:
@@ -81,11 +87,43 @@ jobs:
8187
if: steps.cache-dep.outputs.cache-hit != 'true'
8288
run: npm ci
8389

90+
- name: Unit Test
91+
run: npm run test
92+
8493
- name: Build release
8594
run: npm run release
8695

8796
- name: Test generated DTS
8897
run: npm run test:dts
8998

90-
- name: Unit Test
91-
run: npm run test
99+
- name: Pack npm tarball
100+
if: ${{ github.repository_owner == 'apache' }}
101+
id: pack-tarball
102+
run: |
103+
export PR_PREVIEW_DIR='echarts-pr-preview'
104+
mkdir -p $PR_PREVIEW_DIR
105+
npm pack -pack-destination $PR_PREVIEW_DIR
106+
echo "PR_PREVIEW_DIR=$PR_PREVIEW_DIR" >> $GITHUB_ENV
107+
108+
- name: Save PR metadata and dist files
109+
if: ${{ steps.pack-tarball.outcome == 'success' }}
110+
id: save-pr-data
111+
env:
112+
PR_NUMBER: ${{ github.event.number }}
113+
PR_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
114+
PR_PREVIEW_DIR: ${{ env.PR_PREVIEW_DIR }}
115+
run: |
116+
cd $PR_PREVIEW_DIR
117+
echo $PR_NUMBER > ./pr_number
118+
echo $PR_COMMIT_SHA > ./pr_commit_sha
119+
find . -type f -regex ".*\.tgz" -exec tar xvzf {} \;
120+
rm -f *.tgz
121+
echo -e "Dist files: \n$(ls -l)"
122+
123+
- uses: actions/upload-artifact@v4
124+
if: ${{ steps.save-pr-data.outcome == 'success' }}
125+
with:
126+
name: pr_preview
127+
path: ${{ env.PR_PREVIEW_DIR }}
128+
retention-days: 1
129+
if-no-files-found: error

.github/workflows/nightly-next.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish Nightly Next
22

33
on:
44
schedule:
5-
- cron: '0 9 * * *' # After zrender nightly published
5+
- cron: '10 9 * * *' # After zrender nightly published
66
# committers can manually trigger with workflow_dispatch
77
workflow_dispatch: {}
88
repository_dispatch:
@@ -11,27 +11,33 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
if: ${{ github.repository_owner == 'apache' }}
1415

1516
strategy:
1617
matrix:
17-
node-version: [12.x]
18+
node-version: [18.x]
1819

1920
steps:
20-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2122
with:
2223
ref: next
2324

2425
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v2
26+
uses: actions/setup-node@v4
2627
with:
2728
registry-url: https://registry.npmjs.org/
29+
node-version: ${{ matrix.node-version }}
30+
2831
- name: Setup and publish nightly
2932
run: |
33+
node build/nightly/prepare.js --next
34+
npm i zrender@npm:zrender-nightly@next
3035
npm ci
36+
npm ls zrender
37+
node build/nightly/post.js
3138
npm run release
3239
npm run test
3340
npm run test:dts
34-
node build/prepareNightly.js --next
3541
npm publish --tag next
3642
env:
3743
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/nightly.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,31 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
if: ${{ github.repository_owner == 'apache' }}
1415

1516
strategy:
1617
matrix:
17-
node-version: [12.x]
18+
node-version: [18.x]
1819

1920
steps:
20-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
22+
2123
- name: Use Node.js ${{ matrix.node-version }}
22-
uses: actions/setup-node@v2
24+
uses: actions/setup-node@v4
2325
with:
2426
registry-url: https://registry.npmjs.org/
27+
node-version: ${{ matrix.node-version }}
28+
2529
- name: Setup and publish nightly
2630
run: |
31+
node build/nightly/prepare.js
32+
npm i zrender@npm:zrender-nightly
2733
npm ci
34+
npm ls zrender
35+
node build/nightly/post.js
2836
npm run release
2937
npm run test
3038
npm run test:dts
31-
node build/prepareNightly.js
3239
npm publish
3340
env:
3441
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)