Skip to content

Commit

Permalink
merge MERMAID/develop into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
weedySeaDragon committed Oct 25, 2022
2 parents 589dd70 + 10ba3b6 commit 599d035
Show file tree
Hide file tree
Showing 107 changed files with 4,502 additions and 3,840 deletions.
54 changes: 41 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,17 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended",
"plugin:json/recommended",
"plugin:markdown/recommended",
"plugin:@cspell/recommended",
"prettier"
],
"plugins": ["@typescript-eslint", "html", "jest", "jsdoc", "json"],
"plugins": ["@typescript-eslint", "no-only-tests", "html", "jest", "jsdoc", "json", "@cspell"],
"rules": {
"curly": "error",
"no-console": "error",
"no-prototype-builtins": "off",
"no-unused-vars": "off",
"jsdoc/check-indentation": "off",
"jsdoc/check-alignment": "off",
"jsdoc/check-line-alignment": "off",
"jsdoc/multiline-blocks": "off",
"jsdoc/newline-after-description": "off",
"jsdoc/tag-lines": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off",
"cypress/no-async-tests": "off",
"@typescript-eslint/ban-ts-comment": [
"error",
Expand All @@ -48,7 +39,21 @@
}
],
"json/*": ["error", "allowComments"],
"no-empty": ["error", { "allowEmptyCatch": true }]
"@cspell/spellchecker": [
"error",
{
"checkIdentifiers": false,
"checkStrings": false,
"checkStringTemplates": false
}
],
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-only-tests/no-only-tests": "error"
},
"overrides": [
{
Expand All @@ -57,6 +62,29 @@
"no-console": "off"
}
},
{
"files": ["*.{js,jsx,mjs,cjs}"],
"extends": ["plugin:jsdoc/recommended"],
"rules": {
"jsdoc/check-indentation": "off",
"jsdoc/check-alignment": "off",
"jsdoc/check-line-alignment": "off",
"jsdoc/multiline-blocks": "off",
"jsdoc/newline-after-description": "off",
"jsdoc/tag-lines": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off"
}
},
{
"files": ["*.{ts,tsx}"],
"plugins": ["tsdoc"],
"rules": {
"tsdoc/syntax": "error"
}
},
{
"files": ["*.spec.{ts,js}", "cypress/**", "demos/**", "**/docs/**"],
"rules": {
Expand Down
18 changes: 0 additions & 18 deletions .github/dependabot.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
name: 'Docs: Spellcheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Check out the code
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
name: Setup node
with:
node-version: '16'
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
11 changes: 10 additions & 1 deletion .vite/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import express from 'express';
import express, { NextFunction, Request, Response } from 'express';
import { createServer as createViteServer } from 'vite';
// import { getBuildConfig } from './build';

const cors = (req: Request, res: Response, next: NextFunction) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type');

next();
};

async function createServer() {
const app = express();

Expand All @@ -12,6 +20,7 @@ async function createServer() {
appType: 'custom', // don't include Vite's default HTML handling middlewares
});

app.use(cors);
app.use(express.static('./packages/mermaid/dist'));
app.use(express.static('./packages/mermaid-example-diagram/dist'));
app.use(express.static('./packages/mermaid-mindmap/dist'));
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Class01 <|-- AveryLongClass : Cool
Class09 --> C2 : Where am I?
Class09 --* C3
Class09 --|> Class07
note "I love this diagram!\nDo you love it?"
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Expand All @@ -174,6 +175,7 @@ class Class10 {
int id
size()
}
note for Class10 "Cool class\nI said it's very cool class!"
```

### 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>]
Expand Down
29 changes: 27 additions & 2 deletions cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"sandboxed",
"Sveidqvist",
"verdana",
"Visio"
"Visio",
"mermiad"
],
"ignoreWords": [
"Adamiecki",
Expand All @@ -38,7 +39,31 @@
"Podlite",
"redmine",
"sphinxcontrib",
"Tuleap"
"Tuleap",
"dagre",
"vitepress",
"docsify",
"colour",
"graphlib",
"acyclicer",
"ranksep",
"descr",
"substate",
"Ashish",
"bbox",
"techn",
"cytoscape",
"Lucida",
"Bilkent",
"cpettitt",
"antiscript",
"ts-nocheck",
"setupGraphViewbox",
"flatmap",
"Kaufmann",
"viewports",
"edgechromium",
"statediagram"
],
"patterns": [
{
Expand Down
9 changes: 6 additions & 3 deletions cypress/helpers/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const imgSnapshotTest = (graphStr, _options, api = false, validation) =>
options.fontSize = '16px';
}
const useAppli = Cypress.env('useAppli');
//const useAppli = false;
cy.log('Hello ' + useAppli ? 'Appli' : 'image-snapshot');
const name = (options.name || cy.state('runnable').fullTitle()).replace(/\s+/g, '-');

Expand All @@ -59,7 +58,9 @@ export const imgSnapshotTest = (graphStr, _options, api = false, validation) =>
const url = mermaidUrl(graphStr, options, api);

cy.visit(url);
if (validation) cy.get('svg').should(validation);
if (validation) {
cy.get('svg').should(validation);
}
cy.get('svg');
// Default name to test title

Expand Down Expand Up @@ -107,7 +108,9 @@ export const urlSnapshotTest = (url, _options, api = false, validation) => {
}

cy.visit(url);
if (validation) cy.get('svg').should(validation);
if (validation) {
cy.get('svg').should(validation);
}
cy.get('body');
// Default name to test title

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/rendering/appli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Git Graph diagram', () => {
// // Call Open on eyes to initialize a test session
// cy.eyesOpen({
// appName: 'Demo App',
// testName: 'Ultrafast grid demo',
// testName: 'UltraFast grid demo',
// });

// // check the login page with fluent api, see more info here
Expand Down
18 changes: 18 additions & 0 deletions cypress/integration/rendering/classDiagram-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,22 @@ describe('Class diagram V2', () => {
);
cy.get('svg');
});

it('18: should render a simple class diagram with notes', () => {
imgSnapshotTest(
`
classDiagram-v2
note "I love this diagram!\nDo you love it?"
class Class10 {
<<service>>
int id
size()
}
note for Class10 "Cool class\nI said it's very cool class!"
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
});
17 changes: 17 additions & 0 deletions cypress/integration/rendering/classDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,21 @@ describe('Class diagram', () => {
// // expect(svg).to.not.have.attr('style');
// });
// });

it('19: should render a simple class diagram with notes', () => {
imgSnapshotTest(
`
classDiagram
note "I love this diagram!\nDo you love it?"
class Class10 {
<<service>>
int id
size()
}
note for Class10 "Cool class\nI said it's very cool class!"
`,
{ logLevel: 1 }
);
cy.get('svg');
});
});
20 changes: 19 additions & 1 deletion cypress/integration/rendering/erDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('Entity Relationship Diagram', () => {
cy.get('svg');
});

it.only('should render entities with generic and array attributes', () => {
it('should render entities with generic and array attributes', () => {
renderGraph(
`
erDiagram
Expand Down Expand Up @@ -255,4 +255,22 @@ describe('Entity Relationship Diagram', () => {
);
cy.get('svg');
});

it('should render entities with aliases', () => {
renderGraph(
`
erDiagram
T1 one or zero to one or more T2 : test
T2 one or many optionally to zero or one T3 : test
T3 zero or more to zero or many T4 : test
T4 many(0) to many(1) T5 : test
T5 many optionally to one T6 : test
T6 only one optionally to only one T1 : test
T4 0+ to 1+ T6 : test
T1 1 to 1 T3 : test
`,
{ logLevel: 1 }
);
cy.get('svg');
});
});
Loading

0 comments on commit 599d035

Please sign in to comment.