diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1d1724a5e..1b84bfd45 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -50,7 +50,7 @@ body: attributes: label: Setup description: |- - Please fill out the below info. + Please fill out the info below. Note that you only need to fill out the relevant section value: |- - Mermaid version: diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..f3e440fce --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,29 @@ +name: Build Vitepress docs + +on: + pull_request: + +permissions: + contents: read + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + cache: pnpm + node-version: 18 + + - name: Install Packages + run: pnpm install --frozen-lockfile + + - name: Run Build + run: pnpm --filter mermaid run docs:build:vitepress diff --git a/.github/workflows/e2e-applitools.yml b/.github/workflows/e2e-applitools.yml index da6dbdb1f..92f2f80b1 100644 --- a/.github/workflows/e2e-applitools.yml +++ b/.github/workflows/e2e-applitools.yml @@ -38,15 +38,8 @@ jobs: - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - cache: pnpm node-version: ${{ matrix.node-version }} - - name: Install Packages - run: | - pnpm install --frozen-lockfile - env: - CYPRESS_CACHE_FOLDER: .cache/Cypress - - if: ${{ env.USE_APPLI }} name: Notify applitools of new batch # Copied from docs https://applitools.com/docs/topics/integrations/github-integration-ci-setup.html @@ -54,19 +47,22 @@ jobs: env: # e.g. mermaid-js/mermaid/my-branch APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }} - APPLITOOLS_PARENT_BRANCH: ${{ github.inputs.parent_branch }} + APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }} APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com' - - name: Run E2E Tests - run: pnpm run e2e + - name: Cypress run + uses: cypress-io/github-action@v4 + id: cypress + with: + start: pnpm run dev + wait-on: 'http://localhost:9000' env: - CYPRESS_CACHE_FOLDER: .cache/Cypress # Mermaid applitools.config.js uses this to pick batch name. APPLI_BRANCH: ${{ github.ref_name }} APPLITOOLS_BATCH_ID: ${{ github.sha }} # e.g. mermaid-js/mermaid/my-branch APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }} - APPLITOOLS_PARENT_BRANCH: ${{ github.inputs.parent_branch }} + APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }} APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com' diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index b2c17f9fc..3a9af99c1 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -36,7 +36,7 @@ jobs: restore-keys: cache-lychee- - name: Link Checker - uses: lycheeverse/lychee-action@v1.6.1 + uses: lycheeverse/lychee-action@v1.7.0 with: args: >- --verbose diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index cdd6167b7..b556c1b1d 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -5,10 +5,6 @@ on: push: branches: - master - pull_request: - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -53,7 +49,6 @@ jobs: # Deployment job deploy: - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} environment: name: github-pages runs-on: ubuntu-latest @@ -61,4 +56,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 28094453e..eb28fe9c8 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: fregante/setup-git-user@v1 + - uses: fregante/setup-git-user@v2 - uses: pnpm/action-setup@v2 # uses version from "packageManager" field in package.json diff --git a/.vite/build.ts b/.vite/build.ts index 183158288..c2f8f08f5 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -11,6 +11,7 @@ const visualize = process.argv.includes('--visualize'); const watch = process.argv.includes('--watch'); const mermaidOnly = process.argv.includes('--mermaid'); const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const sourcemap = false; type OutputOptions = Exclude< Exclude['rollupOptions'], @@ -60,9 +61,15 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) { name, format: 'esm', - sourcemap: true, + sourcemap, entryFileNames: `${name}.esm${minify ? '.min' : ''}.mjs`, }, + { + name, + format: 'umd', + sourcemap, + entryFileNames: `${name}${minify ? '.min' : ''}.js`, + }, ]; if (core) { @@ -79,7 +86,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) { name, format: 'esm', - sourcemap: true, + sourcemap, entryFileNames: `${name}.core.mjs`, }, ]; diff --git a/README.md b/README.md index 31c6d62c6..941e1fd18 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,13 @@ class Class10 { int id size() } +namespace Namespace01 { + class Class11 + class Class12 { + int id + size() + } +} ``` ```mermaid @@ -184,6 +191,13 @@ class Class10 { int id size() } +namespace Namespace01 { + class Class11 + class Class12 { + int id + size() + } +} ``` ### State diagram [docs - live editor] diff --git a/cSpell.json b/cSpell.json index df4b03251..eb847040c 100644 --- a/cSpell.json +++ b/cSpell.json @@ -23,6 +23,7 @@ "classdef", "codedoc", "colour", + "commitlint", "cpettitt", "customizability", "cuzon", @@ -62,6 +63,7 @@ "lintstagedrc", "logmsg", "lucida", + "markdownish", "matthieu", "mdast", "mdbook", @@ -91,8 +93,12 @@ "sidharth", "sidharthv", "sphinxcontrib", + "startx", + "starty", "statediagram", "steph", + "stopx", + "stopy", "stylis", "substate", "sveidqvist", @@ -102,9 +108,11 @@ "textlength", "treemap", "ts-nocheck", + "tsdoc", "tuleap", "ugge", "unist", + "valign", "verdana", "viewports", "vinod", diff --git a/cypress/integration/rendering/classDiagram-v2.spec.js b/cypress/integration/rendering/classDiagram-v2.spec.js index a11571814..2e7a1cbd7 100644 --- a/cypress/integration/rendering/classDiagram-v2.spec.js +++ b/cypress/integration/rendering/classDiagram-v2.spec.js @@ -548,4 +548,18 @@ class C13["With Città foreign language"] ` ); }); + it('should add classes namespaces', function () { + imgSnapshotTest( + ` + classDiagram + namespace Namespace1 { + class C1 + class C2 + } + C1 --> C2 + class C3 + class C4 + ` + ); + }); }); diff --git a/cypress/integration/rendering/classDiagram.spec.js b/cypress/integration/rendering/classDiagram.spec.js index cda455f0e..427b4cf0b 100644 --- a/cypress/integration/rendering/classDiagram.spec.js +++ b/cypress/integration/rendering/classDiagram.spec.js @@ -286,7 +286,7 @@ describe('Class diagram', () => { cy.get('svg'); }); - it('15: should render a simple class diagram with css classes applied two multiple classes', () => { + it('15: should render a simple class diagram with css classes applied to multiple classes', () => { imgSnapshotTest( ` classDiagram diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index e8e9b55a6..1b1ccd685 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -393,9 +393,9 @@ mindmap