Skip to content

Commit a3dd0e5

Browse files
authored
Merge pull request #4 from mermaid-js/develop
Merge from main
2 parents 4ff5c3b + 93c32d3 commit a3dd0e5

Some content is hidden

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

41 files changed

+671
-106
lines changed

.github/pr-labeler.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'Type: Bug / Error': 'bug/*'
2+
'Type: Enhancement': 'feature/*'
3+
'Type: Other': 'other/*'

.github/release-drafter.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name-template: '$NEXT_PATCH_VERSION'
2+
tag-template: '$NEXT_PATCH_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'Type: Enhancement'
7+
- title: '🐛 Bug Fixes'
8+
labels:
9+
- 'Type: Bug / Error'
10+
- title: '🧰 Maintenance'
11+
label: 'Type: Other'
12+
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
13+
branches:
14+
- develop
15+
no-changes-template: 'This release contains minor changes and bugfixes.'
16+
template: |
17+
# Release Notes
18+
19+
$CHANGES
20+
21+
🎉 **Thanks to all contributors helping with this release!** 🎉

.github/workflows/pr-labeler.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Apply labels to PR
2+
on:
3+
pull_request:
4+
types: [opened]
5+
6+
jobs:
7+
pr-labeler:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Label PR
11+
uses: TimonVS/pr-labeler-action@v3
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-draft.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Draft Release
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
draft-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Draft Release
13+
uses: toolmantim/release-drafter@v5.2.0
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-preview-publish.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,20 @@ on:
88
jobs:
99
publish:
1010
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
node-version: [10.x]
1411
steps:
1512
- uses: actions/checkout@v1
16-
- name: Setup Node.js ${{ matrix.node-version }}
13+
- name: Setup Node.js
1714
uses: actions/setup-node@v1
1815
with:
19-
node-version: ${{ matrix.node-version }}
16+
node-version: 10.x
2017
- name: Install Yarn
2118
run: npm i yarn --global
2219

2320
- name: Install Json
2421
run: npm i json --global
2522

2623
- name: Install Packages
27-
run: yarn install
24+
run: yarn install --frozen-lockfile
2825

2926
- name: Publish
3027
run: |

.github/workflows/release-publish.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: fregante/setup-git-token@v1
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 10.x
20+
- name: Install Yarn
21+
run: npm i yarn --global
22+
23+
- name: Install Json
24+
run: npm i json --global
25+
26+
- name: Install Packages
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Prepare release
30+
run: |
31+
VERSION=${GITHUB_REF:10}
32+
echo "Preparing release $VERSION"
33+
git checkout -t origin/release/$VERSION
34+
npm version --no-git-tag-version --allow-same-version $VERSION
35+
git add package.json
36+
git commit -m "Bump version $VERSION"
37+
git checkout -t origin/master
38+
git merge -m "Release $VERSION" --no-ff release/$VERSION
39+
git push --no-verify
40+
41+
- name: Publish
42+
run: |
43+
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
44+
npm publish
45+
env:
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.vscode/settings.json

-8
This file was deleted.

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ C -->|One| D[Result 1]
2727
C -->|Two| E[Result 2]
2828
</pre></td>
2929
<td align="center">
30-
<img src="./img/gray-flow.png" />
30+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-flow.png" />
3131
</td>
3232
</tr>
3333
<!-- </Flowchart> -->
@@ -49,7 +49,7 @@ John->>Bob: How about you?
4949
Bob-->>John: Jolly good!
5050
</pre></td>
5151
<td align="center">
52-
<img src="./img/gray-sequence.png" />
52+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-sequence.png" />
5353
</td>
5454
</tr>
5555
<!-- </Sequence> -->
@@ -70,7 +70,7 @@ Parallel 3 : des5, after des3, 1d
7070
Parallel 4 : des6, after des4, 1d
7171
</pre></td>
7272
<td align="center">
73-
<img src="./img/gray-gantt.png" />
73+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-gantt.png" />
7474
</td>
7575
</tr>
7676
<!-- </Gantt> -->
@@ -99,7 +99,7 @@ class Class10 {
9999
}
100100
</pre></td>
101101
<td align="center">
102-
<img src="./img/gray-class.png" />
102+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-class.png" />
103103
</td>
104104
</tr>
105105
<!-- </Class> -->
@@ -119,7 +119,7 @@ Moving --> Crash
119119
Crash --> [*]
120120
</pre></td>
121121
<td align="center">
122-
<img src="./img/gray-state.png" />
122+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-state.png" />
123123
</td>
124124
</tr>
125125
<!-- </State> -->
@@ -136,7 +136,7 @@ pie
136136
"Rats" : 15
137137
</pre></td>
138138
<td align="center">
139-
<img src="./img/gray-pie.png" />
139+
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-pie.png" />
140140
</td>
141141
</tr>
142142
<!-- </Pie> -->

babel.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module.exports = {
33
[
44
'@babel/preset-env',
55
{
6-
targets: {
7-
node: 'current'
8-
}
6+
targets: "defaults, ie >= 11, current node"
97
}
108
]
119
]

