Skip to content

Commit

Permalink
Merge branch 'develop' into fix/3706_support-indented-yaml-only-in-html
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisklink committed Dec 22, 2022
2 parents accba3f + 03c5bc1 commit a58b41a
Show file tree
Hide file tree
Showing 115 changed files with 3,187 additions and 2,368 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Make sure you

- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
- [ ] :computer: have added unit/e2e tests (if appropriate)
- [ ] :notebook: have added documentation (if appropriate)
- [ ] :bookmark: targeted `develop` branch
17 changes: 16 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ on:
- opened
- synchronize
- ready_for_review
workflow_dispatch:

permissions:
contents: read
contents: write

jobs:
lint:
Expand Down Expand Up @@ -39,5 +40,19 @@ jobs:
run: pnpm run lint

- name: Verify Docs
id: verifyDocs
working-directory: ./packages/mermaid
continue-on-error: ${{ github.event_name == 'push' }}
run: pnpm run docs:verify

- name: Rebuild Docs
if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
working-directory: ./packages/mermaid
run: pnpm run docs:build

- name: Commit changes
uses: EndBug/add-and-commit@v9
if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
with:
message: 'Update docs'
add: 'docs/*'
20 changes: 14 additions & 6 deletions .github/workflows/release-preview-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 18.x
- name: Install Yarn
run: npm i yarn --global

- name: Install Packages
run: |
pnpm install --frozen-lockfile
env:
CYPRESS_CACHE_FOLDER: .cache/Cypress

- name: Install Json
run: npm i json --global

- name: Install Packages
run: yarn install --frozen-lockfile

- name: Publish
working-directory: ./packages/mermaid
run: |
PREVIEW_VERSION=8
PREVIEW_VERSION=$(git log --oneline "origin/$GITHUB_REF_NAME" ^"origin/master" | wc -l)
VERSION=$(echo ${{github.ref}} | tail -c +20)-preview.$PREVIEW_VERSION
echo $VERSION
npm version --no-git-tag-version --allow-same-version $VERSION
Expand Down
2 changes: 1 addition & 1 deletion .vite/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const main = async () => {
};

if (watch) {
build(getBuildConfig({ minify: false, watch, core: true, entryName: 'mermaid' }));
build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' }));
if (!mermaidOnly) {
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
// build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ English | [简体中文](./README.zh-CN.md)

**Thanks to all involved, people committing pull requests, people answering questions! 🙏**

<a href="https://mermaid-js.github.io/mermaid/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/img/book-banner-post-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>
<a href="https://mermaid-js.github.io/mermaid/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>

## About

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

**感谢所有参与进来提交 PR,解答疑问的人们! 🙏**

<a href="https://mermaid-js.github.io/mermaid/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/img/book-banner-pre-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>
<a href="https://mermaid-js.github.io/mermaid/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>

## 关于 Mermaid

Expand Down
21 changes: 21 additions & 0 deletions __mocks__/c4Renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Mocked C4Context diagram renderer
*/

import { vi } from 'vitest';

export const drawPersonOrSystemArray = vi.fn();
export const drawBoundary = vi.fn();

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
drawPersonOrSystemArray,
drawBoundary,
setConf,
draw,
};
16 changes: 16 additions & 0 deletions __mocks__/classRenderer-v2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Mocked class diagram v2 renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/classRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Mocked class diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
71 changes: 3 additions & 68 deletions __mocks__/d3.ts
Original file line number Diff line number Diff line change
@@ -1,79 +1,14 @@
// @ts-nocheck TODO: Fix TS
import { vi } from 'vitest';

const NewD3 = function () {
/**
*
*/
function returnThis() {
return this;
}
return {
append: function () {
return NewD3();
},
lower: returnThis,
attr: returnThis,
style: returnThis,
text: returnThis,
0: {
0: {
getBBox: function () {
return {
height: 10,
width: 20,
};
},
},
},
};
};
import { MockedD3 } from '../packages/mermaid/src/tests/MockedD3';

export const select = function () {
return new NewD3();
return new MockedD3();
};

export const selectAll = function () {
return new NewD3();
return new MockedD3();
};

export const curveBasis = 'basis';
export const curveLinear = 'linear';
export const curveCardinal = 'cardinal';

export const MockD3 = (name, parent) => {
const children = [];
const elem = {
get __children() {
return children;
},
get __name() {
return name;
},
get __parent() {
return parent;
},
node() {
return {
getBBox() {
return {
x: 5,
y: 10,
height: 15,
width: 20,
};
},
};
},
};
elem.append = (name) => {
const mockElem = MockD3(name, elem);
children.push(mockElem);
return mockElem;
};
elem.lower = vi.fn(() => elem);
elem.attr = vi.fn(() => elem);
elem.text = vi.fn(() => elem);
elem.style = vi.fn(() => elem);
return elem;
};
16 changes: 16 additions & 0 deletions __mocks__/erRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Mocked er diagram renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
24 changes: 24 additions & 0 deletions __mocks__/flowRenderer-v2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Mocked flow (flowchart) diagram v2 renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();
export const addVertices = vi.fn();
export const addEdges = vi.fn();
export const getClasses = vi.fn().mockImplementation(() => {
return {};
});

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
addVertices,
addEdges,
getClasses,
draw,
};
16 changes: 16 additions & 0 deletions __mocks__/ganttRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Mocked gantt diagram renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/gitGraphRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Mocked git (graph) diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
15 changes: 15 additions & 0 deletions __mocks__/journeyRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Mocked pie (picChart) diagram renderer
*/

import { vi } from 'vitest';
export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/pieRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Mocked pie (picChart) diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/requirementRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Mocked requirement diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
23 changes: 23 additions & 0 deletions __mocks__/sequenceRenderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Mocked sequence diagram renderer
*/

import { vi } from 'vitest';

export const bounds = vi.fn();
export const drawActors = vi.fn();
export const drawActorsPopup = vi.fn();

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
bounds,
drawActors,
drawActorsPopup,
setConf,
draw,
};
Loading

0 comments on commit a58b41a

Please sign in to comment.