Skip to content

Commit 87b0025

Browse files
committed
Merge branch 'develop' into sidv/tinyMermaid
* develop: (189 commits) Remove unnecessary tests Remove optional chaining chore: Update docs refactor: Use `||` instead of `??` Update flowchart.md (#4798) Update flowchart.md (#4792) core: Adapt changes from 3f7bafb Update cypress/helpers/util.js chore: Update docs chore: Add deprecation notices, improve types chore: Cleanup gitGraph tests chore: Fix unit tests chore(deps): update all patch dependencies chore: Update docs Update docs New Mermaid Live Editor for Confluence Cloud (#4814) Update link to Discourse theme component (#4811) Update flowchart.md (#4810) chore: remove unneeded `CommomDB` chore: Update docs ...
2 parents e32747d + 00d06c7 commit 87b0025

File tree

202 files changed

+5053
-4060
lines changed

Some content is hidden

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

202 files changed

+5053
-4060
lines changed

.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module.exports = {
4848
'no-prototype-builtins': 'off',
4949
'no-unused-vars': 'off',
5050
'cypress/no-async-tests': 'off',
51+
'@typescript-eslint/consistent-type-imports': 'error',
5152
'@typescript-eslint/no-floating-promises': 'error',
5253
'@typescript-eslint/no-misused-promises': 'error',
5354
'@typescript-eslint/ban-ts-comment': [

.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/lint.yml

+16-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,22 @@ jobs:
6262
ERROR_MESSAGE+=' `pnpm run --filter mermaid types:build-config`'
6363
ERROR_MESSAGE+=' on your local machine.'
6464
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
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
6781
fi
6882
6983
- name: Verify Docs

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Documentation is necessary for all non bugfix/refactoring changes.
7171

7272
Only make changes to files that are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
7373

74-
**_DO NOT CHANGE FILES IN `/docs`_**
74+
**_DO NOT CHANGE FILES IN `/docs` MANUALLY_**
75+
76+
The `/docs` folder will be rebuilt and committed as part of a pre-commit hook.
7577

7678
[Join our slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)

README.md

+3-15
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Use Mermaid with your favorite applications, check out the list of [Integrations
6060

6161
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations.md).
6262

63-
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/community/n00b-overview.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
63+
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/intro/getting-started.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
6464

6565
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
6666

@@ -165,13 +165,7 @@ class Class10 {
165165
int id
166166
size()
167167
}
168-
namespace Namespace01 {
169-
class Class11
170-
class Class12 {
171-
int id
172-
size()
173-
}
174-
}
168+
175169
```
176170

177171
```mermaid
@@ -191,13 +185,7 @@ class Class10 {
191185
int id
192186
size()
193187
}
194-
namespace Namespace01 {
195-
class Class11
196-
class Class12 {
197-
int id
198-
size()
199-
}
200-
}
188+
201189
```
202190

203191
### State diagram [<a href="https://mermaid-js.github.io/mermaid/#/stateDiagram">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkEFvgzAMhf8K8nEqpYSNthx22Xbcqcexg0sCiZQQlDhIFeK_L8A6TfXp6fOz9ewJGssFVOAJSbwr7ByadGR1n8T6evpO0vQ1uZDSekOrXGFsPqJPO6q-2-imH8f_0TeHXm50lfelsAMjnEHFY6xpMdRAUhhRQxUlFy0GTTXU_RytYeAx-AdXZB1ULWovdoCB7OXWN1CRC-Ju-r3uz6UtchGHJqDbsPygU57iysb2reoWHpyOWBINvsqypb3vFMlw3TfWZF5xiY7keC6zkpUnZIUojwW-FAVvrvn51LLnvOXHQ84Q5nn-AVtLcwk">live editor</a>]

README.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Mermaid 通过允许用户创建便于修改的图表来解决这一难题,它
5555
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
5656
你可以访问 [教程](./docs/config/Tutorials.md) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](./docs/ecosystem/integrations.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
5757

58-
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/community/n00b-overview.md), [用法](./docs/config/usage.md)[教程](./docs/config/Tutorials.md).
58+
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/intro/getting-started.md), [用法](./docs/config/usage.md)[教程](./docs/config/Tutorials.md).
5959

6060
<!-- </Main description> -->
6161

__mocks__/pieRenderer.js

-13
This file was deleted.

__mocks__/pieRenderer.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Mocked pie (picChart) diagram renderer
3+
*/
4+
import { vi } from 'vitest';
5+
6+
const draw = vi.fn().mockImplementation(() => '');
7+
8+
export const renderer = { draw };

cSpell.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@
3838
"docsy",
3939
"doku",
4040
"dompurify",
41+
"dont",
42+
"doublecircle",
4143
"edgechromium",
44+
"elems",
4245
"elkjs",
4346
"elle",
4447
"faber",
4548
"flatmap",
4649
"foswiki",
50+
"frontmatter",
4751
"ftplugin",
4852
"gantt",
4953
"gitea",
@@ -93,6 +97,7 @@
9397
"nextra",
9498
"nikolay",
9599
"nirname",
100+
"npmjs",
96101
"orlandoni",
97102
"outdir",
98103
"pathe",
@@ -109,6 +114,7 @@
109114
"rects",
110115
"reda",
111116
"redmine",
117+
"regexes",
112118
"rehype",
113119
"roledescription",
114120
"rozhkov",
@@ -154,7 +160,8 @@
154160
"xlink",
155161
"yash",
156162
"yokozuna",
157-
"zenuml"
163+
"zenuml",
164+
"zune"
158165
],
159166
"patterns": [
160167
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },

cypress/helpers/util.ts

+21-26
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const utf8ToB64 = (str: string): string => {
1818
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
1919
};
2020

21-
const batchId: string = 'mermaid-batch-' + Cypress.env('CYPRESS_COMMIT') || Date.now().toString();
21+
const batchId: string =
22+
'mermaid-batch-' +
23+
(Cypress.env('useAppli')
24+
? Date.now().toString()
25+
: Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
2226

2327
export const mermaidUrl = (
2428
graphStr: string,
@@ -48,41 +52,32 @@ export const imgSnapshotTest = (
4852
api = false,
4953
validation?: any
5054
): void => {
51-
cy.log(JSON.stringify(_options));
52-
const options: CypressMermaidConfig = Object.assign(_options);
53-
if (!options.fontFamily) {
54-
options.fontFamily = 'courier';
55-
}
56-
if (!options.sequence) {
57-
options.sequence = {};
58-
}
59-
if (!options.sequence || (options.sequence && !options.sequence.actorFontFamily)) {
60-
options.sequence.actorFontFamily = 'courier';
61-
}
62-
if (options.sequence && !options.sequence.noteFontFamily) {
63-
options.sequence.noteFontFamily = 'courier';
64-
}
65-
options.sequence.actorFontFamily = 'courier';
66-
options.sequence.noteFontFamily = 'courier';
67-
options.sequence.messageFontFamily = 'courier';
68-
if (options.sequence && !options.sequence.actorFontFamily) {
69-
options.sequence.actorFontFamily = 'courier';
70-
}
71-
if (!options.fontSize) {
72-
options.fontSize = 16;
73-
}
55+
const options: CypressMermaidConfig = {
56+
..._options,
57+
fontFamily: _options.fontFamily || 'courier',
58+
// @ts-ignore TODO: Fix type of fontSize
59+
fontSize: _options.fontSize || '16px',
60+
sequence: {
61+
...(_options.sequence || {}),
62+
actorFontFamily: 'courier',
63+
noteFontFamily:
64+
_options.sequence && _options.sequence.noteFontFamily
65+
? _options.sequence.noteFontFamily
66+
: 'courier',
67+
messageFontFamily: 'courier',
68+
},
69+
};
7470

7571
const url: string = mermaidUrl(graphStr, options, api);
7672
openURLAndVerifyRendering(url, options, validation);
7773
};
7874

7975
export const urlSnapshotTest = (
8076
url: string,
81-
_options: CypressMermaidConfig,
77+
options: CypressMermaidConfig,
8278
_api = false,
8379
validation?: any
8480
): void => {
85-
const options: CypressMermaidConfig = Object.assign(_options);
8681
openURLAndVerifyRendering(url, options, validation);
8782
};
8883

cypress/integration/rendering/classDiagram-v2.spec.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,11 @@ describe('Class diagram V2', () => {
386386
{ logLevel: 1, flowchart: { htmlLabels: false } }
387387
);
388388
});
389-
390-
it('18: should handle the direction statement with LR', () => {
389+
it('17a: should handle the direction statement with BT', () => {
391390
imgSnapshotTest(
392391
`
393392
classDiagram
394-
direction LR
393+
direction BT
395394
class Student {
396395
-idCard : IdCard
397396
}
@@ -410,11 +409,11 @@ describe('Class diagram V2', () => {
410409
{ logLevel: 1, flowchart: { htmlLabels: false } }
411410
);
412411
});
413-
it('17a: should handle the direction statement with BT', () => {
412+
it('17b: should handle the direction statement with RL', () => {
414413
imgSnapshotTest(
415414
`
416415
classDiagram
417-
direction BT
416+
direction RL
418417
class Student {
419418
-idCard : IdCard
420419
}
@@ -433,11 +432,12 @@ describe('Class diagram V2', () => {
433432
{ logLevel: 1, flowchart: { htmlLabels: false } }
434433
);
435434
});
436-
it('17b: should handle the direction statement with RL', () => {
435+
436+
it('18a: should handle the direction statement with LR', () => {
437437
imgSnapshotTest(
438438
`
439439
classDiagram
440-
direction RL
440+
direction LR
441441
class Student {
442442
-idCard : IdCard
443443
}
@@ -457,7 +457,7 @@ describe('Class diagram V2', () => {
457457
);
458458
});
459459

460-
it('18: should render a simple class diagram with notes', () => {
460+
it('18b: should render a simple class diagram with notes', () => {
461461
imgSnapshotTest(
462462
`
463463
classDiagram-v2
@@ -562,4 +562,13 @@ class C13["With Città foreign language"]
562562
`
563563
);
564564
});
565+
it('should render a simple class diagram with no members', () => {
566+
imgSnapshotTest(
567+
`
568+
classDiagram-v2
569+
class Class10
570+
`,
571+
{ logLevel: 1, flowchart: { htmlLabels: false } }
572+
);
573+
});
565574
});

0 commit comments

Comments
 (0)