cypress/integration/rendering/classDiagram.spec.js

+33-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { imgSnapshotTest } from '../../helpers/util';
33

44
describe('Class diagram', () => {
5-
it('should render a simple class diagram', () => {
5+
it('1: should render a simple class diagram', () => {
66
imgSnapshotTest(
77
`
88
classDiagram
@@ -33,7 +33,8 @@ describe('Class diagram', () => {
3333
);
3434
cy.get('svg');
3535
});
36-
it('should render a simple class diagrams with cardinality', () => {
36+
37+
it('2: should render a simple class diagrams with cardinality', () => {
3738
imgSnapshotTest(
3839
`
3940
classDiagram
@@ -132,4 +133,34 @@ describe('Class diagram', () => {
132133
);
133134
cy.get('svg');
134135
});
136+
137+
it('4: should render a simple class diagram with comments', () => {
138+
imgSnapshotTest(
139+
`
140+
classDiagram
141+
%% this is a comment
142+
Class01 <|-- AveryLongClass : Cool
143+
&lt;&lt;interface&gt;&gt; Class01
144+
Class03 *-- Class04
145+
Class05 o-- Class06
146+
Class07 .. Class08
147+
Class09 --> C2 : Where am i?
148+
Class09 --* C3
149+
Class09 --|> Class07
150+
Class07 : equals()
151+
Class07 : Object[] elementData
152+
Class01 : size()
153+
Class01 : int chimp
154+
Class01 : int gorilla
155+
Class08 <--> C2: Cool label
156+
class Class10 {
157+
&lt;&lt;service&gt;&gt;
158+
int id
159+
test()
160+
}
161+
`,
162+
{}
163+
);
164+
cy.get('svg');
165+
});
135166
});

cypress/integration/rendering/flowchart.spec.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('Flowcart', () => {
1414
{ flowchart: { htmlLabels: false } }
1515
);
1616
});
17+
1718
it('2: should render a simple flowchart with htmlLabels', () => {
1819
imgSnapshotTest(
1920
`graph TD
@@ -26,6 +27,7 @@ describe('Flowcart', () => {
2627
{ flowchart: { htmlLabels: true } }
2728
);
2829
});
30+
2931
it('3: should render a simple flowchart with line breaks', () => {
3032
imgSnapshotTest(
3133
`
@@ -99,6 +101,7 @@ describe('Flowcart', () => {
99101
{}
100102
);
101103
});
104+
102105
it('6: should render a flowchart full of icons', () => {
103106
imgSnapshotTest(
104107
`
@@ -178,6 +181,7 @@ describe('Flowcart', () => {
178181
{}
179182
);
180183
});
184+
181185
it('8: should render subgraphs', () => {
182186
imgSnapshotTest(
183187
`
@@ -190,7 +194,7 @@ describe('Flowcart', () => {
190194
);
191195
});
192196

193-
it('9: should render subgraphs with a title startign with a digit', () => {
197+
it('9: should render subgraphs with a title starting with a digit', () => {
194198
imgSnapshotTest(
195199
`
196200
graph TB
@@ -237,7 +241,7 @@ describe('Flowcart', () => {
237241
);
238242
});
239243

240-
it('11: should render a flowchart with ling sames and class definitoins', () => {
244+
it('11: should render a flowchart with long names and class definitions', () => {
241245
imgSnapshotTest(
242246
`graph LR
243247
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
@@ -356,6 +360,7 @@ describe('Flowcart', () => {
356360
}
357361
);
358362
});
363+
359364
it('13: should render hexagons', () => {
360365
imgSnapshotTest(
361366
`
@@ -377,4 +382,18 @@ describe('Flowcart', () => {
377382
}
378383
);
379384
});
385+
386+
it('14: should render a simple flowchart with comments', () => {
387+
imgSnapshotTest(
388+
`graph TD
389+
A[Christmas] -->|Get money| B(Go shopping)
390+
B --> C{Let me think}
391+
%% this is a comment
392+
C -->|One| D[Laptop]
393+
C -->|Two| E[iPhone]
394+
C -->|Three| F[fa:fa-car Car]
395+
`,
396+
{ flowchart: { htmlLabels: false } }
397+
);
398+
});
380399
});

cypress/platform/current.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<html>
2+
<head>
3+
<link
4+
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
5+
rel="stylesheet"
6+
/>
7+
8+
</head>
9+
<body>
10+
<h1>info below</h1>
11+
<div class="mermaid">graph TB
12+
a --> b
13+
a --> c
14+
a --> d
15+
</div>
16+
<script src="./mermaid.js"></script>
17+
<script>
18+
mermaid.initialize({
19+
theme: 'forest',
20+
// arrowMarkerAbsolute: true,
21+
// themeCSS: '.node rect { fill: red; }',
22+
logLevel: 3,
23+
flowchart: { curve: 'linear' },
24+
gantt: { axisFormat: '%m/%d/%Y' },
25+
sequence: { actorMargin: 50 },
26+
// sequenceDiagram: { actorMargin: 300 } // deprecated
27+
});
28+
</script>
29+
</script>
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)