Skip to content

Commit 2024398

Browse files
committed
Merge branch 'develop' into pr/Zumbala/4483
* develop: (705 commits) chore: Fix unit tests chore(deps): update all patch dependencies chore: Update docs Update docs New Mermaid Live Editor for Confluence Cloud (mermaid-js#4814) Update link to Discourse theme component (mermaid-js#4811) Update flowchart.md (mermaid-js#4810) chore: remove unneeded `CommomDB` chore: Update docs "CSS" instead of "css" in flowchart.md (mermaid-js#4797) Update CONTRIBUTING.md Update CONTRIBUTING.md fix: typos (mermaid-js#4801) chore: Align with convention fix: Add support for `~test Array~string~` chore: Add JSDoc to apply in sequenceDB refactor: Tidy up direction handling chore: Fix flowchart arrow chore: Add test to verify activate chore: Update tests snapshot ...
2 parents d29ee25 + abcf2a2 commit 2024398

File tree

363 files changed

+16749
-8938
lines changed

Some content is hidden

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

363 files changed

+16749
-8938
lines changed

.eslintrc.cjs

+13
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@ module.exports = {
3838
'lodash',
3939
'unicorn',
4040
],
41+
ignorePatterns: [
42+
// this file is automatically generated by `pnpm run --filter mermaid types:build-config`
43+
'packages/mermaid/src/config.type.ts',
44+
],
4145
rules: {
4246
curly: 'error',
4347
'no-console': 'error',
4448
'no-prototype-builtins': 'off',
4549
'no-unused-vars': 'off',
4650
'cypress/no-async-tests': 'off',
51+
'@typescript-eslint/consistent-type-imports': 'error',
4752
'@typescript-eslint/no-floating-promises': 'error',
4853
'@typescript-eslint/no-misused-promises': 'error',
4954
'@typescript-eslint/ban-ts-comment': [
@@ -123,6 +128,14 @@ module.exports = {
123128
files: ['*.{ts,tsx}'],
124129
plugins: ['tsdoc'],
125130
rules: {
131+
'no-restricted-syntax': [
132+
'error',
133+
{
134+
selector: 'TSEnumDeclaration',
135+
message:
136+
'Prefer using TypeScript union types over TypeScript enum, since TypeScript enums have a bunch of issues, see https://dev.to/dvddpl/whats-the-problem-with-typescript-enums-2okj',
137+
},
138+
],
126139
'tsdoc/syntax': 'error',
127140
},
128141
},

.github/ISSUE_TEMPLATE/bug_report.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@ body:
5353
Please fill out the info below.
5454
Note that you only need to fill out the relevant section
5555
value: |-
56-
- Mermaid version:
56+
- Mermaid version:
5757
- Browser and Version: [Chrome, Edge, Firefox]
58+
- type: textarea
59+
attributes:
60+
label: Suggested Solutions
61+
description: >
62+
If applicable, suggest solutions that could resolve the bug.
63+
It would help maintainers/contributors to not waste time looking for the solution. Even pointing the line causing the bug would be great!
64+
placeholder: |-
65+
- Variable `parser` in file <filepath> is not initialised ...
66+
- Add a new type for ...
5867
- type: textarea
5968
attributes:
6069
label: Additional Context

.github/codecov.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
codecov:
2+
branch: develop
3+
4+
comment:
5+
layout: 'reach, diff, flags, files'
6+
behavior: default
7+
require_changes: false # if true: only post the comment if coverage changes
8+
require_base: no # [yes :: must have a base report to post]
9+
require_head: yes # [yes :: must have a head report to post]
10+
11+
coverage:
12+
status:
13+
project:
14+
off
15+
# Turing off for now as code coverage isn't stable and causes unnecessary build failures.
16+
# default:
17+
# threshold: 2%

.github/lychee.toml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
############################# Display #############################
2+
3+
# Verbose program output
4+
# Accepts log level: "error", "warn", "info", "debug", "trace"
5+
verbose = "debug"
6+
7+
# Don't show interactive progress bar while checking links.
8+
no_progress = true
9+
10+
############################# Cache ###############################
11+
12+
# Enable link caching. This can be helpful to avoid checking the same links on
13+
# multiple runs.
14+
cache = true
15+
16+
# Discard all cached requests older than this duration.
17+
max_cache_age = "1d"
18+
19+
############################# Requests ############################
20+
21+
# Comma-separated list of accepted status codes for valid links.
22+
accept = [200, 429]
23+
24+
############################# Exclusions ##########################
25+
26+
# Exclude URLs and mail addresses from checking (supports regex).
27+
exclude = [
28+
# Network error: Forbidden
29+
"https://codepen.io",
30+
31+
# Timeout error, maybe Twitter has anti-bot defenses against GitHub's CI servers?
32+
"https://twitter.com/mermaidjs_",
33+
34+
# Don't check files that are generated during the build via `pnpm docs:code`
35+
'packages/mermaid/src/docs/config/setup/*',
36+
37+
# Ignore slack invite
38+
"https://join.slack.com/"
39+
]
40+
41+
# Exclude all private IPs from checking.
42+
# Equivalent to setting `exclude_private`, `exclude_link_local`, and
43+
# `exclude_loopback` to true.
44+
exclude_all_private = true

.github/pr-labeler.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
'Type: Bug / Error': 'bug/*'
2-
'Type: Enhancement': 'feature/*'
3-
'Type: Other': 'other/*'
1+
'Type: Bug / Error': ['bug/*', fix/*]
2+
'Type: Enhancement': ['feature/*', 'feat/*']
3+
'Type: Other': ['other/*', 'chore/*', 'test/*', 'refactor/*']
4+
'Area: Documentation': ['docs/*']

.github/pull_request_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ Describe the way your implementation works or what design decisions you made if
1313
Make sure you
1414

1515
- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
16-
- [ ] :computer: have added unit/e2e tests (if appropriate)
17-
- [ ] :notebook: have added documentation (if appropriate)
16+
- [ ] :computer: have added necessary unit/e2e tests.
17+
- [ ] :notebook: have added documentation. Make sure [`MERMAID_RELEASE_VERSION`](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/docs/community/development.md#3-update-documentation) is used for all new features.
1818
- [ ] :bookmark: targeted `develop` branch

.github/release-drafter.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
name-template: '$NEXT_PATCH_VERSION'
22
tag-template: '$NEXT_PATCH_VERSION'
33
categories:
4+
- title: '🚨 **Breaking Changes**'
5+
labels:
6+
- 'Breaking Change'
47
- title: '🚀 Features'
58
labels:
69
- 'Type: Enhancement'
10+
- 'feature' # deprecated, new PRs shouldn't have this
711
- title: '🐛 Bug Fixes'
812
labels:
913
- 'Type: Bug / Error'
14+
- 'fix' # deprecated, new PRs shouldn't have this
1015
- title: '🧰 Maintenance'
11-
label: 'Type: Other'
16+
labels:
17+
- 'Type: Other'
18+
- 'chore' # deprecated, new PRs shouldn't have this
19+
- title: '⚡️ Performance'
20+
labels:
21+
- 'Type: Performance'
22+
- title: '📚 Documentation'
23+
labels:
24+
- 'Area: Documentation'
1225
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
1326
sort-by: title
1427
sort-direction: ascending

.github/workflows/build-docs.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
name: Build Vitepress docs
22

33
on:
4+
push:
5+
branches:
6+
- master
7+
- release/*
48
pull_request:
9+
merge_group:
510

611
permissions:
712
contents: read
813

914
jobs:
10-
# Build job
11-
build:
15+
build-docs:
1216
runs-on: ubuntu-latest
1317
steps:
1418
- name: Checkout
@@ -25,5 +29,9 @@ jobs:
2529
- name: Install Packages
2630
run: pnpm install --frozen-lockfile
2731

32+
- name: Verify release verion
33+
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release')) }}
34+
run: pnpm --filter mermaid run docs:verify-version
35+
2836
- name: Run Build
2937
run: pnpm --filter mermaid run docs:build:vitepress

.github/workflows/build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Build
22

33
on:
44
push: {}
5+
merge_group:
56
pull_request:
67
types:
78
- opened
@@ -12,7 +13,7 @@ permissions:
1213
contents: read
1314

1415
jobs:
15-
build:
16+
build-mermaid:
1617
runs-on: ubuntu-latest
1718
strategy:
1819
matrix:

.github/workflows/check-readme-in-sync.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
contents: read
1515

1616
jobs:
17-
check:
17+
check-readme:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout repository

.github/workflows/checks.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
on:
2-
push: {}
2+
push:
3+
merge_group:
34
pull_request:
45
types:
56
- opened
67
- synchronize
78
- ready_for_review
89

9-
name: Static analysis
10+
name: Static analysis on Test files
1011

1112
jobs:
12-
test:
13+
check-tests:
1314
runs-on: ubuntu-latest
1415
name: check tests
1516
if: github.repository_owner == 'mermaid-js'

.github/workflows/e2e-applitools.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
2020

2121
jobs:
22-
test:
22+
e2e-applitools:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:

.github/workflows/e2e.yml

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
name: E2E
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
47

58
permissions:
69
contents: read
710

811
jobs:
9-
build:
12+
e2e:
1013
runs-on: ubuntu-latest
1114
strategy:
1215
fail-fast: false
@@ -33,15 +36,27 @@ jobs:
3336
# Otherwise (e.g. if running from fork), we run on a single container only
3437
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
3538
with:
36-
start: pnpm run dev
39+
start: pnpm run dev:coverage
3740
wait-on: 'http://localhost:9000'
3841
# Disable recording if we don't have an API key
3942
# e.g. if this action was run from a fork
4043
record: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
4144
parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
4245
env:
4346
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
44-
47+
VITEST_COVERAGE: true
48+
CYPRESS_COMMIT: ${{ github.sha }}
49+
- name: Upload Coverage to Codecov
50+
uses: codecov/codecov-action@v3
51+
# Run step only pushes to develop and pull_requests
52+
if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
53+
with:
54+
files: coverage/cypress/lcov.info
55+
flags: e2e
56+
name: mermaid-codecov
57+
fail_ci_if_error: false
58+
verbose: true
59+
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
4560
- name: Upload Artifacts
4661
uses: actions/upload-artifact@v3
4762
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}

.github/workflows/link-checker.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
- cron: '30 8 * * *'
2121

2222
jobs:
23-
linkChecker:
23+
link-checker:
2424
runs-on: ubuntu-latest
2525
permissions:
2626
# lychee only uses the GITHUB_TOKEN to avoid rate-limiting
@@ -39,10 +39,7 @@ jobs:
3939
uses: lycheeverse/lychee-action@v1.8.0
4040
with:
4141
args: >-
42-
--verbose
43-
--no-progress
44-
--cache
45-
--max-cache-age 1d
42+
--config .github/lychee.toml
4643
packages/mermaid/src/docs/**/*.md
4744
README.md
4845
README.zh-CN.md

.github/workflows/lint.yml

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Lint
22

33
on:
4-
push: {}
4+
push:
5+
merge_group:
56
pull_request:
67
types:
78
- opened
@@ -52,6 +53,33 @@ jobs:
5253
exit 1
5354
fi
5455
56+
- name: Verify `./src/config.type.ts` is in sync with `./src/schemas/config.schema.yaml`
57+
shell: bash
58+
run: |
59+
if ! pnpm run --filter mermaid types:verify-config; then
60+
ERROR_MESSAGE='Running `pnpm run --filter mermaid types:verify-config` failed.'
61+
ERROR_MESSAGE+=' This should be fixed by running'
62+
ERROR_MESSAGE+=' `pnpm run --filter mermaid types:build-config`'
63+
ERROR_MESSAGE+=' on your local machine.'
64+
echo "::error title=Lint failure::${ERROR_MESSAGE}"
65+
# make sure to return an error exitcode so that GitHub actions shows a red-cross
66+
exit 1
67+
fi
68+
69+
- name: Verify no circular dependencies
70+
working-directory: ./packages/mermaid
71+
shell: bash
72+
run: |
73+
if ! pnpm run --filter mermaid checkCircle; then
74+
ERROR_MESSAGE='Circular dependency detected.'
75+
ERROR_MESSAGE+=' This should be fixed by removing the circular dependency.'
76+
ERROR_MESSAGE+=' Run `pnpm run --filter mermaid checkCircle` on your local machine'
77+
ERROR_MESSAGE+=' to see the circular dependency.'
78+
echo "::error title=Lint failure::${ERROR_MESSAGE}"
79+
# make sure to return an error exitcode so that GitHub actions shows a red-cross
80+
exit 1
81+
fi
82+
5583
- name: Verify Docs
5684
id: verifyDocs
5785
working-directory: ./packages/mermaid

.github/workflows/pr-labeler-config-validator.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: Validate PR Labeler Configuration
22
on:
3-
push: {}
3+
push:
4+
paths:
5+
- .github/workflows/pr-labeler-config-validator.yml
6+
- .github/workflows/pr-labeler.yml
7+
- .github/pr-labeler.yml
48
pull_request:
5-
types:
6-
- opened
7-
- synchronize
8-
- ready_for_review
9+
paths:
10+
- .github/workflows/pr-labeler-config-validator.yml
11+
- .github/workflows/pr-labeler.yml
12+
- .github/pr-labeler.yml
913

1014
jobs:
1115
pr-labeler:

0 commit comments

Comments
 (0)